Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

        
 

 Writing to the Oracle Alert Log File
Oracle Tips by Burleson Consulting

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by four of the top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

While not a utility per se, the ability to write messages to the Oracle alert log is an extremely useful ability.  This is being mentioned in this chapter because it is an often needed and useful, but not well documented ability.

 

There are many cases where the Oracle DBA may want to write custom messages directly into the standard Oracle alert log file located in $ORACLE_HOME/admin/$ORACLE_SID/bdump.

 

By writing custom messages to the Oracle alert log file,  the default Oracle alerts can be supplemented with custom messages. Writing to the Oracle alert log is exactly the same as writing to any flat file and there are these choices:

  • OS scripts and languages - Use UNIX/Linux utilities to write OS messages, e.g. RAM swapping alerts, into the alert log.  Of course, all procedural languages (C++) can also write messages to the Oracle alert log.

  • PL/SQL - Use the standard utl_file package or call the dbms_system.ksdwrt procedure to write messages to the Oracle alert log file.

  • SQL (read only) - Define the alert log as an external table and access the alert log messages with SQL statements.

The best method to write to the alert log is to use SYS.DBMS_SYSTEM.KSDWRT.  This very handy utility will write a message to the alert log; it takes two arguments, a number (1 or 2), and the text.  The number indicates whether to write to alert or trace.  If set to 1, it writes to a trace file.  If 2, it writes to the alert log.  Because it uses the dbms_system package, write a wrapper around the call and grant privileges to the wrapper procedure or function. Then an execute will not have to be granted on the dbms_system package.  A possible function to accomplish this purpose is below:

 

create or replace function write_alert_log(log_or_trace in number, text_message in varchar2) return number

is

begin

  SYS.DBMS_SYSTEM.KSDWRT(log_or_trace,text_message);

  return 0;

  exception

  when others then

  return 1;

end;

 

It is also possible to write to the alert log using utl_file, but there are many privilege issues that arise when using this method and many more lines of programming.  The easy method is to use the DBMS_SYSTEM.KSDWRT package.

     

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.