OracleSQLTrace几种不同方法示例
发布时间:2015-06-05 来源:查字典编辑
摘要:示例相关:SQLtname.sqlselectvaluefromv$diag_infowherename='DefaultTraceFile...
示例相关:SQL
tname.sql
select value from v$diag_info
where name = 'Default Trace File';
sinfo.sql
select sid,serial# from v$session where sid=&sid;
spinfo.sql
select s.sid,s.serial# from v$process p,v$session s
where p.addr=s.paddr and p.spid=&pid;
sid.sql
select sid from v$mystat where rownum<2 ;
已知session ID 对其进行跟踪 dbms_monitor用法:
execute dbms_monitor.session_trace_enable(session_id=>&sid, serial_num=>&serial,
waits=>true,binds=>false);
关闭:
execute dbms_monitor.session_trace_disable(session_id=>&sid,serial_num=>&serial);
DBMS_MONITOR.SESSION_TRACE_ENABLE(
session_id IN BINARY_INTEGER DEFAULT NULL,
serial_num IN BINARY_INTEGER DEFAULT NULL,
waits IN BOOLEAN DEFAULT TRUE,
binds IN BOOLEAN DEFAULT FALSE,
plan_stat IN VARCHAR2 DEFAULT NULL);
示例:
?