Tuesday

TIP: 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.

From Oracle Magazine Tip for Week of June 26, 2006:
CREATE OR REPLACE TRIGGER ON_LOGON_SCOTT
AFTER LOGON ON DATABASE
WHEN ( USER = 'SCOTT' )
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!

2 comments:

Andrew Reid said...

I do the same thing but with a slightly different way of determining the user name.

Unknown said...
This comment has been removed by the author.