Set up the system start and close Oracle when setting the system start and shut down in Linux

zhaozj2021-02-16  90

1. Generate DBORA scripts

Su - root

vi /etc/init.d/dbora

Add the following in the script:

#

#! / bin / sh

# Set ora_home to be equivalent to the $ oracle_home # from which you wish to execute dbstart and dbshut; ## set ora_owner to the user id of the ooner of the # Oracle Database in Ora_HOME.

ORA_HOME = / U01 / Oracle / Product / 9.2.0 Mar_owner = ORACLOG = $ ORA_HOME / Startup.log

Touch $ logchmod a r $ log

IF [! -f $ ora_home / bin / dbstart] Then Echo "Oracle Startup: Cannot Start" EXITFI

Case $ 1 in'Start ') Echo "$ 0: Starting Up"> $ log date >> $ log # start oracle net if [-f $ ora_home / bin / tnslsnr]; the echo "Starting Oracle Net Listener" Su - $ Ora_owner -c $ ora_home / bin / lsnrctl start >> $ log 2> & 1 & fi echo "Starting Oracle Databases" Su - $ ORA_OWNER -C $ ORA_HOME / BIN / DBSTART >> $ LOG 2> & 1 ;; 'Stop' Echo "$ 0: shutting down" >> $ log date >> $ log # stop oracle Net IF [-f $ oracle_home / bin / tnslsnr]; the echo "stopper Oracle Net Listener" Su - $ ora_owner -c $ ora_home / bin / lsnrctl stop >> $ log 2> & 1 Fi Echo "Stopping Oracle Databases" Su - $ ORA_OWNER -C $ ORA_HOME / BIN / DBSHUT >> $ LOG 2> & 1 ;; *) Echo "USAGE: $ 0 {start | stop} "EXIT ;; esac # exit

The ORA_HOME variable is set to the actual $ Oracle_Home path, and the same ORA_OWNER is also set to an operating system username installed in Oracle software.

2. Add executable properties to DBORA scripts

CHMOD A X /ETC/INIT.D/dbora

3. Use the script link to the corresponding path of the Run Level to achieve self-start and self-turning

Suppose the Run Level of the Linux system is 3 (enter the character interface when starting), then

Ln -s /etc/init.d/dbora /etc/rc3.d/s99dboraln -s /etc/init.d/dbora /etc/rc3.d/k01dbora

Suppose the Run Level of the Linux system is 5 (enter the graphical interface when starting), then

ln -s /etc/init.d/dbora /etc/rc5.d/s99dbora

ln -s /etc/init.d/dbora /etc/rc5.d/k01dbora

4. Restart the system, check if Oracle has been started automatically, if not, check the $ ORACLE_HOME / Startup.log file to see what error message.

转载请注明原文地址:https://www.9cbs.com/read-10513.html

New Post(0)