Oracle設定為自啟動

2021-09-07 19:12:56 字數 1709 閱讀 4108

oracle設定為自啟動

學習了:

oracle自帶dbstart命令,主要進行系統啟動設定;

在/etc/rc.d/init.d中建立oracle檔案,這個檔案拷貝過來,注意不需要修改$1為$oracle_home;

注意使用chkconfig oracle on命令進行oracle啟動的新增;

#!/bin/bash

# oracle: start/stop oracle database 11g r2

# chkconfig:

34590

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

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

lockfile=/var/lock/subsys/oracle

oracle_user=oracle

case"$1

"in'start')

if [ -f $lockfile ]; then

echo $0

already running.

exit 1fi

echo -n $"

starting oracle database:

"su - $oracle_user -c "

$oracle_home/bin/lsnrctl start

"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 1fi

echo -n $"

stopping oracle database:

"su - $oracle_user -c "

$oracle_home/bin/lsnrctl stop

"su - $oracle_user -c "

$oracle_home/bin/dbshut

"su - $oracle_user -c "

$oracle_home/bin/emctl stop dbconsole

"rm -f $lockfile

;;'restart')

$0stop

$0start

;;'status')

if [ -f $lockfile ]; then

echo $0

started.

else

echo $0

stopped.

fi;;*)

echo

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

"exit

1esac

exit

0

修改oracle檔案許可權,設定開機啟動

chmod

755 /etc/init.d/oracle

chkconfig oracle on

oracle設定自啟動

基於centos7作業系統,安裝oracle時預設是不自動啟動的。本文講述了設定自動啟動的方法。1.使用root賬號登入系統,修改 etc oratab檔案 vi etc oratab vi etc rc.d init.d oracle以下是檔案內容 bin bash oracle start st...

Redis設定為開機自啟動

vim etc init.d redis bin sh chkconfig 2345 90 10 description redis is a persistent key value database path usr local bin sbin usr bin bin redisport 63...

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...