ORACLE TRACE

SQL> alter session set SQL_TRACE=true;

Session altered

SQL> select count(*) from dba_users;

  COUNT(*)
----------
        37

SQL> alter session set SQL_TRACE=false;

Session altered


SQL> SELECT d.value||'/'||lower(rtrim(i.instance, chr(0)))||'_ora_'||p.spid||'.trc' as 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 to_char(t.thread#) = v.value)) i,
  ( select value from v$parameter where name = 'user_dump_dest') d
  ;

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/app/app/oracle/product/10.2.0/db_1/admin/mdb/udump/mdb_ora_30077.trc

SQL> exit;
tkprof /app/app/oracle/product/10.2.0/db_1/admin/mdb/udump/mdb_ora_30077.trc      /app/trace1.out      sys=yes

你可能感兴趣的:(thread,oracle,sql)