Unix Shell Script To Monitor Oracle Alert Log:
#!/bin/ksh.
/usr/local/bin/RACT.env
export machine=`uname -n`
export script_dir=/export/home/oracle/local/scripts
export bdump=/export/home/oracle/admin/RACT/bdump
export flagfile=/export/home/oracle/admin/RACT/bdump/flag.lis
flagoldval=`cat $flagfile`
cat $bdump/alert_${ORACLE_SID}.log wc -l > $flagfile
flagnewval=`cat $flagfile`
NUM=$(($flagnewval-$flagoldval))
tail -$NUM $bdump/alert_${ORACLE_SID}.log awk
'BEGIN {prev="" ; ret=1 }
/^(...-Error)/ { if ( prev !~ /^(...-Error)/ ) { print "" ; print prev;} print $0;ret=0}
{prev=$0}
END { exit ret } '> $bdump/alert_temp10.log
if [ `cat $bdump/alert_temp10.log wc -l` -gt 0 ]
then
(echo "To: mailto:xxy@test.com/nSubject: CRITICAL: RACT: Error in alert log \n\n"; cat $bdump/alert_temp10.log)/usr/lib/sendmail xxy@test.com
else
echo "No Error"
fi
Thursday, June 4, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment