Writing custom messages in alert log

Writing custom messages in alert log … IS IT POSSIBLE???

Yes it is… We can edit, update or delete alert log entries with any editor, but oracle has a package that does the same work: dbms_system.ksdwrt.

We can write our own customized messages in alert.log sitting at SQL*PLUS session using undocumented KSDWRT procedure (part of DBMS_SYSTEM).


sys.dbms_system.ksdwrt(2, '<Message Text>');


The first parameter of sys.dbms_system.ksdwrt indicates the destination:

* Use 1 to write to the trace file.
* Use 2 to write to the “alert.log”.
* Use 3 to write to both.

The second parameter is the message.

This feature can be very useful in testing – Generic Alert Log Error metric in Enterprise Manager or other monitoring tools.

Note from Metalink about DBMS_SYSTEM:


This package should in fact only be installed when requested by Oracle Support. 
It is not documented in the server documentation.
As such the package functionality may change without notice.
It is to be used only as directed by Oracle Support and its use otherwise is not supported.
As per internal Note 153324.1:
Generally, if a package is not in the Oracle documentation at all, it is intentional, as it is not for end user use. Non-documented packages should be avoided by customers unless specifically instructed to use them by either Oracle Support or Oracle Development.


Reference : How To Edit, Read, and Query the Alert.Log (Doc ID 1072547.1)

Hope so u will find this post very useful 🙂