How to Trace Oracle session and Hang Analysis



Using Below Queries find oracle sessions and ospids

column line format a79
set heading off
select 'ospid: ' || p.spid || ' # ''' ||s.sid||','||s.serial#||''' '||
  s.osuser || ' ' ||s.machine ||' '||s.username ||' '||s.program line
from v$session s , v$process p
where p.addr = s.paddr
and s.username <> ' ';



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


>>> For 10046 Trace use below commands 

connect / as sysdba
oradebug setorapid 19 or oradebug setospid 7406002
oradebug unlimit
oradebug tracefile_name
oradebug event 10046 trace name context forever,level 12


oradebug event 10046 trace name context off



>>>>For hang Analysis use below commands

sqlplus '/ as sysdba'
oradebug setorapid 19 or oradebug setospid 7406002
oradebug tracefile_name
oradebug  unlimit
oradebug hanganalyze 3
---- Wait for some time ( 1 Min)
oradebug hanganalyze 3

---------------------------------------------------------

sqlplus '/ as sysdba'
oradebug setorapid 19 or oradebug setospid 7406002
oradebug  unlimit
oradebug tracefile_name
oradebug dump systemstate 258
-- Wait for 1 Min
oradebug dump systemstate 258
exit


Ref: Oracle Support Docs
Doc ID 452358.1, Doc ID 376442.1, Doc ID 1378583.1



No comments:

Post a Comment