跟踪会话session或诊断事件10046

alter session set sql_trace=true;
alter session set sql_trace=false;
SELECT spid
FROM v$process a, v$session b
WHERE a.addr = b.paddr AND
b.sid = sys_context('userenv', 'sid');--可以知道udump目录下的跟踪文件名。


或者以SYSDBA运行:
exec dbms_system.set_sql_trace_in_session(sid,serial#,true);
exec dbms_system.set_sql_trace_in_session(sid,serial#,false);

alter session set events '10046 trace name context forever,level 12';
alter session set events '10046 trace name context off';

exec dbms_monitor.session_trace_enable(session_id => 11,serial_num => 123,waits => true,binds => true);

ORACLE诊断事件: http://publish.it168.com/2006/0128/20060128056201.shtml

使用SQL_TRACE进行数据库诊断: http://www.eygle.com/case/Use.sql_trace.to.Diagnose.database.htm

你可能感兴趣的:(oracle,session,trace,10046)