Oracle常用的轉儲方法總結

bitifi發表於2015-09-22

使用events id

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


使用events name

 alter session set events 'err_num trace name errorstack level 10';
 alter session set events 'err_num trace name errorstack off'
 err_num=報錯程式碼,如ORA-00942 應該在err_num填入942


使用dbms_support(trace別的session):
 exec dbms_support.start_trace_in_session(sid=>XX,seiral#=>XXX,wait=>true,binds=>true);
 exec dbms_support.stop_trace_in_session(sid=>XX,seiral#=>XXX);


使用oradebug(trace別的session):
 oradebug setospid (PID 能從ps -ef 中得出)
 oradebug unlimit
 oradebug event 10046 trace name context forever,level 12;
 oradebug event 10046 trace name context off;


使用dbms_system.set_ev:
 exec dbms_system.set_ev(sid,serial#,10046,trace_level,'username');
 exec dbms_system.set_ev(sid,serial#,10046,0,'username');


獲得dump檔案
select value
 ||'/'
 ||(select value from v$parameter where name='db_unique_name')
 ||'_ora_'
 ||(select spid
      from v$process
    where addr=(select paddr from v$session
   where sid=(select sid from v$mystat where rownum=1)))
 ||'.trc' dump_file_name
from v$parameter where name='user_dump_dest';


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30496894/viewspace-1806089/,如需轉載,請註明出處,否則將追究法律責任。

相關文章