Home > Oracle > Tracing a users session quickly

Tracing a users session quickly

If you need to trace a users session as soon as the user logs on you can create a database “on_logon” trigger


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

The trigger can contain various other conditions

Dont forget to disable or drop the trigger once it is no longer required

ALTER TRIGGER ON_LOGON_SCOTT DISABLE;

DROP TRIGGER ON_LOGON_SCOTT;

Advertisements
Categories: Oracle
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: