Update 'oratab' (under /etc or /var/opt/oracle) as:
SID:ORACLE_HOME:Y
#dbstart will automatically start instances with Y
This script does not work for ASM requiring CRS to be running
[/etc/init.d/dbora]
#!/bin/bash
#
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
# 35 means that the service will be started in init levels 3 and 5 and will be stopped in other levels.
# 99 means that the service will be started at the near end of the init level processing
# 10 means that the service will be stopped at the near beginning of the init level processing
#
# Set ORA_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 ORA_HOME.
#
ORA_HOME=/app/oracle/product/11.1.0/db_1
ORA_OWNER=ora11
LSNR_NAME=lsnr_al12
case "$1" in
'start')
# Start the TNS Listener
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start $LSNR_NAME"
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
# Start the Intelligent Agent
##if [ -f $ORA_HOME/bin/emctl ]; then
## su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start agent"
##elif [ -f $ORA_HOME/bin/agentctl ]; then
## su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"
##else
## su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"
##fi
# Start Management Server
##if [ -f $ORA_HOME/bin/emctl ]; then
## su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
##elif [ -f $ORA_HOME/bin/oemctl ]; then
## su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"
##fi
# Start HTTP Server
##if [ -f $ORA_HOME/Apache/Apache/bin/apachectl]; then
## su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
##fi
touch /var/lock/subsys/dbora
;;
'stop')
# Stop HTTP Server
##if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then
## su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
##fi
# Stop the TNS Listener
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop $LSNR_NAME"
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
rm -f /var/lock/subsys/dbora
;;
esac
# End of script dbora
chmod 755 /etc/init.d/dbora
#Linux
/sbin/chkconfig --add dbora
|