Wednesday, June 24, 2015
Thursday, October 9, 2014
Monday, June 17, 2013
Friday, November 30, 2012
Sunday, August 19, 2012
Tuesday, May 3, 2011
Wednesday, December 29, 2010
11g Database Auto startup/shutdown script during reboots.
Create a new file called /etc/init.d/oracle
#!/bin/bash
###########################################################################
# #
# Run-level Startup script for the Oracle Instance and Listener #
# #
# chkconfig: 345 98 34 #
# description: Startup/Shutdown script for 11g Oracle instances #
# #
###########################################################################
###########################################################################
# #
# Note: #
# cp $ORACLE_HOME/bin/dbstart $ORACLE_HOME/bin/dbstart.orig #
# Make the following changes in $ORACLE_HOME/bin/dbstart #
# #
# Line#80 has the following: #
# ORACLE_HOME_LISTNER=$1 #
# #
# Replace it with the following two lines: #
# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 #
# ORACLE_HOME_LISTNER=$ORACLE_HOME #
# #
# cp $ORACLE_HOME/bin/dbshut $ORACLE_HOME/bin/dbshut.orig #
# Make the following changes in $ORACLE_HOME/bin/dbshut #
# #
# Line#50 has the following: #
# ORACLE_HOME_LISTNER=$1 #
# #
# Replace it with the following two lines: #
# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 #
# ORACLE_HOME_LISTNER=$ORACLE_HOME #
# #
# save the file and proceed with the steps below #
# #
###########################################################################
###########################################################################
#Instructions to start start isntances manually #
# #
# To Start --> /etc/init.d/oracle start #
# To Stop --> /etc/init.d/oracle stop #
# To restrart --> /etc/init.d/oracle restart #
# #
###########################################################################
ORA_HM="/u01/app/oracle/product/11.2.0/db_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HM/bin/dbstart -o ! -d $ORA_HM ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# starting Oracle instances
echo -n "starting Oracle Instances"
su - $ORA_OWNR -c $ORA_HM/bin/dbstart
touch /var/lock/subsys/oracle
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
su - $ORA_OWNR -c $ORA_HM/bin/dbshut
rm -f /var/lock/subsys/oracle
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;
reload|restart)
$0 stop
$0 start
ps -ef |grep pmon |grep -v grep
ps -ef |grep lsnr |grep -v grep
echo "OK"
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
clear
######################END of Instructions##################################
Once the above script is created, perform the following as root.
chmod 750 /etc/init.d/oracle
chkconfig --level 345 oracle on
How to turn off/on the script.
[root@bl-mm-db-dev ~]# /sbin/chkconfig oracle off
[root@bl-mm-db-dev ~]# /sbin/chkconfig --levels 345 oracle on