[root@myserver ~]# cat /etc/init.d/dbora
#!/bin/bash
#
# chkconfig: 345 60 50
# description: Oracle auto start-stop script.
# Modify the variables $ORA_HOME, $ORA_OWNER and $LOG as appropriate for each server.
# - Nabeel Moidu
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
# Modify the variables $ORA_HOME, $ORA_OWNER and $LOG as appropriate for each server.
# - Nabeel Moidu
ORA_HOME=/u01/oracle/product/10.2.0.1
ORA_OWNER=ora10g
LOG=$ORA_HOME/log/server/dbora/dbora.log
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
start)
echo "$0: starting up" >> $LOG
# Start the Oracle databases:
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart &" >> $LOG
# Start Oracle listener
date >> $LOG
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >> $LOG 2>&1
touch /var/lock/subsys/dbora
echo "Refer to $LOG for details"
;;
stop)
echo "$0: stopping down" >> $LOG
date >> $LOG
# Stop Oracle Net
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >> $LOG 2>&1
# Stop the Oracle databases:
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut &" >> $LOG
rm -f /var/lock/subsys/dbora
;;
restart)
$0 stop
sleep 120
$0 start
;;
status)
if [ -f /var/lock/subsys/dbora ]; then
echo $0 started.
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl status"
else
echo $0 stopped.
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl status"
fi
;;
*)
echo "usage: dbora {start|stop|restart|status}"
exit 1
esac
exit 0
Wednesday, August 06, 2008
DBORA script for oracle startup in RHEL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment