Wednesday, June 26, 2013

Tracing a session via a logon trigger

Awhile back I found a tip which has come in handy quite a few times. Just recently I was troubleshooting an ORA-03124 error which occurred during a run of a BI tool. The BI tool spawns many sessions while gathering and processing data so Its not practical to sit there, grab the sessions information and turn on tracing manually.

CREATE OR REPLACE TRIGGER ON_LOGON_QC
AFTER LOGON ON DATABASE
WHEN ( USER = 'QC' )
BEGIN
execute immediate 'alter session set events ''10046 trace name context forever, level 12''';
EXCEPTION
WHEN OTHERS THEN
NULL;
END;

Of course, don't forget to disable it after!

No comments:

Post a Comment