Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles



 Oracle Training
 Oracle News

 Oracle Forum
 Class Catalog


 Our Staff
 Our Prices
 Help Wanted!

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 UNIX
 Oracle UNIX
 Linux
 Oracle Linux
 Monitoring
 Remote help

 Remote plans
 Remote
services
 Oracle C++
 Oracle Java
 Apache
 JDeveloper
 App Server

 Applications
 Oracle Forms
 Oracle Portal
 11i Upgrades
 SQL Server
 Oracle Concepts
 HTML-DB Tips
 Software Help

 Remote Help  
 Development  

 Implementation


 Financials Training
 Oracle 11i
 Oracle Apps 11i
 Oracle Workflow
 Oracle AR 11i Class
 Oracle AP 11i class
 Oracle GL 11i class
 Oracle HR 11i class
 Oracle FA 11i class
 11i Project Mgt
 11i procurement
 11i collections


 Oracle Posters
 Oracle Books

 Oracle Tuning Book
 Oracle RAC Book
 Oracle Security
 Easy Oracle Books
 Oracle Scripts
 SQL Server DBA
 SQL Design Patterns
 WISE
 Excel-DB   


 BC Oracle News


 Rednecks!
 Dress code
 Arabian Stallion

 Burleson Arabians
 Guide Horses
 Don Burleson Blog
 Golf & Travel


 Privacy Policy
 

 

 

 
 

Oracle Windows alert log script

Oracle Tips by Burleson Consulting

You can easily monitor the Oracle alert log for error messages and send those messages to the DBA via e-mail.   The Oracle Windows bat file below reads the alert log using the following logic flow:

  • Read the alert log extracting all of the Oracle error messages into an alert_log_err.txt file
     

  • Compare the alert_log_err.txt file to a file containing previously extracted errors (alert_log_old.txt)
     

  • Send any differences (new errors) to the DBA via e-mail

 

@ECHO OFF
REM +---------------------------------
REM |  ALERT_LOG.BAT
REM +-------------------------------------
REM | Set up client specific variables
REM +-------------------------------------
 
set BC_DIR=C:\BC
set FROM=Oracle@Client.com
set TO=Client@remote-dba.net
set SUBJECT=Client Alert Log
 
set ORACLE_SID=MYDB
set ORACLE_BASE=C:\ORACLE
set ORACLE_HOME=C:\ORACLE\ORA102
 
REM +-------------------------------------------------------------
REM | Now let's go get all the errors from the Alert Log
REM +-------------------------------------------------------------
 
egrep -h -e ORA- -e Errors %ORACLE_BASE%\admin\%ORACLE_SID%\bdump\ALERT_%ORACLE_SID%.LOG > alert_log_err.txt
 
REM +-------------------------------------------------------------
REM | If we don't have an old file to compare with, then
REM | create the old file
REM +-------------------------------------------------------------
 
if exist %BC_DIR%\Report\alert_log_old.txt goto COMPARE
touch %BC_DIR%\Report\alert_log_old.txt
 
:COMPARE
REM +-------------------------------------------------------------
REM | Compare the errors that we got this time with errors we
REM | got last time, keeping only new errors.
REM +-------------------------------------------------------------
 
comm -23 alert_log_err.txt %BC_DIR%\Report\alert_log_old.txt > To_e-Mail.txt
 
:MOVE
REM +-------------------------------------------------------------
REM | Save all the current errors for next time.
REM +-------------------------------------------------------------
 
mv alert_log_err.txt %BC_DIR%\Report\alert_log_old.txt
 
REM +-------------------------------------------------------------
REM | If new errors then e-mail them else exit
REM +-------------------------------------------------------------
 
getlines 1 1 To_e-mail.txt > del.it
if errorlevel 1 goto END
 
REM +-------------------------------------------------------------
REM | Mail the Alert Log to the DBA staff
REM +-------------------------------------------------------------
 
banner Alert Log > message.txt
echo. >> message.txt
udate >> message.txt
echo. >> message.txt
cat message.txt To_e-mail.txt >> xxx.txt
 
sendmail -messagefile=xxx.txt -from=%FROM% -subject="%SUBJECT%" %TO%
 
:END
rm -s del.it
rm -s message.txt
rm -s To_e-mail.txt
rm -s xxx.txt
 
exit

This blog also has an interesting technique for numbering and extracting Windows alert log messages:

in order to assign line numbers to each line in the Oracle alert log you need only issue the following command. And then redirect the output to another file for future searching.

DOS> TYPE alert_db10.log | FIND /N /V "" > numbered_alert_db10.log

AND here is a snippet of what you will get:

[214]Stopping background process MMON

 . . .

Now onto the command to strip these out and create a list. Here is the command:

FINDSTR /G:alertstrings numbered_alert_db10.log | FIND /N /V "" > numbered_alert_errors

AND here is what it produces:

[1][116]ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
 . . .

so now say we are looking for the 6th error in our alert log. Just issue the following command:

FINDSTR /B /C:[6] numbered_alert_errors

AND here is what you get:

[6][235]ORA-00312: online log 2 thread 1: '/oradata/db10/redo02.log'

Also, see these additional resources for Oracle Windows scripts:

If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


    Need an Oracle Health Check?
  • Do you have bad performance after an upgrade?
     
  • Need to certify that your database follows best practices?

BC Oracle performance gurus can quickly certify every aspect of your Oracle database and provide a complete verification that your database is fully optimized.

 

 

 

 
 
 

Oracle performance tuning book

 

 

Oracle performance tuning software

 
Oracle performance tuning software
 
SearchOracle web site
 
Oracle performance Tuning 10g reference poster
 
Oracle performance tuning webcast
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.
 
 


Burleson Consulting

The Oracle of database support


 

Copyright © 1996 -  2007 by Burleson Enterprises, Inc. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.


Hit Counter