Automatic Startup of Oracle Database and Listener at System Boot Time

Feature Data Objects API

 
Automatic Startup of Oracle Database and Listener at System Boot Time
 
 
 

Put the following script called init.oracle in /etc/init.d.

!#/bin/sh########################################## RHEL 3.0 and Oracle 10.1.0# autostart oracle database and listener########################################## Comments to support chkconfig on RedHat Linux# chkconfig: 2345 64 36# description: starts and stops the database and the listenerORA_HOME=/app/oracle/product/10.1.0/Db_2ORA_OWNER=oracleif [ ! -f /app/oracle/product/10.1.0/bin/dbstart ]thenecho "Oracle Auto Startup: CANNOT START"exitfi case "$1" in'start')su - oracle -c "/app/oracle/product/10.1.0/DB_2/bin/dbstart &"su - oracle -c "/app/oracle/product/10.1.0/DB_2/bin/lsnrctl start listener";;'stop')su - oracle -c "/app/oracle/product/10.1.0/DB_2/bin/dbshut &"su - oracle -c "/app/oracle/product/10.1.0/DB_2/bin/lsnrctl stop";;esac
NoteBe sure that the oracle bin directory, for example, /app/oracle/product/10.1.0/Db_2/bin, has been added to the PATH variable for the oracle user account and that the ORACLE_HOME variable has been set for the oracle user account. In this example the value of ORACLE_HOME is /app/oracle/product/10.1.0/DB_2. Otherwise the listner start and listener stop calls fail with complaints about messages not found.

Run chkconfig --add init.oracle. chkconfig uses the information in the chkconfig comment line in init.oracle to set up calls to the script in the /etc/rc<n>.d directories.