Automate Database Startup and Shutdown
Automating database start-up is optional, but automatic shutdown is recommended, because it guards against improper shutdown of the database.

The dbshut and dbstart scripts are located in the $ORACLE_HOME/bin directory, and can be used to automate database startup and shutdown, although on 8.1.6 there is a problem with dbstart. Consult Metalink :Note:98418.1. For further info.

The dbstart and dbshut scripts reference the same entries in the oratab file, so the scripts must apply to the same set of databases. For example, you cannot have dbstart automatically start up databases sid1, sid2, and sid3, and dbshut shut down only databases sid1 and sid2. You can, however, specify that dbshut shut down a set of databases while dbstart is not used at all. To do this, include the dbshut entry in the shutdown file but omit the dbstart entry from the system start-up files.

Oratab Entries
This process must be completed for every new database that you want to have automated start-up and shutdown. To set up the dbstart and dbshut scripts so that they are called at system start-up:

Edit the /var/opt/oracle/oratab file.

Database entries in the oratab file appear in the following format:

ORACLE_SID:ORACLE_HOME:{Y|N}
where Y or N specifies whether you want the dbstart and dbshut scripts to start up and shut down the database.

Find the entries for all the databases that you want to start up. They are identified by the sid in the first field. Change the last field for each to Y.

 

Creation of dbora - This should be located in /etc/init.d directory
 
#!/bin/sh
# 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/8.1.7
ORA_OWNER=oracle

if [! -f $ORA_HOME/bin/dbstart]
then
       echo "Oracle startup: cannot start"
exit
fi

case "$1" in
'start')

# Start the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values

su - $ORA_OWNER -c $ORA_HOME/bin/dbstart &
;;
'stop')

# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values

su - $ORA_OWNER -c $ORA_HOME/bin/dbshut &
;;
esac

#Make sure the file has execute permission. i.e chmod 744 dbora 
					  

Link dbora to appropriate rc scripts

You must be logged onto Unix a root to create the following symbolic links

ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc2.d/S99dbora

Next time the computer is rebooted, the shutdown and start-up of the databases will happen automatically.