oradebug setmypid
--跟踪当前会话
oradebug setospid --跟踪系统进程
oradebug setorapid --跟踪ORACLE进程
oradebug unlimit --取消trace文件大小限制
oradebug tracefile_name --查看trace文
oradebug session_event 10046 trace name context forever ,level 4 --启用会话级10046
oradebug event 10046 trace name context off --关闭10046事
oradebug event 10046 trace name context forever ,level 4
oradebug event 10046 trace name context off
alter session set events '10046 trace name context forever,level 12';
--操作
alter session set events '10046 trace name context off';
--10g
select d.value || '/' || lower(rtrim(i.instance, chr(0))) || '_ora_' ||
p.spid || '.trc' trace_file_name
from (select p.spid
from sys.v$mystat m, sys.v$session s, sys.v$process p
where m.statistic# = 1
and s.sid = m.sid
and p.addr = s.paddr) p,
(select t.instance
from sys.v$thread t, sys.v$parameter v
where v.name = 'thread'
and (v.value = 0 or t.thread# = to_number(v.value))) i,
(select value from sys.v$parameter where name = 'user_dump_dest') d
--11g
select value from v$diag_info where name='Default Trace File';
--转自