本篇内容主要讲解“怎么使用hanganalyze”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么使用hanganalyze”吧!

hanganalyze 和systemstate还是不同的,hanganalyze 里面会有清晰的等待链、等待时间、callstack等,比较轻量级。systemstate 相对hanganalyze 信息较多,会有很多proces和session的信息,还会有shared pool的信息,但是看等待链比较吃力。

1.命令

(1)单实例SQL>oradebugsetmypidSQL>oradebugunlimitSQL>oradebughanganalyze3等1~2分钟SQL>oradebughanganalyze3等1~2分钟SQL>oradebughanganalyze3(2).RACSQL>oradebugsetmypidSQL>oradebugunlimitSQL>oradebug-gallhanganalyze3等1~2分钟SQL>oradebug-gallhanganalyze3等1~2分钟SQL>oradebug-gallhanganalyze3

2.解读trace文件

(1).State of nodes

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

[894]/0/895/60406/0xba362838/17792/NLEAF/261/264/[908]/1004

[908]/0/909/3031/0xba3754c8/16376/LEAF/262/263//894

[1004]/0/1005/23626/0xba3f61c8/18465/NLEAF/405/406/[894][908]/none

nodenum:定义每个session的序列号

sid:session的sid

sess_srno:session的Serial#

ospid:OS的进程ID

state:node的状态

adjlist:表示blocker node

predecessor:表示waiter node

State有如下几种状态:

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

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

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

(4)IGN/IGN_DMP:这些Session通常是IDLE Session。

(5)SINGLE_NODE and SINGLE_NODE_NW 与leaf和leaf_nw相同,只是它们没有依赖于它们的进程

根据上述信息可以得出:

[1004] block [894][908]

[894] block [908]

(2).CYCLES 处于死锁状态的会话之间的进程依赖性

Cycle1:<sid/sess_srno/proc_ptr/ospid/wait_event>:<980/3887/0xe4214964/24065/latchfree>--<2518/352/0xe4216560/24574/latchfree>--<55/10/0xe41236a8/13751/latchfree>

(3).Found blocker会话,通常情况是1个session block了很多session会在这部分显示

Found21objectswaitingfor<sid/sess_srno/proc_ptr/ospid/wait_event><55/10/0xe41236a8/13751/latchfree>Found12objectswaitingfor<sid/sess_srno/proc_ptr/ospid/wait_event><2098/2280/0xe42870d0/3022/dbfilescatteredread>Found12objectswaitingfor<sid/sess_srno/proc_ptr/ospid/wait_event><1941/1783/0xe41ac9e0/462/NoWait>Found12objectswaitingfor<sid/sess_srno/proc_ptr/ospid/wait_event><980/3887/0xe4214964/24065/latchfree>

(4).Chain 等待链上涉及的会话。等待链意味着一个会话正在阻塞一个或多个其他会话。

Openchainsfound:Chain1:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/909/3031/0xbcc5dc48/16376/SQL*Netmessagefromclient>--<0/895/60406/0xbcc54448/17792/enq:TX-rowlockcontention>--<0/1005/23626/0xbcc5fc48/18465/enq:TX-rowlockcontention>

(5).Other chains found 不是被Open chains上链阻塞的进程

Chain2:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/820/40757/0xbcc61448/20057/jobqslavewait>Chain3:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/882/36187/0xbcc68448/19717/jobqslavewait>Chain4:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/985/3438/0xbcc50448/20054/NoWait>Chain5:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/1072/2/0xbcbf3448/20322/StreamsAQ:qmnslaveidlewait>Chain6:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/1079/2/0xbcbf0448/20117/StreamsAQ:waitingfortimeman>Chain7:<cnode/sid/sess_srno/proc_ptr/ospid/wait_event>:<0/1085/1/0xbcbed448/20070/StreamsAQ:qmncoordinatoridle>

到此,相信大家对“怎么使用hanganalyze”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!