Friday, September 28, 2012

DB,ASM Autostart after OS Reboots Oracle 11g, RHEL5

DB,ASM Autostart after OS Reboots Oracle 11g, RHEL5
#########################################################3
DB,ASM Autostart after OS Reboots:
Steps:

i) create a script dbora and place in /etc/init.d
[root@devstg01 init.d]# cat dbora
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# 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/DB/11.1.0
LD_LIBRARY_PATH=$ORA_HOME/lib
#ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# 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 $ORA_HOME"
touch /var/lock/subsys/dbora
;;
'stop')
# 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 $ORA_HOME"
rm -f /var/lock/subsys/dbora
;;
Esac
ii) Create symbolic links in the /etc/rc3.d and /etc/rc5.d
/etc/rc3.d
ln -s /etc/init.d/dbora S98dbora
/etc/rc5.d
ln –s /etc/init.d/dbora S97dbora
ln –s /etc/init.d/dbora K99dbora
make sure these dbstartup scripts are fired up before grid control startup script.
iii) chkconfig --add dbora
iv) there is bug with the cssd and DB startup scripts, this will conflict with the ASM startup with cssd process.
edit the /etc/inittab file and move the respawn of cssd between runleves 2 and 3
ex:
l2:2:wait:/etc/rc.d/rc 2
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 > $LOG 2>&1
$ORACLE_HOME_LISTNER/bin/lsnrctl start LISTENER_EMDEVSTG>> $LOG 2>&1 &
VER10LIST=`$ORACLE_HOME_LISTNER/bin/lsnrctl version grep "LSNRCTL for " cut -d' ' -f5 cut -d'.' -f1`
export VER10LIST
else
echo "Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr"
fi
fi

snippet from dbstop script:
# Stop Oracle Net Listener
if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
echo "$0: Stoping Oracle Net Listener" >> $LOG 2>&1
$ORACLE_HOME_LISTNER/bin/lsnrctl stop LISTENER_EMDEVSTG>> $LOG 2>&1 &
else
echo "Failed to auto-stop Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr"
fi
fi

vii) Reboot the Server, your DB, ASM should be started automatically.
viii) Verify the logs in /var/log/messages and DB alert logs.

No comments:

Post a Comment