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

# 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

case "$1" in
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl startall"
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl stopall"
su - $ORA_OWNER -c "$ORACLE_HOME/opmn/bin/opmnctl status -l"
echo "Usage: oraas {start|stop|status}"
exit 1

exit 0


macdba 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.

HunterX said...

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

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

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 ?