Oracle HANGANALYZE 功能诊断 DB hanging

2024-04-04 03:08

本文主要是介绍Oracle HANGANALYZE 功能诊断 DB hanging,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

       Oracle 数据库可能因为hang住而产生严重的性能问题,而通过HANGANALYZE  功能产生的日志可以帮助我们快速的定位是否是2个或者多个进程死锁了,有多少进程收到影响。 从而帮助我们诊断出数据库的问题。

 

 

.  HANGANALYZE 2种使用方式:

1 The “HANGANALYZE” command is available since Oracle Release 8.1.6. In Oracle9i it was enhanced to provide “cluster wide” information in Real Application Cluster (RAC) environments on a single shot. The meaning of this is that it will generate information for all the sessions in the cluster regardless of the instance that issued the command.

       HANGANALYZE may be executed using the following syntax:

 

       SQL>ALTER SESSION SET EVENTS 'immediate trace name HANGANALYZE level <level>';

-- 该命令对于RAC,会收集所有节点上的信息

 

2logged in with the “SYSDBA” role,then run the following command:

       SQL>ORADEBUG hanganalyze <level>

       --for 单实例

 

       To perform cluster wide HANGANALYZE use the following syntax:

              SQL>ORADEBUG setmypid
              SQL>ORADEBUG setinst all
              SQL>ORADEBUG -g def hanganalyze <level>

       --for RAC 实例

 

The levels are defined as follows:

10

Dump all processes (IGN state)

5     

Level 4 + Dump all processes involved in wait chains (NLEAF state)

Level 3 + Dump leaf nodes (blockers) in wait chains (LEAF,LEAF_NW,IGN_DMP state)

Level 2 + Dump only processes thought to be in a hang (IN_HANG state)

1-2  

Only HANGANALYZE output, no process dump at all

 

       注意:如果Level过大的话会产生大量的跟踪文件并影响系统的I/O性能,Oracle建议不要采用3级以上的跟踪。

 

 

. 示例1

这是我的一个测试的RAC 环境。

SQL> select instance_name from gv$instance;

 

INSTANCE_NAME

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

dave1

dave2

 

SQL> alter session set events 'immediate trace name HANGANALYZE level 3';

Session altered.

 

--获取trace 文件名称和路径,该脚本会放在最后贴出来

SQL> @/u01/getTracePath.sql

 

trace_file_name

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

/u01/app/oracle/admin/rac/udump/dave1_ora_20962.trc

/u01/app/oracle/admin/rac/udump/dave2_ora_20962.trc

 

[oracle@rac1 u01]$ cat getTracePath.sql

