hanganalyze診斷資料庫hang的原因

來源:互聯網
上載者:User

環境:redhat 6.1+11.2.0.3RAC

實驗:

節點一sessions:

SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
            62

SQL> create table binbin(id number,name varchar2(20));

Table created.

SQL> insert into binbin values(1,'binbin');

1 row created.

SQL> commit;

Commit complete.

SQL>  update binbin set name='hang' where id=1;

1 row updated.
節點二sessions:

SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
            69

 

SQL>  update binbin set name='hang' where id=1;

此時已經hang住。

 

節點一sessions 2做hanganlyze分析:

 

RAC環境hanganlyze分析命令如下:

SQL> oradebug setmypid
Statement processed.
SQL> oradebug setinst all
Statement processed.
SQL> oradebug -g def hanganalyze 3
Hang Analysis in /u01/app/oracle/diag/rdbms/dave/dave1/trace/dave1_diag_8273.trc

單一實例環境hanganlyze分析命令如下:

oradebug hanganalyze 3                  -----等價於 ALTER SESSION SET EVENTS 'immediate trace name HANGANALYZE level 3';

 

查看trace檔案

more   /u01/app/oracle/diag/rdbms/dave/dave1/trace/dave1_diag_8273.trc

Extra information that will be dumped at higher levels:
[level  4] :   1 node dumps -- [LEAF] [LEAF_NW]
[level  5] :  13 node dumps -- [NO_WAIT] [INVOL_WT] [SINGLE_NODE] [NLEAF] [SINGLE_NODE_NW]

State of ALL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[1]/1/2/1/0x91048db8/8261/SINGLE_NODE_NW/
[10]/1/11/1/0x91ff9fa8/8283/SINGLE_NODE_NW/
[11]/1/12/1/0x917fbcf0/8285/SINGLE_NODE_NW/
[26]/1/27/1/0x917cf218/8332/SINGLE_NODE_NW/
[31]/1/32/5/0x917c03d0/8384/SINGLE_NODE_NW/
[34]/1/35/7/0x917b74d8/9573/SINGLE_NODE_NW/
[50]/1/51/15/0x91787a58/10085/SINGLE_NODE_NW/
[61]/1/62/191/0x91766e20/20465/LEAF/
[72]/1/73/117/0x917461e8/20861/SINGLE_NODE/
[256]/2/10/1/0x91ffcf50/7872/SINGLE_NODE_NW/
[257]/2/11/1/0x91ff9fa8/7876/SINGLE_NODE_NW/
[258]/2/12/1/0x917fbcf0/7878/SINGLE_NODE_NW/
[303]/2/57/21/0x91775c68/13052/SINGLE_NODE/
[315]/2/69/15/0x91752088/13344/NLEAF/[61]

 

從上面trace可以看出nodenum為61,session id為62的阻塞了nodenum 為315 session id為69的會話。

[nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist] 解釋如下:

nodenum:定義每個session的序號
cnode是Node Id

sid: session的sid
sess_srno: session的Serial#
ospid: OS的進程ID
state: node的狀態
adjlist: 表示blocker node
IN_HANG:這表示該node處於死結狀態,通常還有其他node(blocker)也處於該狀態
LEAF/LEAF_NW:該node通常是阻塞者,LEAF說明該NODE沒有等待其他資源,而LEAF_NW則可能是沒有等待其他資源或者是在使用CPU
NLEAF:通常可以看作這些會話是被阻塞的資源.發生這種情況一般說明資料庫發生效能問題而不是資料庫hang ,adjlist 可以看做是阻塞者。
IGN/IGN_DMP:這類會話通常被認為是空閑會話,除非其adjlist列裡存在node。如果是非空閑會話則說明其adjlist裡的node正在等待其他node釋放資源。
SINGLE_NODE/SINGLE_NODE_NW:近似於空閑會話.

 

[oracle@rac1 ~]$ kill -9 20465 --kill掉阻塞著

節點二session:

SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
            69

SQL>  update bnbin set name='hang' where id=1;

 

1 row updated.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.