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

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Oracle alert log in stored procedure

Oracle Tips by Burleson Consulting
Don Burleson

Note:  Scanning the alert log is not trivial and it can take weeks to write a comprehensive set of intelligent scripts to scan the alert logs for important massages.  If you don't want to write your own custom scripts, see my Oracle script download.

You can read and write to the Oracle alert log from inside an Oracle stored procedure:

1 - Locate the background dump directory (the location of the alert log).
2 - Set the utl_file_dir initialization parameter.
3 - Execute utl_file.fopen to open the file for write access.
4 - Use dbms_output.put_line to write the custom message to the alert log.
5 - Execute utl_file.fclose to close the file

-- ******************************************************
-- Gather the location of the alert log directory
-- ******************************************************

name into :alert_loc
name = ?background_dump_destination?;

-- ******************************************************
-- Set the utl_file_dir
-- (prior to Oracle9i, you must bounce the database)
-- ******************************************************
alter system set utl_file_dir = ?:alert_log?);

-- ******************************************************
-- Open the alert log file for write access
-- ******************************************************

-- ******************************************************
-- Write the custom message to the alert log file
-- ******************************************************

-- ******************************************************
-- Close the alert log file
-- ******************************************************

There are several other ways to scan the alert log:

  • Ion for Oracle - The Ion tool has complete mechanisms for setting custom alert log extracts.

  • In 11g and beyond, you can directly query the alert log with SQL, using x$dbgalertext.

  • SQL against the alert log - You can define the alert log file as an external table and detect important messages with SQL and e-mail them to a central repository.

  • Scripts - You can write Oracle shell scripts OS shell scripts to detect alert log messages. 



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

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

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.