Tuesday, November 20, 2007

Oracle Startup Script


#!/bin/sh
#
# dbora This scripts starts and shuts down the
# oracle database
#
# chkconfig: 345 99 10
# description: This script calls the dbstart script
# to start Oracle
# and dbshut to stop it
# processname: oracle*
# config: /etc/oratab
#
# Set ORACLE_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 ORACLE_HOME.
export ORACLE_BASE=/opt/oracle10
export ORACLE_HOME=/opt/oracle10
export ORACLE_SID=DSSDB
ORACLE_HOME=/opt/oracle10
ORA_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" &
;;
'stop')
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
;;
'restart')
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
sleep 15
su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start " &
;;
esac

No comments:

Post a Comment