Check your Alert Log Frequently Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Check your Alert Log Frequently

  1. #1
    Join Date
    Mar 2001
    I am in the progress to write a shell script to check my alert log for an Oracle database 816 on Solaris. The script will be placed on cron job and check the Oracle alert log every 5 minutes. If any new ORA- error comes up, it will send me an email. Does anybody have any tips or techniques for this? Thank you!

    Righ now, I am thinking something like:

    cat alert_dbprod.log|grep ORA

    Questions are:

    How do I avoid scaning the log from the very first line everytime? The alert log is purged and "refreshed" every quarter.

    What are the searching patterns that I need to use? Only "ORA-"? Are there any other patterns I need to catch and send emails for DBAs to look?

  2. #2
    Join Date
    Apr 2000


    Here is the script I use:

    C_DATE=`date +"%a %b %e "`

    ## Xtract current date records from alert file & scan it for ORA-errors.

    sed -n "/^$C_DATE/,$ p" /P0/app/oracle/admin/mast/bdump/alert_mast.log > temp$$

    sed -n '/^ORA-/ p' temp$$ > ora_errors

    # Variable LN_CNT initialized to the no. of lines in the ora_errors file.

    LN_CNT=`wc -l < ora_errors`

    # If ora_errors file has lines in it, then mail is sent to the DBA.
    if [[ $LN_CNT -ge 1 ]]
    cat ora_errors | mailx -s "Please Check the ALERT_MAST.LOG on $host for Er
    rors" $DBA

    rm temp$$
    rm ora_errors

  3. #3
    Join Date
    Nov 2000
    As part of my cron job, I save a copy of the current alert.log file to alert.log.last. I can then diff the two files to get only the changes since the last time the cron job was fired.
    Jeff Hunter
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  4. #4
    Join Date
    Mar 2001
    Thank you for mhaller and Jeff!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width