Pages

Monday, June 23, 2014

Simulating ORA-errors or How to write custom message to Oracle alert log file

To test monitoring script or monitoring tool: Simulating ORA-errors


Writes to alert log:


SQL> exec dbms_system.ksdwrt(2, 'ORA-600: TEST :Check alert log');

PL/SQL procedure successfully completed.

Writes to trace file:


SQL> exec dbms_system.ksdwrt(1, 'ORA-600: TEST :Check udump');

PL/SQL procedure successfully completed.

Writes to alert log and trace file:


SQL> exec dbms_system.ksdwrt(3, 'ORA-600: TEST :Check alert log and udump');

PL/SQL procedure successfully completed.


Your alert log should look something like this:


Mon May 23 10:36:03 2014
ORA-600: TEST :Check alert log
Mon May 23 10:36:13 2014
ORA-600: TEST :Check alert log and udump

Your trace file should look something like this:

*** 2014-05-23 10:21:11.096
*** SERVICE NAME:(SYS$USERS) 2014-05-23 10:21:11.080
*** SESSION ID:(317.26206) 2014-05-23 10:21:11.080
*** 2014-05-23 10:35:53.782
ORA-600: TEST :Check udump
*** 2014-05-23 10:36:13.704
ORA-600: TEST :Check alert log and udump