07/14: Oracle > How to turn on SQL Trace
Category: Oracle
Posted by: hajime osako
Talking Tuning: Tracing SQL in Oracle Database 10g
exec dbms_monitor.serv_mod_act_trace_enable(service_name=>'xxxx');
Or
alter system set sql_trace=true;
The default log is in $ORACLE_BASE\instance_name\admin\udump
To analyse:
# trcsess output="*.trc" service="xxxxx"
# cat *.trc > udump.trc
# tkprof udump.trc output.txt sys=no ( explain=cpsuser/cpsuser sort=(execpu))
To disable:
exec dbms_monitor.serv_mod_act_trace_disable(service_name=>'xxxx');
You can confirm the dest_dump location:
SQL# show parameter dump_dest
exec dbms_monitor.serv_mod_act_trace_enable(service_name=>'xxxx');
Or
alter system set sql_trace=true;
The default log is in $ORACLE_BASE\instance_name\admin\udump
To analyse:
# trcsess output="*.trc" service="xxxxx"
# cat *.trc > udump.trc
# tkprof udump.trc output.txt sys=no ( explain=cpsuser/cpsuser sort=(execpu))
To disable:
exec dbms_monitor.serv_mod_act_trace_disable(service_name=>'xxxx');
You can confirm the dest_dump location:
SQL# show parameter dump_dest