- update the oratab file under /etc or /var/opt/oracle
where Y states that the database to be started up/shutdown
- Create the service script in the following location:
/etc/init.d/
vi dbora
- Modify the following script to match the specific environment and This becomes the content of the "dbora" service script.
===================================================================================
#!/bin/sh
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
DB_SCRIPTS=" FULL DATABASE SCRIPT LOCATION HERE"
APPS_SCRIPTS=:" FULL APPS SCRIPT LOCATION HERE"
ORADEV_OWNER=DB_USER
APPSDEV_OWNER=APPS_USER
LOG_FILE='touch /var/lock/subsys/dbora'
case "$1" in
'start') # Start the Oracle database,listener and apps
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addbctl.sh start"
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addlnctl.sh start SID"
sleep 100
su - $APPSDEV_OWNER -c "$APPS_SCRIPTS/adstrtal.sh apps/apps"
;;
'stop') # Stop the Oracle database,listener and apps
su - $APPSDEV_OWNER -c "$APPS_SCRIPTS/adstpall.sh apps/apps"
sleep 300
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addlnctl.sh stop SID"
su - $ORADEV_OWNER -c "$DB_SCRIPTS/addbctl.sh stop immediate"
rm /var/lock/subsys/dbora
;;
esac
===================================================================================
Modify the sleep time according to the speed of the server and the time taken by the server to startup and shutdown the instance.
- Set script permissions:
chmod 755 /etc/init.d/dbora
- Register the Service
at the terminal prompt, issue the following command.
chkconfig --add dbora
The chkconfig creates the following symbolic links,
On SuSE SLES7:
* /etc/init.d/rc0.d/K10dbora
* /etc/init.d/rc1.d/K10dbora
* /etc/init.d/rc2.d/K10dbora
* /etc/init.d/rc3.d/S99dbora
* /etc/init.d/rc4.d/K10dbora
* /etc/init.d/rc5.d/S99dbora
* /etc/init.d/rc6.d/K10dbora
On Red Hat Advanced Server:
* /etc/rc.d/rc0.d/K10dbora
* /etc/rc.d/rc1.d/K10dbora
* /etc/rc.d/rc2.d/K10dbora
* /etc/rc.d/rc3.d/S99dbora
* /etc/rc.d/rc4.d/K10dbora
* /etc/rc.d/rc5.d/S99dbora
* /etc/rc.d/rc6.d/K10dbora
The symbolic links are not created in SLES8 and after with the 'chkconfig -add' command. To have the symbolic links created run the following in addition:
/sbin/chkconfig --set dbora 35
- Now the instance will startup automatically when Linux boots up.