Saturday, February 20, 2010

Auto Startup and Shutdown Oracle Database on Linux

Follow the following steps for configuring Automating Database Startup and Shutdown on Linux


1. Once the instance is created, edit /etc/oratab file setting the restart flag for each instance to 'Y'.

  ORCL:/oradisk/app/oracle/product/10.2.0:Y

2. Next, create a file /etc/init.d/dbstart as the root user, containing the following.

#!/bin/bash
#
#chkconfig: 345 95 10
#description: init script to start/stop oracle database 10g, TNS listener, EMS and isqlplus
#
case $1 in
start)
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'
su - ora10g -c 'isqlplusctl start'
su - oracle -c 'emctl start dbconsole'
;;
stop)
su - oracle -c 'emctl stop dbconsole'
su - oracle -c 'isqlplusctl stop'
su - oracle -c 'dbshut'
su - oracle -c 'lsnrctl stop'
;;
restart)
su - oracle -c 'emctl stop dbconsole'
su - oracle -c 'isqlplusctl stop'
su - oracle -c 'dbshut'
su - oracle -c 'lsnrctl stop'
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'
su - ora10g -c 'isqlplusctl start'
su - oracle -c 'emctl start dbconsole'
;;
esac

3. Create OS Level Service on linux

Actions > System Settings > Server Settings > Services > Actions > Add Service >
Here type Service Name = dbstart and press Ok

Note: that Service Name must be same as file name that you have created (/etc/init.d/dbstart)

4. Loging as “root” user and execute following command

chmod a+x /etc/init.d/dbstart

5. Check is it running this service properly


  service dbstart stop
  service dbstart start
  service dbstart restart

Now when server restart Oracle Listener, Database, iSQLPlus, DB Console) start automatically. 
.

2 comments:

Ariq said...

Nice post

Thanks

oracle ebs r12 said...

I visited your site and realized that there are lots of good article on Oracles. Quite informative blog for learning new things.