我寫的oracleRAC狀態監控指令碼(在單位一直使用,比較穩定)

weixin_34117211發表於2017-11-14
[oracle@racdb4 jk]$ cat jkstatus.sh 
export ORACLE_SID=racdbidc2
echo "error2GO" > s.txt
sqlplus -s < status.sql  &> ss.txt
jjj=`cat s.txt|grep GO`
if [ $jjj = "GOOD" ];then
        #echo "Oracle --2 status good."
        mail -s "OracleRAC-2 OK." master@bjepiao.com < s.txt
else
        #echo "Oracle --2 error."
        mail -s "OracleRAC-2 error." master@bjepiao.com < s.txt
        #mail -s "OracleRAC-2 error." chinadba@139.com,master@bjepiao.com < s.txt
fi
 
[oracle@racdb4 jk]$ cat status.sql 
jkadmin/llpw123
spool s.txt
set time on
set timing on
select qstatus from statustab;
spool off
quit
 
 
[oracle@racdb3 jk]$ cat jkstatus.sh 
export ORACLE_SID=racdbidc1
echo "error1GO" > s.txt
sqlplus -s < status.sql &> ss.txt
jjj=`cat s.txt|grep GO`
if [ $jjj = "GOOD" ];then
        #echo "Oracle --1 status good."
        mail -s "OracleRAC-1 OK." master@bjepiao.com < s.txt
else
        #echo "Oracle --1 error."
        mail -s "OracleRAC-1 error." chinadba@139.com,master@bjepiao.com < s.txt
fi
 
[oracle@racdb3 jk]$ cat status.sql 
jkadmin/llpw123
spool s.txt
set time on
set timing on
select qstatus from statustab;
spool off
quit
 









本文轉自 jxwpx 51CTO部落格,原文連結:http://blog.51cto.com/jxwpx/230887,如需轉載請自行聯絡原作者

相關文章