Monday, 16 April 2012

How to generare oracle error for testing purpose

A common DBA job is the setup and maintenance of database monitoring. Sometimes you may need to generate a real alert from database in order to make your tests.

Oracle provides a package called dbms_system with the function ksdwrt that permit you to write arbitraty text strings inside the alert log. A simple example:

 
exec dbms_system.ksdwrt(2,'ORA-07445: this is a fake issue for testing purpose');


In oracle 11g, due to the complete incident management, you can also force the database to generate an incident in another way:


ALTER SESSION SET EVENTS '1418 INCIDENT(TEST)'; DROP INDEX THISINDEXDOESNOTEXISTS; ALTER SESSION SET EVENTS '1418 TRACE NAME CONTEXT OFF';


Remember that if you use the enterprise manager the simple write of an event to the alert log is not enough to trigger an alarm.
Enhanced by Zemanta

No comments:

Post a Comment