同事寫的監控Logical Standby SQL apply 程式stop的監控報警指令碼

tolywang發表於2010-07-22


#!/bin/sh

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME
ORACLE_SID=orcl;export ORACLE_SID
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

output=`/u01/product/oracle/bin/sqlplus  /nolog <#su oracle -c "/u01/product/oracle/bin/sqlplus /nolog <        conn / as sysdba
        spool /data/run/checkinfo.txt
        select count(*) from v\\$logstdby_process;
        spool off;
        exit
        EOF`


#echo "$output" >> /data/run/log/checklog.txt

value=`cat /data/run/checkinfo.txt | sed -n '5,2p'`
#echo ${value:0:9}
#tmp=${value:0:9}

#source /home/oracle/.bash_profile

if [ "$value" -eq "0" ] ; then
/usr/local/bin/net send 192.168.0.1 "Logical Standby Apply Processes have died!"
#/usr/local/bin/net send 192.168.0.2 "Logical Standby Apply Processes have died!"
elif [ "${value:0:9}" = "ORA-01034" ] ; then
/usr/local/bin/net send 192.168.0.1 "Logical Standby has stopped!"
/usr/local/bin/net send 192.168.0.2 "Logical Standby has stopped!"
fi

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-668792/,如需轉載,請註明出處,否則將追究法律責任。

相關文章