dbms_system.ksdwrt Procedure to Write Custom Messages to Oracle Alert and Trace Files Manually

For some reasons Oracle DBAs needs to write custom messages to the alert log for better commenting or readability. This can be achieved by dbms_system.ksdwrt package.

Here is the syntax:


execute sys.dbms_system.ksdwrt(<argument>,to_char(sysdate)|| ' -- ');
where the argument values can be
  • 1 to write to trace file
  • 2 to write to alert log file
  • 3 to write both trace and alert logfile.

Example:
SQL> exec dbms_system.ksdwrt(2,'Database bounced for increasing the value of distributed_lock_timeout');

PL/SQL procedure successfully completed.

$ tail alert_prod9.log
Mon Aug 08 03:32:23 2011
Incremental checkpoint up to RBA [0x4a.107ae1.0], current log tail at RBA [0x4a.1084ae.0]
Mon Aug 08 04:02:29 2011
Incremental checkpoint up to RBA [0x4a.109252.0], current log tail at RBA [0x4a.109d5e.0]
Mon Aug 08 04:06:39 2011
Database bounced for increasing the value of distributed_lock_timeout
DBA Tips Data Pump Reference

0 comments:

Post a Comment

 

dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google