Thursday, May 28, 2009

Alert log monitoring scripts

export SID=ILPROD
export ORACLE_HOME=/u11/app/ilproddb/9.2.0
export DIR=$ORACLE_HOME/Scr
> $DIR/alert_${SID}.hist
> $DIR/alert.err
cd /u11/app/ilproddb/9.2.0/admin/ILPROD_ilerpdb01/bdump
tail -100 alert_${SID}.log > $DIR/alert_${SID}.hist
cat $DIR/alert_${SID}.hist |grep ORA- |grep -v "ORA-01001: invalid cursor" |grep -v "17281" |grep -v "ORA-000060: Deadlock de
tected" > $DIR/alert.err
if [ `cat $DIR/alert.err|wc -l` -gt 0 ]
then
mailx -s "${SID} ALERT : ORA- ERRORS" erpdba@lgezbuy.com < $DIR/alert.err
fi