Tuesday, October 31, 2006

Script, Auto start opmn on Oracle AS

I have the single Oracle AS. I need auto start, when system reboot. So
..........................

#!/bin/sh
# By HunterX
# For auto start Oracle AS

export ORACLE_HOME=/oracle/product/10.1.3/.../OracleAS
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

ORA_HOME=$ORACLE_HOME
ORA_OWNER=oracle
case "$1" in
'start')
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl startall"
;;
'stop')
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl stopall"
;;
'status')
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl status -l"
;;
*)
echo "Usage: oraas {start|stop|status}"
exit 1
esac

exit 0

3 comments:

Anonymous said...

Nice work. I just have a quick question for you. Have you tried to customize OPMN to automatically notify or alert you when one of the components being monitored has stopped? I am actually looking for a way to do it and I'm wondering if you have any idea on this? Thanks.

Surachart Opun said...

that's great idea.
example shell script:
#!/bin/sh
AS_HOME/opmn/bin/opmnctl status -l |grep Down > /tmp/check

if [ `wc -l /tmp/check | awk '{print $1}'` -gt 0 ]
then
# send mail for alert
fi
exit;

Anonymous said...

Its a very good command, as you know ASG component remains down and we will be getting alerts for ASG only...is there any othere to check only for components which we are using ?