[oracle@eslhdb01 oracle]$ vi /data/autorun/chkalertlog.sh
####################################################################
##chkalertlog.sh ##
####################################################################
#!/bin/ksh
DBALIST="
lisa_w.d._wang@foxconn.com"
SID=eslhdb0
OSID=eslhdb01
ORACLE_BASE=/u01/product
FILENAME=alert_${OSID}.log_`date +%Y%m%d`
cd $ORACLE_BASE/admin/$SID/bdump
if [ ! -f alert.err ]
then
touch alert.err
fi
if [ -f alert_${OSID}.log ]
then
cp alert_${OSID}.log alert_work.log
if [ -f $FILENAME ]
then
cat alert_${OSID}.log >> $FILENAME
else
cp alert_${OSID}.log $FILENAME
echo "" > alert_${OSID}.log
mail -s "${OSID} Oralce Alert Log ${FILENAME}" $DBALIST < $FILENAME
fi
#touch alert.dbg
#mv alert_${OSID}.log alert_work.log
#touch alert_${OSID}.log
#cat alert_work.log >> alert_${OSID}.hist
grep ORA- alert_work.log > alert.err
fi
if [ `cat alert.err|wc -l` -gt 0 ]
then
mail -s "${OSID} ORACLE ALERT ERRORS" $DBALIST < alert_work.log
fi
echo "" > alert_${OSID}.log
rm -f alert_work.log
mv `find ./ -name "*.*" -maxdepth 1 -atime +6` ./loghist
rm -f `find ./loghist -atime +30`
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12137615/viewspace-612365/
,如需转载,请注明出处,否则将追究法律责任。