Search notes:
oradebug hanganalyze
MOS Note 215858.1 says that hanganalyze users internal kernel calls to determine if a session is waiting for a resource and reports the relationships between waiters and blockers.
Apparently, it only dumps «interesting» processes.
$ sqlplus / as sysdba
…
oradebug setmypid
oradebug unlimit
oradebug hanganalyze
… [ wait a minute or so, see MOS Note 4523581.1 ]
oradebug hanganalyze
oradebug tracefile_name
…
exit
10g and above (MOS Note 4523581.1)
oradebug setmypid
oradebug unlimit
oradebug -g all hanganalyze 3
oradebug -g all hanganalyze 3
oradebug -g all dump systemstate 258
oradebug -g all dump systemstate 258
Hanganalyze levels
1-2 Hanganalyze output only without process dump
3 In 11g onwards, level 3 also collects a short stack for relevant processes (i. e. processes thought to be) in hang chain (IN_HANG state)
4 Collects everything from level 3 and dumps leaf nodes (blockers) in wait chains
5 Collects everything from level 4 and dumps all processes involved in wait chains (NLEAF state)
10 Dumps all processes (IGN state)
Level 5 and 10 are generate huge amounts of data but are otherwise usually useless.
See also
A hanganalyze can alternatively also triggered with
alter session set events 'immediate trace name hanganalyze level <level>';
A cluster wide hanganalyze can be initiated with
oradebug setmypid
oradebug setinst all
oradebug -g def hanganalyze <level>