shell script not getting current error messages with time from alert.log

Hi All,

I need to get current error messages with time from alert.log.Below is my shell script but it's not working to meet this objective.

could anyone pls share on the above issue for resolution:

####################################################################
## ckalertlog.sh ##
####################################################################
#! /usr/bin/ksh

export DBALIST="xyz@rediffmail.com"
export ORACLE_HOME=some value
export SID=ORCL

cd $ORACLE_HOME/admin/bdump
if [ -f alert_${SID}.log ]
then
cp alert_${SID}.log alert_work.log
cat alert_work.log >> alert_${SID}.hist
grep ORA- alert_work.log | tail -100 > alert.err
fi
if [ `cat alert.err|wc -l` -gt 0 ]
then
echo "`date`" | mailx -s "${SID} ORACLE ALERT ERRORS as on `date`" $DBALIST < alert.err
fi
rm -f alert.err
rm -f alert_work.log
rm alert_ORCL.hist

Thanks for your time!!

Regards,

What is the script doing that is wrong? Other than not remembering where it left off looking in the log file?

Hi,

I need the output with the latest timestamp and ORA- messages as below:

Mon Oct 6 11:05:17 2008
Errors in file /apps/SID/oracle/10.2.0/admin/SID_Hostname/bdump/SID_arc0_1454262.trc:
ORA-16014: log 3 sequence# 1 not archived, no available destinations

Thanks,