Tuesday, March 8, 2011

Check errors on Alert log based on Date.



This script is for the DBA whose alertlog is huge , may be a year old history in it.This script will report the errors that occurred yesterday.

Script :


Today=`date +"%a %b %d"`
Yesterday=`date +"%a %b %d" -d "YESTERDAY"`
sed -ne "/$Yesterday /,/$Today/p" alert_envrtl.log >alert_temp
cat alert_temp|egrep -i "ORA-|SP2-"
rm alert_temp

Also you can add other errors that you like to grep apart from ORA- & SP2-

Note : The alert log should not be older than one year.


No comments:

Post a Comment