how to Create a Database event trigger called as AuditErr that will fire every time a server error occurs. The error refers to any Oracle error. This trigger can serve as a notification mechani开发者_如何学Gosm to an administrator, by populating an error log table, called server_error_log (use the given SQL script). You should create the error lag table before-hand and when an error happens, the error code and details must be written back to this table.
CREATE TABLE server_error_log ( error_code decimal(6), description varchar2(256) );
You'll have to create a database event trigger:
CREATE TRIGGER log_errors AFTER SERVERERROR ON DATABASE BEGIN // log error END;
In this trigger, you can use the attribute functions ora_server_error
and ora_server_error_msg
to retrieve the error stack.
精彩评论