SELECT      d.VALUE

         || '/'

         || LOWER (RTRIM (i.INSTANCE, CHR (0)))

         || '_ora_'

         || p.spid

         || '.trc'

        AS "trace_file_name"

  FROM   (SELECT   p.spid  FROM   v$mystat m, v$session s, v$process p

      WHERE   m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,

         (SELECT   t.INSTANCE  FROM   v$thread t, v$parameter v

           WHERE   v.NAME = 'thread'

          AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,

         (SELECT   VALUE FROM   v$parameter

           WHERE   NAME = 'user_dump_dest') d;

 

--注意,如果是在节点1上执行的HANGANALYZE命令,就到节点1上去查询,该trace 文件里包含了所有session的信息。 我是在dave1上执行的,所以这里的没有dave2_ora_20962.trc 文件。

 

 

打开trace 文件看一下:

[oracle@rac1 u01]$ cat /u01/app/oracle/admin/rac/udump/dave1_ora_20962.trc    

/u01/app/oracle/admin/rac/udump/dave1_ora_20962.trc

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1

System name:    Linux

Node name:      rac1

Release:        2.6.18-194.el5

Version:        #1 SMP Tue Mar 16 21:52:43 EDT 2010

Machine:        i686

Instance name: dave1

Redo thread mounted by this instance: 1

Oracle process number: 23

Unix process pid: 20962, image: oracle@rac1 (TNS V1-V3)

 

 

*** SERVICE NAME:(SYS$USERS) 2011-04-13 22:59:43.052

*** SESSION ID:(125.52764) 2011-04-13 22:59:43.052

*** 2011-04-13 22:59:43.052

==============

HANG ANALYSIS:

==============

Open chains found:

Other chains found:

Chain 1 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/125/52764/0x30e1dff4/20962/No Wait>

Chain 2 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/129/26/0x30e23580/4576/Streams AQ: qmn slave idle wait>

Chain 3 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/130/16238/0x30e22fcc/4300/jobq slave wait>

Chain 4 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/134/1/0x30e21eb0/669/Streams AQ: waiting for time man>

Chain 5 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/138/11/0x30e21348/654/Streams AQ: waiting for messages>

Chain 6 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/139/1/0x30e207e0/428/Streams AQ: qmn coordinator idle>

Chain 7 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/169/1/0x30e16de4/32435/DIAG idle wait>

Extra information that will be dumped at higher levels:

[level  5] :   7 node dumps -- [SINGLE_NODE] [SINGLE_NODE_NW] [IGN_DMP]

[level 10] :  23 node dumps -- [IGN]

 

State of nodes

([nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor):

[124]/0/125/52764/0x30ee3870/20962/SINGLE_NODE_NW/1/2//none

[128]/0/129/26/0x30ee8340/4576/SINGLE_NODE/3/4//none

[129]/0/130/16238/0x30ee95f4/4300/SINGLE_NODE/5/6//none

[130]/0/131/2/0x30eea8a8/680/IGN/7/8//none

[131]/0/132/2/0x30eebb5c/663/IGN/9/10//none

[133]/0/134/1/0x30eee0c4/669/SINGLE_NODE/11/12//none

[134]/0/135/27202/0x30eef378/17839/IGN/13/14//none

[137]/0/138/11/0x30ef2b94/654/SINGLE_NODE/15/16//none

[138]/0/139/1/0x30ef3e48/428/SINGLE_NODE/17/18//none

...

[168]/0/169/1/0x30f16f60/32435/SINGLE_NODE/57/58//none

[169]/0/170/1/0x30f18214/32428/IGN/59/60//none

====================

END OF HANG ANALYSIS

====================

[oracle@rac1 u01]$

 

 

.  示例二

 

--For 单实例

SQL> oradebug hanganalyze 3;

Hang Analysis in /u01/app/oracle/admin/rac/udump/dave1_ora_20962.trc

 

这个命令会提示我们生成的trace 文件。

 

--For RAC

SQL> oradebug setmypid

Statement processed.

SQL> oradebug setinst all

Statement processed.

SQL> oradebug -g def hanganalyze 3;

Hang Analysis in /u01/app/oracle/admin/rac/bdump/dave1_diag_32435.trc

 

查看trace 文件:

[oracle@rac1 u01]$ cat /u01/app/oracle/admin/rac/bdump/dave1_diag_32435.trc

/u01/app/oracle/admin/rac/bdump/dave1_diag_32435.trc

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1

System name:    Linux

Node name:      rac1

Release:        2.6.18-194.el5

Version:        #1 SMP Tue Mar 16 21:52:43 EDT 2010

Machine:        i686

Instance name: dave1

Redo thread mounted by this instance: 0 <none>

Oracle process number: 3

Unix process pid: 32435, image: oracle@rac1 (DIAG)

 

*** SERVICE NAME:() 2011-04-03 17:08:32.387

*** SESSION ID:(169.1) 2011-04-03 17:08:32.387

kjzcprt:rcv port created

Node id: 0

List of nodes: 0, 1,

*** 2011-04-03 17:08:32.388

Reconfiguration starts [incarn=0]

*** 2011-04-03 17:08:32.388

I'm the master node

A rcfg proposal from node 1 is received

*** 2011-04-03 17:08:33.439

Reconfiguration completes [incarn=14]

DIAG attached to DLM

cluster reconfiguration is ongoing: 0,

*** 2011-04-03 17:11:51.702

Reconfiguration starts [incarn=15]

*** 2011-04-03 17:11:51.702

I'm the master node

*** 2011-04-03 17:11:51.702

Reconfiguration completes [incarn=15]

Group reconfiguration cleanup

cluster reconfiguration is ongoing: 0, 1,

*** 2011-04-03 17:18:16.440

Reconfiguration starts [incarn=16]

*** 2011-04-03 17:18:16.440

I'm the master node

Group reconfiguration cleanup

A rcfg proposal from node 1 is received

*** 2011-04-03 17:18:17.245

Reconfiguration completes [incarn=16]

*** 2011-04-13 23:29:41.659

DIAG sends out oradebug command to nodes [0,1]

Switch to short timeout for ipc polling

a session (kjzddbx) is registered

********************************************************************

PORADEBUG BEGIN ORIGINATING INST:1 SERIAL:0 PID:20962

PORADATA COMMAND:hanganalyze 3

*** 2011-04-13 23:29:42.066

==============

HANG ANALYSIS: level 3 syslevel 1

==============

session (kjzddbx) switches to a new action

PORADATA TRACEFILE /u01/app/oracle/admin/rac/bdump/dave1_diag_32435.trc

PORADEBUG END ORIGINATING INST:1 SERIAL:0 PID:20962

********************************************************************

Open chains found:

Other chains found:

Chain 1 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/125/52764/0x30e1dff4/20962/rdbms ipc reply>

Chain 2 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/129/26/0x30e23580/4576/Streams AQ: qmn slave idle wait>

Chain 3 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/130/16270/0x30e22fcc/4300/jobq slave wait>

Chain 4 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/134/1/0x30e21eb0/669/Streams AQ: waiting for time man>

Chain 5 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/138/11/0x30e21348/654/Streams AQ: waiting for messages>

Chain 6 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/139/1/0x30e207e0/428/Streams AQ: qmn coordinator idle>

Chain 7 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <0/169/1/0x30e16de4/32435/No Wait>

Chain 8 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <1/130/14283/jobq slave wait>

Chain 9 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <1/133/1/Streams AQ: qmn slave idle wait>

Chain 10 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <1/134/1/Streams AQ: waiting for time man>

Chain 11 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <1/139/1/Streams AQ: qmn coordinator idle>

Chain 12 : <cnode/sid/sess_srno/proc_ptr/ospid/wait_event> :

    <1/169/1/No Wait>

Extra information that will be dumped at higher levels:

[level  5] :  12 node dumps -- [SINGLE_NODE] [SINGLE_NODE_NW] [IGN_DMP]

[level 10] :  47 node dumps -- [IGN]

 

State of nodes

([nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor):

[123]/0/124/42982/0x30ee25bc/24834/IGN/1/2//none

[124]/0/125/52764/0x30ee3870/20962/SINGLE_NODE/3/4//none

[128]/0/129/26/0x30ee8340/4576/SINGLE_NODE/5/6//none

[129]/0/130/16270/0x30ee95f4/4300/SINGLE_NODE/7/8//none

[130]/0/131/2/0x30eea8a8/680/IGN/9/10//none

[131]/0/132/2/0x30eebb5c/663/IGN/11/12//none

[133]/0/134/1/0x30eee0c4/669/SINGLE_NODE/13/14//none

[137]/0/138/11/0x30ef2b94/654/SINGLE_NODE/15/16//none

[138]/0/139/1/0x30ef3e48/428/SINGLE_NODE/17/18//none

...

[168]/0/169/1/0x30f16f60/32435/SINGLE_NODE_NW/57/58//none

[169]/0/170/1/0x30f18214/32428/IGN/59/60//none

[295]/1/126/1125/0x30ee4b24//IGN/61/62//none

[299]/1/130/14283/0x30ee95f4//SINGLE_NODE/63/64//none

[302]/1/133/1/0x30eece10//SINGLE_NODE/65/66//none

[303]/1/134/1/0x30eee0c4//SINGLE_NODE/67/68//none

[305]/1/136/3/0x30ef062c//IGN/69/70//none

[306]/1/137/6/0x30ef18e0//IGN/71/72//none

[308]/1/139/1/0x30ef3e48//SINGLE_NODE/73/74//none

....

[337]/1/168/1/0x30f15cac//IGN/113/114//none

[338]/1/169/1/0x30f16f60//SINGLE_NODE_NW/115/116//none

[339]/1/170/1/0x30f18214//IGN/117/118//none

session (kjzddbx) switches to a new action

*** 2011-04-13 23:29:45.926

====================

END OF HANG ANALYSIS

====================

PORADATA SERIAL:0 RINST:2 RDIAG:8860

PORADATA SERIAL:0 RINST:2 REMOTE EXEC OSPID:8860

PORADATA SERIAL:0 RINST:2 TRACEFILE:/u01/app/oracle/admin/rac/bdump/dave2_diag_8860.trc

PORADATA SERIAL:0 RINST:2  DONE

session (kjzddbx) is about to end

session (kjzddbx) is about to end

Registered session (kjzddbx)[11][4][0][1] is cleaned up

Switch to long timeout for ipc polling

[oracle@rac1 u01]$

 

 

说明:

这个trace 文件中最重要的部分是:

State of nodes

([nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor):

[123]/0/124/42982/0x30ee25bc/24834/IGN/1/2//none

[124]/0/125/52764/0x30ee3870/20962/SINGLE_NODE/3/4//none

[128]/0/129/26/0x30ee8340/4576/SINGLE_NODE/5/6//none

在上面的实例中的解释如下:

 

nodenum:定义每个session的序列号

sidsessionsid

sess_srnosessionSerial

ospidOS的进程ID

statenode的状态

adjlist:表示blocker node

predecessor:表示waiter node

 

State有如下几种状态:

       1IN_HANG如果Session处于这种状态,表示Session遇到deadlock或者处于hung状态。

       2LEAF/LEAF_NW这些Session通常是“blocker”或者是等待某些资源的“slow node,通过字段“predecessor 可以很容易标识出这些node

       3NLEAF这些Session通常被认为是“stuck”会话,意味着这些Session在等待某些Session的资源。通过字段“adjlist”可以很容易的定义该进程的blocker

       4IGN/IGN_DMP这些Session通常是IDLE Session

 

 

 

.  官网的一个说明示例

       因为我的环境没有一个详细的环境,所以在官网找了一个完整点的示例说明。 对照这些说明,看的比较清楚。

 

 

==============
HANG ANALYSIS:
==============


CYCLES: This section reports the process dependencies between sessions that are in a deadlock condition. Cycles are considered   “true” hangs.


Cycle 1 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <980/3887/0xe4214964/24065/latch free>

 -- <2518/352/0xe4216560/24574/latch free>

 -- <55/10/0xe41236a8/13751/latch free>



BLOCKER OF MANY SESSIONS: This section is found when a process is blocking a lot of other sessions. Usually when a process is blocking more that 10 sessions this section will appear in the trace file.


Found 21 objects waiting for <sid/sess_srno/proc_ptr/ospid/wait_event>

    <55/10/0xe41236a8/13751/latch free>

Found 12 objects waiting for <sid/sess_srno/proc_ptr/ospid/wait_event>

    <2098/2280/0xe42870d0/3022/db file scattered read>

Found 12 objects waiting for <sid/sess_srno/proc_ptr/ospid/wait_event>

    <1941/1783/0xe41ac9e0/462/No Wait>

Found 12 objects waiting for <sid/sess_srno/proc_ptr/ospid/wait_event>

    <980/3887/0xe4214964/24065/latch free>



OPEN CHAINS: This section reports sessions involved on a wait chain. A wait chains means that one session is blocking one or more other sessions.


Open chains found:
Chain 1 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <2/1/0xe411b0f4/12280/db file parallel write>

Chain 2 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <3/1/0xe411b410/12282/No Wait>

Chain 6 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <18/1631/0xe4243cf8/25457/db file scattered read>

 -- <229/1568/0xe422b84c/8460/buffer busy waits>

Chain 17 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <56/11/0xe4123ce0/13755/latch free>

 -- <2384/599/0xe41890dc/22488/latch free>

 -- <32/2703/0xe41fa284/25693/latch free>



OTHER CHAINS: It refers to chains of blockers and waiters related to other sessions identified under “open chains”, but not blocked directly by the process reported on the "open chain". 


Other chains found:
Chain 676 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <20/93/0xe411d644/13597/latch free>

Chain 677 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <27/1201/0xe41d3188/15809/latch free>

Chain 678 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <36/1532/0xe428be8c/4232/latch free>

 -- <706/1216/0xe4121aac/23317/latch free>

Chain 679 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <43/12/0xe4122d54/13745/latch free>

Chain 680 : <sid/sess_srno/proc_ptr/ospid/wait_event> :

    <80/2/0xe41290d4/13811/library cache pin>

 -- <1919/1134/0xe421fdbc/3343/enqueue>



Additional DUMP detail: HANGANALYZE generates errorstack dumps for individual processes based on: the LEVEL used when the command is issued, and the STATE of the session. This part of the HANGANALYZE trace indicates which processes will be dumped if higher levels are used. It also indicates how many nodes will be dumped so you can measure the impact to the system (if too many errorstack dumps occur simultaneously, the disks serving the trace destination may become saturated). The “STATE DESCRIPTION” section of this document further explains the meaning of the states.


Extra information that will be dumped at higher levels:
[level  4] :  23 node dumps -- [LEAF] [LEAF_NW] [IGN_DMP]
[level  5] :  36 node dumps -- [NLEAF]
[level 10] : 130 node dumps -- [IGN]



STATE OF NODES: This section might be considered as the main section of the report. It shows all the sessions connected when the HANGANALYZE trace file was generated. This section essentially describes a dependency graph between nodes(known as an “adjacency list”), where each session is considered a node, and each node may have an “adjacent” node or a “predecessor” node related to it. Depending on the state of the node it may be a blocker, a waiter or a hung node. The “STATE DESCRIPTION” section of this document explains further the meaning of the states.


State of nodes

([nodenum]/sid/sess_srno/session/state/start/finish/[adjlist]/predecessor):

[0]/1/1/0xa6f8b0/IGN/1/2//none

[1]/2/1/0xa70230/IGN/3/4//none

[3]/4/1/0xa71530/IGN/5/6//none

[4]/5/1/0xa71eb0/IGN/7/8//none

[5]/6/1/0xa72830/IGN/9/10//none

[6]/7/1/0xa731b0/IGN/11/12//none

[7]/8/1/0xa73b30/IGN/13/14//none

[8]/9/1/0xa744b0/IGN_DMP/15/18/[130]/none

[9]/10/1/0xa74e30/IGN/19/20//none

[10]/11/4202/0xa757b0/IGN/21/22/[130]/none

[11]/12/1196/0xa76130/NLEAF/23/28/[49]/none

[12]/13/1/0xa76ab0/IGN/29/30/[130]/none

[37]/38/37/0xa85830/NLEAF/73/76/[50]/46

[46]/47/15/0xa8adb0/NLEAF/91/92/[37][50]/none

====================

END OF HANG ANALYSIS

====================

 

以上是对TRACE 中的分段信息的说明。 下面是对每个node state的说明:

 

 

STATE OF THE NODES DESCRIPTION

  As described before, HANGANALYZE use the model of “Adjacency Lists” to report the sessions found when the HANGANALYZE command was issued. In Graph Theory, an adjacency list represents a list of nodes that are connected to a given node. For each node, a linked list of nodes connected to it can be set up to represent the neighbor node connected. To be able to interpret a HANGANALYZE trace file it is required to relate the “STATE” of the node with the “adjacent” node to it.
A typical entry in the state of the nodes section will be as follow:

Oracle 8.x : [nodenum]/sid/sess_srno/session/state/start/finish/[adjlist]/predecessor
Oracle9i: [nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor

Where:
 Nodenum     = This is sequential number used by HANGANALYZE to identify each session
 sid         = Session ID
 sess_srno   = Serial#
 ospid        = OS Process Id
 state       = State of the node
 adjlist     = adjacent node   (Usually represents a  blocker node)
 predecessor = predecessor node (Usually represents a waiter node)
 cnode        = Node number (Only available since Oracle9i)

The following describes the important states to be considered:


IN_HANG: This might be considered as the most critical STATE. Basically a node in this state is involved in a deadlock, or is hung. Usually there will be another “adjacent node” in the same status. For example:

 [nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor
 [16]/0/17/154/0x24617be0/26800/IN_HANG/29/32/[185]/19
 [185]/1/16/4966/0x24617270//IN_HANG/30/31/[16]/16

In this example the node [16] is waiting for node [185], and the other way around; this is  a cyclical condition (deadlock).
 

LEAF and LEAF_NW: Leaf nodes are considered on top of the wait chain (usually blockers). They are considered “Blockers” when there is another session waiting. This can be easily identified using the “predecesor” field. If there is a node referenced in the ‘prdecessor’ field, the node is considered as “blocker”, otherwise it is considered as a “slow” session waiting for some resource.
The difference between LEAF and LEAF_NW is that LEAF nodes are not waiting for something, while LEAF_NW are not waiting or may be using the CPU. A typical representation of these nodes when they are considered blockers is:

 [ nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor
 [16]/0/17/154/0x24617be0/26800/LEAF/29/30//19
 [19]/0/20/13/0x24619830/26791/NLEAF/33/34/[16]/186

In this example, node [16] is blocking node [19]. Notice that node [16] has node [19] in the predecessor field.
Also notice that node [19] has node [16] in the adjacent list.
 

NLEAF : These sessions are usually considered as “stuck” sessions. It means that there is another session holding a resource needed by the session in this state. By using the adjlist, you can determine which node is the blocker of this process. When many sessions are found in this state, it is likely the database is experiencing a performance problem rather than a hang problem.

 

IGN and IGN_DMP : Sessions in this state are usually considered as IDLE sessions, unless they reference a node in the “ adjlist” field. In this case, the node is waiting for another node, so it will be considered as a ‘stuck’ session as well.
Extending the previous example,

 [nodenum]/cnode/sid/sess_srno/session/ospid/state/start/finish/[adjlist]/predecessor
 [16]/0/17/154/0x24617be0/26800/LEAF/29/30//19
 [19]/0/20/13/0x24619830/26791/NLEAF/33/34/[16]/186
 [189]/1/20/36/0x24619830//IGN/95/96/[19]/none
 [176]/1/7/1/0x24611d80//IGN/75/76//none

       You may notice that node [189] is waiting for node [19] which in turn is waiting for node [16], while node [176] is an IDLE session . This maybe the case when a session has a DML lock but never finished the transaction. 

In Oracle9i, two new states were introduced to differentiate between LEAF nodes that have other nodes waiting behind them (i.e., LEAF nodes that are blockers) vs. LEAF nodes that are not affecting other nodes.
 

SINGLE_NODE and SINGLE_NODE_NW:
       This can be described the same as LEAF and LEAF_NW, except that they don't have processes depending on them.
 

LEVEL USAGE RECOMMENDATIONS

       It is advisable not to use levels higher than 3 due to the potentially large number of trace files that may be produced (and could overwhelm the I/O subsystem). Since HANGANALYZE will be mostly used to diagnose “true hangs”, a level 3 will dump the processes that are involved in a the hang condition – this usually involves fewer than 4 processes.

-- 不要超过level 3
       Level 4 may be used with caution when dealing with performance scenarios where sessions are being stuck for a long period of time, and no other information can be gathered. Be carefull that a HANGANALYZE level 4 will dump all the processes in the following states:
       [LEAF] [LEAF_NW] [IGN_DMP]. Before doing so, perform a HANGANALYZE level 3, and check the section: “Extra information that will be dumped at higher levels”. This section will tell you exactly how many sessions will be dumped at each level.   It is diffucult to know how many dumps are an acceptable number to keep from saturating the disks due to the differences in disk implementations (5 to 10 is probably OK for most systems; larger systems may be able to handle 20 to 40 dumps).  

 

       Level 5 and 10 are typicaly useless and generate a huge amount of trace files that may severely impact the performance of the database.

 

 

 

 

 

 

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

QQ: 492913789
Email: ahdba@qq.com
Blog: http://www.cndba.cn/dave

DBA1 群:62697716();   DBA2 群:62697977()   DBA3 群:62697850()  

DBA 超级群:63306533();  DBA4 群: 83829929  DBA5群: 142216823   

聊天 群:40132017   聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

这篇关于Oracle HANGANALYZE 功能诊断 DB hanging的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/874657

相关文章

SQL中的外键约束

外键约束用于表示两张表中的指标连接关系。外键约束的作用主要有以下三点: 1.确保子表中的某个字段(外键)只能引用父表中的有效记录2.主表中的列被删除时,子表中的关联列也会被删除3.主表中的列更新时,子表中的关联元素也会被更新 子表中的元素指向主表 以下是一个外键约束的实例展示

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

如何去写一手好SQL

MySQL性能 最大数据量 抛开数据量和并发数,谈性能都是耍流氓。MySQL没有限制单表最大记录数,它取决于操作系统对文件大小的限制。 《阿里巴巴Java开发手册》提出单表行数超过500万行或者单表容量超过2GB,才推荐分库分表。性能由综合因素决定,抛开业务复杂度,影响程度依次是硬件配置、MySQL配置、数据表设计、索引优化。500万这个值仅供参考,并非铁律。 博主曾经操作过超过4亿行数据

性能分析之MySQL索引实战案例

文章目录 一、前言二、准备三、MySQL索引优化四、MySQL 索引知识回顾五、总结 一、前言 在上一讲性能工具之 JProfiler 简单登录案例分析实战中已经发现SQL没有建立索引问题,本文将一起从代码层去分析为什么没有建立索引? 开源ERP项目地址:https://gitee.com/jishenghua/JSH_ERP 二、准备 打开IDEA找到登录请求资源路径位置

MySQL数据库宕机,启动不起来,教你一招搞定!

作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)公众号:老苏畅谈运维欢迎关注本人公众号,更多精彩与您分享。 MySQL数据库宕机,数据页损坏问题,启动不起来,该如何排查和解决,本文将为你说明具体的排查过程。 查看MySQL error日志 查看 MySQL error日志,排查哪个表(表空间

C++11第三弹:lambda表达式 | 新的类功能 | 模板的可变参数

🌈个人主页: 南桥几晴秋 🌈C++专栏: 南桥谈C++ 🌈C语言专栏: C语言学习系列 🌈Linux学习专栏: 南桥谈Linux 🌈数据结构学习专栏: 数据结构杂谈 🌈数据库学习专栏: 南桥谈MySQL 🌈Qt学习专栏: 南桥谈Qt 🌈菜鸡代码练习: 练习随想记录 🌈git学习: 南桥谈Git 🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈�

让树莓派智能语音助手实现定时提醒功能

最初的时候是想直接在rasa 的chatbot上实现,因为rasa本身是带有remindschedule模块的。不过经过一番折腾后,忽然发现,chatbot上实现的定时,语音助手不一定会有响应。因为,我目前语音助手的代码设置了长时间无应答会结束对话,这样一来,chatbot定时提醒的触发就不会被语音助手获悉。那怎么让语音助手也具有定时提醒功能呢? 我最后选择的方法是用threading.Time

MySQL高性能优化规范

前言:      笔者最近上班途中突然想丰富下自己的数据库优化技能。于是在查阅了多篇文章后,总结出了这篇! 数据库命令规范 所有数据库对象名称必须使用小写字母并用下划线分割 所有数据库对象名称禁止使用mysql保留关键字(如果表名中包含关键字查询时,需要将其用单引号括起来) 数据库对象的命名要能做到见名识意,并且最后不要超过32个字符 临时库表必须以tmp_为前缀并以日期为后缀,备份

[MySQL表的增删改查-进阶]

🌈个人主页:努力学编程’ ⛅个人推荐: c语言从初阶到进阶 JavaEE详解 数据结构 ⚡学好数据结构,刷题刻不容缓:点击一起刷题 🌙心灵鸡汤:总有人要赢,为什么不能是我呢 💻💻💻数据库约束 🔭🔭🔭约束类型 not null: 指示某列不能存储 NULL 值unique: 保证某列的每行必须有唯一的值default: 规定没有给列赋值时的默认值.primary key:

MySQL-CRUD入门1

文章目录 认识配置文件client节点mysql节点mysqld节点 数据的添加(Create)添加一行数据添加多行数据两种添加数据的效率对比 数据的查询(Retrieve)全列查询指定列查询查询中带有表达式关于字面量关于as重命名 临时表引入distinct去重order by 排序关于NULL 认识配置文件 在我们的MySQL服务安装好了之后, 会有一个配置文件, 也就