Enable SQL Trace on Logon

This is an easy way to trace all sql executing by a session from started a connection to the database. You can put more logical and filters such as by user, by time window and so on. It is especially useful when you have to  trace connections that begin to execute code immediately after opening the connection.

CREATE OR REPLACE TRIGGER SYSTEM.trace_login_trigger
AFTER LOGON
ON DATABASE
BEGIN
  DBMS_SESSION.session_trace_enable (waits  => TRUE,binds  => FALSE);
END;
Please, remeber it is a trigger created in system schema, be careful in production enviroments.
HTH – Antonio NAVARRO
Advertisements

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