01 March 2011

Oracle Database System Triggers


System event list that could to be triggered:
AFTER STARTUP
BEFORE SHUTDOWN
AFTER LOGON
BEFORE LOGOFF
AFTER DB_ROLE_CHANGE -- for Data Guard failover and switchover
AFTER SUSPEND
AFTER SERVERERROR

AFTER SERVERERROR triggers fire after an Oracle error is raised, unless the error is one of
the following:
ORA-00600
Oracle internal error
ORA-01034
Oracle not available
ORA-01403
No data found
ORA-01422
Exact fetch returns more than requested number of rows
ORA-01423
Error encountered while checking for extra rows in an exact fetch
ORA-04030
Out-of-process memory when trying to allocate N bytes
In addition, the AFTER SERVERERROR trigger will not fire when an exception is raised
inside this trigger (to avoid an infinite recursive execution of the trigger).


Example:
CREATE OR REPLACE TRIGGER error_echo
AFTER SERVERERROR
ON SCHEMA
BEGIN
DBMS_OUTPUT.PUT_LINE ('You experienced an error');

END;

No comments:

Post a Comment