[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
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
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
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
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,如需转载请自行联系原作者