Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trace the sql

Status
Not open for further replies.

maswien

Technical User
Sep 24, 2003
1,286
CA


I want trace the queries the application issues on the backend database, I want see those queries saved in a log for me to investigate. How can do that?
 

Code:
ALTER SESSION SET SQL_TRACE=TRUE;

The use tkprof utility to check the trace file.
[3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

I want the trace is turned on not only for the current session but the global. Is that possible?
 

Yes, use ALTER SYSTEM.

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

Another solution is to create a "login" trigger on the schema you wish to audit and enable tracing for each connection to that schema only:
Code:
CREATE TRIGGER AUD_SCHEMA_X AFTER LOGON
  ON SCHEMA MySchema 
  BEGIN
    EXECUTE IMMEDIATE "ALTER SESSION SET SQL_TRACE=TRUE";
    ...etc...
[3eyes]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top