Database Administration (MOSC)

MOSC Banner

monitoring alert log

edited Dec 16, 2009 2:20AM in Database Administration (MOSC) 9 commentsAnswered
 I need a script that runs as cron job every hour and notify me by email if there are any errors in the alert log from current day. If there are no errors, the email will be blank.

The scripts I have right now:

#!/bin/ksh
cd /dsk01/oradata/rtest/bdump
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

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center