Oracle 11G 64-bit automatic restart and shutdown commands in RHEL (Red Hat Enterprise Linux, the same below) 5.5 64-bit:
Log On As an oracle user and enter:
VI/etc/init. d/Oracle
On the Edit page, add the following content: (assume that the Oracle main directory is/u01/APP/Oracle/product/11.2.0/Dbhome_1)
#! /Bin/ Sh # Chkconfig: 35 80 10 # Description: Oracle Auto Start - Stop script. # 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 owner of the # Oracle Database In Ora_home.ora_home =/U01/APP/Oracle/product/ 11.2 . 0 / Dbhome_1ora_owner = Oracle If [! -F $ ora_home/bin/ Dbstart] Then Echo " Oracle startup: cannot start " Exit Fi Case " $1 " In ' Start ' ) # Start the Oracle databases: Echo " Starting Oracle databases... " Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: Starting Oracle databasee as part of system up. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle Su -$ Ora_owner-C " $ Ora_home/bin/dbstart " >/Var/log/ Oracle Echo " Done " # Start the listener: Echo " Starting Oracle listeners... " Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: Starting Oracle listeners as part of system up. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle Su -$ Ora_owner-C " $ Ora_home/bin/LSNRCTL start " >/Var/log/ Oracle Echo " Done. " Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: finished. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle Touch /Var/lock/subsys/ Oracle ;; ' Stop ' ) # Stop the Oracle listener: Echo " Stoping Oracle listeners... " Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: stoping Oracle listener as part of system down. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle Su -$ Ora_owner-C " $ Ora_home/bin/LSNRCTL stop " >/Var/log/ Oracle Echo " Done. " Rm -F/var/lock/subsys/ Oracle # Stop the Oracle database: Echo " Stoping Oracle databases... " Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: stoping Oracle databases as part of system down. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle Su -$ Ora_owner-C " $ Ora_home/bin/dbshut " >/Var/log/ Oracle Echo " Done. " Echo "" Echo " ------------------------------------------------- " >/Var/log/ Oracle Date + " % T % A % d: finished. " >/Var/log/ Oracle Echo " ------------------------------------------------- " >/Var/log/ Oracle ;; ' Restart ' ) $ 0 Stop $ 0 Start ;; Esac
restart. Oracle is shut down with RHEL shutdown. Oracle is automatically started after the system is restarted.