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:
- – 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