I am interested to check the alert.log file using OEM. I am using Oracle 9.2.0.6. If there is any error in alert.log, then Oracle Enterprise Manager should Email me.
cd /u1/oracle/admin/$ORACLE_SID/bdump
#you may want to make a common place for sym links to all your alert logs
files="alert_*.log"
for file in $(find $files)
do
DT=$(date)
awk '
BEGIN {Flg=0}
NR==1 {R=split(DATE,TMP," ")
Day=TMP[1]
Month=TMP[2]
NoDay=TMP[3]}
{NoDayM=NoDay-1}
NF==5 && $2==Month && ( $3==(NoDayM) || $3==NoDay ) {Flg=1}
Flg==1 {print $0}
' DATE="$DT" $file | awk '
/^ORA-/ || /cannot/ {print DATE
print $0}
NF==5 {DATE=$0}
'
done
exit 0
Emailing the output is simply a matter of piping the output through your favorite email binary or let OEM send it.
Bookmarks