This was posted by David Hill on 21/3/3. Hope it helps John
Here a fast little script I wrote that can be ran every minute Emails only when it finds a new message And pages if it finds a new message between 6pm and 5am FPATH=/prod/dba/scr autoload f_xmail logfile=/prod/dba/logs/`cat /prod/dba/sys_data/newpath`/misc_logs/chk_alerts.log echo "$(date +%y-%m-%d_%H:%M) -------- BOK ----------------- $$" >> $logfile for i in DB1 DB2; do typeset -l sub=$(echo $i |cut -c1) alert_log="/prod/dump/$sub/alert_$i.log" if [ -f $alert_log ]; then #if you don't find an alert log its ok just exit line_file="/prod/dump/$sub/ora_line" if [ ! -f $line_file ]; then echo 0 > $line_file fi last_line=$(cat $line_file) new_line=$(cat $alert_log |wc -l) if [ $new_line -lt $last_line ]; then #then the alter log must have been deleted and recreated last_line=0 fi if [ $(tail +$((last_line + 1)) $alert_log |grep ORA- |wc -l) -gt 0 ]; then echo "$(date +%y-%m-%d_%H:%M) NEW ORA Messages Found" >> $logfile (echo "From: chk_alerts.ksh" echo "Subject: ORA messages found for $i \n" cat $alert_log ) |mail [EMAIL PROTECTED] #mail the entire log when new messages are found if [[ $(date +%H%M) -lt 0600 || $(date +%H%M) -gt 1800 || $(date +%u) -gt 5 ]]; then #nobody is around page also echo "$(date +%y-%m-%d_%H:%M) Nobody is at work so paging also" >> $logfile f_xmail pager ORA messages found for $i fi fi echo $new_line > $line_file else echo "$(date +%y-%m-%d_%H:%M) NO alert_log found to scan" >> $logfile fi done -----Original Message----- Sent: 07 July 2003 10:39 To: Multiple recipients of list ORACLE-L Guys, I need a parse alert log and mail me if there is any error. Hope u guys would have some script for the same. i have 8i and 9i instances spread across windows 2000 network. even if u guys have script for unix,just pass it on to me. let me modify and try it. Thanks and Regards, Jp. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Prem Khanna J INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Hallas, John, Tech Dev INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).