shutdown Oracle instances during SOLARIS system startup or shutdown.
The following are files which are invoked during system startup
and shutdown, respectively.
Script Description
-------------------------|---------------------------------------
$ORACLE_HOME/bin/dbstart |Ensures a clean startup of instance(s),
|even after system failure
-------------------------|---------------------------------------
$ORACLE_HOME/bin/dbshut |Ensures a clean shutdown for instances
-------------------------|---------------------------------------
/etc/init.d or |Contains a field that specifies whether
/var/opt/oracle/oratab |a particular instance should be brought
|up/down at system startup/shutdown time.
-------------------------|---------------------------------------
Relevant Files
- - - - - - - -
/etc/rc2.d/S99dbstart -- Link to the script /etc/init.d/priya_dbstart
/etc/rc0.d/K01dbshut -- Link to the script /etc/init.d/priya_dbstart
/etc/init.d/oratab -- Oracle oratab file
When an UNIX machine boots, it runs scripts beginning with
S
in which these scripts will be run. The
the Unix administrator as to the function of the script.
Similarly, on shutdown scripts named K
/etc/rc0.d.
Setting Up:
-----------
1. Ensure the /var/opt/oracle/oratab file is complete and correct.
Database entries in the oratab file have the following format:
ORACLE_SID:ORACLE_HOME:Y
Where Y specifies you want to startup the database automatically.
2. Create the script /etc/init.d/priya_dbstart.
3. As root create the following links.
# ln -s /etc/init.d/priya_dbstart /etc/rc3.d/S99dbstart
# ln -s /etc/init.d/priya_dbstart /etc/rc0.d/K01dbstart
4. Test the script created in Step 2.
To test the script created above, without rebooting do the
following:
# su – root
# /etc/init.d/priya_dbstart start (for startup)
# /etc/init.d/priya_dbstart stop (for shutdown)
Script
Note :this script should be in /etc/init.d/'filename'
#!/bin/ksh
#--------------------------------------------------------------------------------
# Script Name : /etc/init.d/priya_dbstart
# Purpose : To start and shutdown databases while system startup/shutdown
# Version : 1.0
# Change log : Initial draft (10/20/2008)
#
#--------------------------------------------------------------------------------
ORACLE_BASE=/u01/oracle
ORACLE_HOME=$ORACLE_BASE/ORACLE/product/10.2.0
export ORACLE_BASE ORACLE_HOME
case "$1" in
'start')
# start Oracle databases
su - oracle -c "$ORACLE_HOME/bin/dbstart"
su - oracle -c "$ORACLE_HOME/bin/lsnrctl start "
for i in orcl ora10g
do
export ORACLE_SID=$i
su oracle -c "$ORACLE_HOME/bin/emctl start dbconsole "
done
;;
'stop')
# stop Oracle databases
for i in orcl ora10g
do
export ORACLE_SID=$i
su oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole"
done
su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop "
su - oracle -c "$ORACLE_HOME/bin/dbshut"
;;
esac