After installation OEM 11g mostly we required is to start the OEM services even after server reboot so here you will see how to make a OEM start-up script and add into the OS start-up sequence.
This is purely to avoid manual operation of OEM start-up if in any case we reboot the server.
This is purely to avoid manual operation of OEM start-up if in any case we reboot the server.
1. Create dbora (service name) file as below:
vi /etc/init.d/dbora
#Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance
ORACLE_HOME="/oem/oracle/app/oracle/product/11.2.0/dbhome_1/"
ORACLE_OWNR="oracle"
OMS_ORACLE_HOME="/oem/Middleware/oms11g/"
OEM_AGENT_HOME="/oem/Middleware/agent11g/"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
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)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_OWNR -c $ORACLE_HOME/bin/dbstart
su - $ORACLE_OWNR -c "$OMS_ORACLE_HOME/bin/emctl start oms"
su - $ORACLE_OWNR -c "$OEM_AGENT_HOME/bin/emctl start agent"
touch /var/lock/subsys/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_OWNR -c $ORACLE_HOME/bin/dbshut
su - $ORACLE_OWNR -c "$OMS_ORACLE_HOME/bin/emctl start oms"
su - $ORACLE_OWNR -c "$OEM_AGENT_HOME/bin/emctl start agent"
rm -f /var/lock/subsys/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
2. #chkconfig --add dbora
3. #chkconfig dbora on
4. #chkconfig dbora status
5. #service dbora status
6. #service dbora start
7. #edit /etc/oratab file
edit Y in front of all the Instances which you want to start at startup time
Cheers...!!!
At the stop) block, a typo was found. 'stop' should be used instead of 'start', ie, emctl stop oms; emctl stop agent
ReplyDelete