Oracle provides a special "hanganalyze"
option within oradebug and "alter session set
events" syntax to locate details about a hung
session. According to Oracle documentation,
hanganalyze uses kernel calls to identify blocking
and waiting sessions and hanganalyze may perform
automatic processstate and errorstacks
trace
details.
You can invoke the hanganalyze with an alter
session command as follows:
ALTER SESSION
SET EVENTS 'immediate trace name hanganalyze level
3';
You can also gather a hanganalyze trace file to
identify hung sessions with SQL*Plus when connected
as SYSDBA:
- SQL>
oradebug hanganalyze 3
- Wait at
least 2 minutes to give time to identify process
state changes.
- SQL>
oradebug hanganalyze 3
- Open a
separate SQL session and immediately generate a
system state dump.
- SQL> alter
session set events 'immediate trace name
SYSTEMSTATE level 10';
You can also gat a trace dump to identify hung
session details in Oracle Real Application Clusters
(RAC) as follows:
- SQL>
oradebug setmypid
- SQL>
oradebug setinst all
- SQL>
oradebug -g def hanganalyze 3
- ... Wait
at least 2 minutes to give time to identify
process state changes.
- SQL>
oradebug -g def hanganalyze 3
Cautions:
- Oracle notes
that HANGANALYZE run at levels higher that 3 may
generate a huge number of trace files for large
systems. Do not use levels higher than 3 without
discussing their effects with Oracle Technical
Support.
- Oracle bug
1427041 for 8.1.6.2 notes that on HP/UX, the
PMON process may crash the instance when the
hanganalyzer syntax is invoked.
Once gathered, the trace file can be read
manually or you can use a third party tool to assist
in interpreting the resulting hanganalyze trace
file. The ubtools web site offers a product
called
iOraHangAnalyzer that claims to read the
hanganalyze trace file and display details about the
waiting session: "iOraHangAnalyzer is a web
based tool which scans Oracle's HANGANALYZE trace
file, and returns waiting sessions with their
wait-life-cycles."
References:
MOSC Note:175006.1 - Steps to generate
HANGANALYZE trace files
MOSC Note:215858.1 - Interpreting HANGANALYZE
trace files to diagnose hanging and performance
problems
|