manual record to the Alert.log

Oracle Give us an Option to record our own error in alertlog.log But How can we Do that :

The procedure kdswrt in dbms_system package allows us to write own messages in the alert log / trace files or both.It receives two parameters:

  1. –   A number that indicates where do we want to write our message:

  •      Writing to a TRACE file.
  •      Writing to the Alert.log file.
  •      Writing to both of them.

       2.   A text string (the message itself).

How to Use it  :

exec dbms_system.ksdwrt(2, ‘ORA-10200: Error in Database.);

 Sun Sep 29 10:00:57 2010
Thread 1 advanced to log sequence 7615 (LGWR switch)
Current log# 1 seq# 7615 mem# 0: u01/app/oracle/product/11.2.0/dbhome_1/REDO01.LOG
Sun Sep 29 11:10:15 2010
ORA-10200: Error in Database.
Sun Sep 29 11:10:15 2010
Thread 1 advanced to log sequence 7616 (LGWR switch)
Current log# 2 seq# 7616 mem# 0: u01/app/oracle/product/11.2.0/dbhome_1/REDO02.LOG
Sun Sep 29 10:00:57 2010
Thread 1 advanced to log sequence 7615 (LGWR switch)
Current log# 1 seq# 7615 mem# 0: u01/app/oracle/product/11.2.0/dbhome_1/REDO01.LOG

 It is a very useful feature, as we can use it in our PL/SQL procedures inside the exception handling section or to indicate the procedure’s progression.

As i mention before my blog you can use X$DBGALERTEXT to check alert log via sqlplus (11g).

Thank you
Osama Mustafa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.