利用oradebug获取跟踪的trace文件的名字和路径:
SQL> conn sys/sys as sysdba
Connected.
SQL> alter session set events '10046 trace name context forever, level 12';
Session altered.
SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/v1120/v1120/trace/v1120_ora_26077.trc
也可以用一下查询获取跟踪文件:
用以下查询查询当前会话的跟踪文件
select s.sql_trace,s.sql_trace_waits,s.sql_trace_binds,traceid,tracefile
from v$session s join v$process p on (p.addr=s.paddr)
where audsid=userenv('sessionid')
如果要查询其他会话知道会话的sid和serial#就可以用上面的查询,写一个sql
select s.sql_trace,s.sql_trace_waits,s.sql_trace_binds,traceid,tracefile
from v$session s join v$process p on (p.addr=s.paddr)
where s.sid=&sid and s.serial#=&serial;