Tuesday, January 29, 2013

How to Trace SQL in the Current Session

Trace SQL in the current session:

alter session set timed_statistics=true;
alter session set max_dump_file_size=unlimited;
alter session set tracefile_identifier='20Jul2012_special_trace_1';​
alter session set events '10046 TRACE NAME CONTEXT FOREVER,level 12';

..Run some things..

select 'close cursor' from dual; --to dump the rowsource information
alter session set events '10046 trace name context off';


Trace file will be in diag/admin/db_name/instance_name/trace


No comments:

Post a Comment