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

               and s.sid = m.sid

               and p.addr = s.paddr) p,

           (select t.instance

              from v$thread t, v$parameter v

            where v.name = 'thread'

              and (v.value = 0 or t.thread# = to_number(v.value))) i,

          (select value from v$parameter where name = 'user_dump_dest') d;

你可能感兴趣的:(oracle)