日期:2014-05-16  浏览次数:20400 次

oracle 10046 跟踪

---------------------------------------------10046---------------------------------------------------

--如果要准确的性能指标,需要先清理shared_poolbuffer_cache

alter system flush shared_pool;

alter system flush buffer_cache;

--开启session10046 event trace

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

--执行你的SQL

<sql_text>

--关闭session10046 event trace

alter session set events '10046 trace name context off';

--获取trace文件的路径

select d.value || '/' || lower(rtrim(i.instance, chr(0))) || '_ora_' ||p.spid|| '.trc' trace_file_name

???????? from (select p.spid

????????????? from v$mystat m, v$session s, v$process p

???????????? where m.statistic# = 1