Oracle Tuning Tips

Find session info

select username, status, sid, serial#  
from v$session
where username ='USER_NAME

Enable tracing for other session

EXEC DBMS_MONITOR.session_trace_enable(session_id =>1234, serial_num=>1234, waits=>TRUE, binds=>FALSE);
or
EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>12, nm=>' ');

  • Level 0 - No trace. Just like switching sql_trace off.
  • Level 2 - The equivalent of regular sql_trace.
  • Level 4 - The same as level 2, but with the addition of bind variable -
    values.
  • Level 8 - The same as level 2, but with the addition of wait events.
  • Level 12 - The same as level 2, but with the addition of both bind variable values and wait events.
    or
    exec dbms_system.set_sql_trace_in_session(3,5023,true);

Find dump file

Trace file named with spid under user_dump_dest location
-- To find SPID

select p.PID,p.SPID,s.SID 
from v$process p,v$session s
where s.paddr = p.addr
and s.sid = '&SESSION_ID'

/

eg: instancename_ora_spid.trc i.e orcl_ora_4393.trc

show parameter user_dump_dest
cd user_dump_dest location
ls -ltr *ora_spid*.trc
eg: ls -ltr ora_4393.trc

Show dump log file

tkprof one_big.trc output=one_big.txt sys=no
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容