Automatic startup and shutdown of oracle on unix machines

how to automate start and shutdown of Oracle database with the start up and shutdown of Operating system is described here:

1) Open the oratab file as root user in any text editor:
# vi /etc/oratab
Database entries in the oratab file are displayed in the following format:

SID:ORACLE_HOME:{Y|N}

In this example, Y or N specifies whether you want the scripts to start up or shut down the database. For each database for which you want to automate shutdown and startup, first find the instance identifier (SID) for that database, which is identified by the SID in the first field. Then, change the last field for each to Y

2)Then create a file dbora inside /etc/int.d with the following content

#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle

PATH=${PATH}:$ORACLE_HOME/bin
HOST='hostname'
PLATFORM='Linux'
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
exit
fi
fi
#
case $1 in
'start')
if [ "$PLATFORM" = "Linux" ] ; then
touch /var/lock/subsys/dbora
fi
$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
$ORACLE_HOME/bin/lsnrctl start LISTENER;;

'stop')
$ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
$ORACLE_HOME/bin/lsnrctl start LISTENER;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit

**Note:ORACLE_HOME: points to the oracle directory where it has the runnable script for oracle


3)Change the group of the dbora file to the OSDBA group (typically dba), and set the permissions to 750:
# chgrp dba dbora
# chmod 750 dbora

4)Create symbolic links to the dbora script in the appropriate run-level script directories as follows
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

Try restarting your server and after the server has successfully restarted check the connectivity to oracle. It should work fine.

Thank you.


Thanks for:
http://download.oracle.com/docs/cd/B19306_01/server.102/b15658/strt_stp.htm#CFAHAHGA

No comments:

Post a Comment