Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

Generating Oracle hanganalyze trace files

Generating Oracle hanganalyze trace files

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

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.

References:

My Oracle Support Note:175006.1 – Steps to generate HANGANALYZE trace files

My Oracle Support Note:215858.1 – Interpreting HANGANALYZE trace files to diagnose hanging and performance problems

July 7, 2009 Posted by | oracle | Leave a comment