oracle設定自啟動

2021-10-25 01:11:37 字數 1856 閱讀 3824

基於centos7作業系統,安裝oracle時預設是不自動啟動的。本文講述了設定自動啟動的方法。

1.使用root賬號登入系統,修改/etc/oratab檔案

# vi /etc/oratab
# vi /etc/rc.d/init.d/oracle
以下是檔案內容:

#!/bin/bash

# oracle: start/stop oracle database 11g r2

## chkconfig: 345 90 10

# description: the oracle database is an object-relational database management system.

## processname: oracle

. /etc/rc.d/init.d/functions

lockfile=/var/lock/subsys/oracle

# 需要修改oracle_home和oracle_user變數為自己安裝環境的實際變數

oracle_user=oracle

case

"$1"

in'start')if

[ -f $lockfile];

then

echo

$0 already running.

exit 1

fiecho -n $"starting oracle database:"

su - $oracle_user -c "$oracle_home/bin/dbstart $oracle_home"

su - $oracle_user -c "$oracle_home/bin/emctl start dbconsole"

touch

$lockfile;;

'stop')if

[! -f $lockfile];

then

echo

$0 already stopping.

exit 1

fiecho -n $"stopping oracle database:"

su - $oracle_user -c "$oracle_home/bin/dbshut $oracle_home"

su - $oracle_user -c "$oracle_home/bin/emctl stop dbconsole"

rm -f $lockfile;;

'restart'

)$0 stop

$0 start

;;'status')if

[ -f $lockfile];

then

echo

$0 started.

else

echo

$0 stopped.

fi;;

*)echo

"usage: $0 [start|stop|status]"

exit 1

esac

exit 0

儲存檔案

# chmod 755 /etc/rc.d/init.d/oracle

# chkconfig --add oracle # 新增服務

# chkconfig oracle on # 啟動自動運動

# chkconfig --list oracle # 檢視是否成功

# service oracle start #開啟服務

# reboot # 重啟伺服器驗證

# su - oracle

# lsnrctl status

Oracle設定為自啟動

oracle設定為自啟動 學習了 oracle自帶dbstart命令,主要進行系統啟動設定 在 etc rc.d init.d中建立oracle檔案,這個檔案拷貝過來,注意不需要修改 1為 oracle home 注意使用chkconfig oracle on命令進行oracle啟動的新增 bin ...

oracle設定linux開機自啟動

vi oracle home bin dbstart vi oracle home bin dbshut 2個檔案的oracle home listner 1,修 改為or acle home list ner 1,修改為 oracle home listner 1,修改為o racl eh o m...

Linux設定Oracle開機自啟動

linux設定oracle開機自啟動 目錄 1 編輯oratab 1 2 編輯rc.local 2 3 listener.log的許可權 3 4 編輯dbstart 3 5 測試 4 找到oratab 路徑前面的 是指的使用者路徑,我的是 home rogear 切換到對應路徑 cd home ro...