对会话进行trace
比如我想要跟踪一个session,首先要获取session的sid, serial#, spid
SELECT a.username,
a.sid ,
a.serial#,
b.spid
FROM v$session a,
v$process b
WHERE a.paddr=b.addr
and a.sid = 285
;
USERNAME SID SERIAL# SPID
------------------------------ ---------- ---------- ------------------------
APPS 285 44645 30468
然后使用oradebug在目标会话上设置事件,进行trace,并获得trace文件的名称
SQL> oradebug setospid 30468 --进程的spid
SQL> oradebug event 10046 trace name context forever,level 12
SQL> oradebug event 10046 trace name context off
SQL> oradebug TRACEFILE_NAME
/u01/VIS02/db/tech_st/11.1.0/admin/VIS02_vs011/diag/rdbms/vis02/VIS02/trace/VIS02_ora_30468.trc