[593061 views]

[]

[toggle ads]

Odi's astoundingly incomplete notes

New entries | Code

Oracle init script

Here is a simple init script for Oracle 10/11 on RedHat Linux. It assumes your instances to start/stop are listed in /etc/oratab and the oracle user's shell environment sets ORACLE_HOME correctly.
#!/bin/sh
#
# chkconfig: 345 98 10
# description: Oracle
#

#
# change the value of ORACLE to the login name of the
# oracle owner at your site
#

ORACLE=oracle

case $1 in
'start')
cat <<-"EOF"|su - ${ORACLE}
# Start Oracle Net
if [ -f ${ORACLE_HOME}/bin/tnslsnr ] ;
then
echo "starting Oracle Net Listener"
${ORACLE_HOME}/bin/lsnrctl start
fi
echo "Starting Oracle databases"
${ORACLE_HOME}/bin/dbstart
${ORACLE_HOME}/bin/emctl start dbconsole
EOF
;;
'stop')
cat <<-"EOF"|su - ${ORACLE}
echo "shutting down"
${ORACLE_HOME}/bin/emctl stop dbconsole
# Stop Oracle Net
if [ -f ${ORACLE_HOME}/bin/tnslsnr ] ;
then
echo "stopping Oracle Net Listener"
${ORACLE_HOME}/bin/lsnrctl stop
fi
echo "stopping Oracle databases"
${ORACLE_HOME}/bin/dbshut
EOF
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit

posted on 2008-05-08 14:20 CEST in Code | 0 comments | permalink