Automatically starting things

September 25, 2012 at 10:57 am | Posted in Linux, Oracle Developement | Leave a comment
Tags: , ,

To automatically start an Oracle database (11.2.0 in this case) on Linux RHEL 5, first edit the /etc/oratab file to allow for the dbstart command to startup the database. The oratab file contains an entry for each database. Each entry contains three elements separated by colons:




Make sure that the start flag is set to Y.

Next, create a file orastart with the startup instruction in the /etc/init.d directory:

(I’ve added some logging instructions for better troubleshooting)

# chkconfig: 345 99 10
# description: Starts Oracle database
echo "=============================================" >> $LOG
echo "$(date) Starting Database" >> $LOG
su - $OWNER -c "$ORACLE_HOME/bin/lsnrctl start" >> $LOG
su - $OWNER -c $ORACLE_HOME/bin/dbstart $ORACLE_HOME >> $LOG
echo "$(date) Finished." >> $LOG

Make sure to include the chkconfig and description comments. The three numbers after the command determine the start and stop priorities for the different runlevels. In this case, for runlevels 3, 4, and 5, the start priority is 99 and the stop priority is 10.

Grant execute permissions to the file.

Finally, add the file with the startup instructions to the runlevel information:

(as root)

$ cd /etc/init.d
$ chkconfig --add orastart

To verify that the startdb file has been added you can use:

$ chkconfig --list | grep startdb
orastart         0:off   1:off   2:off   3:on    4:on    5:on    6:off

Now reboot your machine and watch the database start up.

Further reading:

Automating Database Startup and Shutdown.

6 Stages of Linux Boot Process

About chkconfig


Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at
Entries and comments feeds.

%d bloggers like this: