hanganalyze分析會話阻塞
hanganalyze分析會話阻塞
參考文件:USING AND READING HANGANALYZE或者[ID 215858.1]
1、模擬阻塞會話
資料庫版本:
SQL> select * from v$version;
資料庫版本:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
----------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
會話1:
SQL> delete from t_lf where id=1;
SQL> delete from t_lf where id=1;
已刪除 1 行。
會話2:
SQL> delete from t_lf where id=1;
會話此時hang住
SQL> delete from t_lf where id=1;
會話此時hang住
2、hanganalyze分析
--sys登入
SQL> oradebug setmypid
已處理的語句
SQL> oradebug unlimit;
已處理的語句
SQL> oradebug hanganalyze 3
Hang Analysis in G:\ORACLE\diag\rdbms\orcl11g\orcl11g\trace\orcl11g_ora_10972.trc
Trace file G:\ORACLE\diag\rdbms\orcl11g\orcl11g\trace\orcl11g_ora_10972.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Windows NT Version V6.1 Service Pack 1
CPU : 4 - type 586, 2 Physical Cores
Process Affinity : 0x0x00000000
Memory (Avail/Total): Ph:847M/3492M, Ph+PgF:2533M/6983M, VA:1040M/2047M
Instance name: orcl11g
Redo thread mounted by this instance: 1
Oracle process number: 25
Windows thread id: 10972, image: ORACLE.EXE (SHAD)
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Windows NT Version V6.1 Service Pack 1
CPU : 4 - type 586, 2 Physical Cores
Process Affinity : 0x0x00000000
Memory (Avail/Total): Ph:847M/3492M, Ph+PgF:2533M/6983M, VA:1040M/2047M
Instance name: orcl11g
Redo thread mounted by this instance: 1
Oracle process number: 25
Windows thread id: 10972, image: ORACLE.EXE (SHAD)
*** 2013-10-21 15:03:31.765
*** SESSION ID:(575.1) 2013-10-21 15:03:31.765
*** CLIENT ID:() 2013-10-21 15:03:31.765
*** SERVICE NAME:(SYS$USERS) 2013-10-21 15:03:31.765
*** MODULE NAME:(sqlplus.exe) 2013-10-21 15:03:31.765
*** ACTION NAME:() 2013-10-21 15:03:31.765
Processing Oradebug command 'setmypid'
*** 2013-10-21 15:03:31.765
Oradebug command 'setmypid' console output:
Oradebug command 'setmypid' console output:
*** 2013-10-21 15:03:39.175
Processing Oradebug command 'unlimit'
Processing Oradebug command 'unlimit'
*** 2013-10-21 15:03:39.175
Oradebug command 'unlimit' console output:
Oradebug command 'unlimit' console output:
*** 2013-10-21 15:03:48.660
Processing Oradebug command 'hanganalyze 3'
Processing Oradebug command 'hanganalyze 3'
*** 2013-10-21 15:03:49.237
===============================================================================
HANG ANALYSIS:
instances (db_name.oracle_sid): orcl11g.orcl11g
oradebug_node_dump_level: 3
analysis initiated by oradebug
os thread scheduling delay history: (sampling every 1.000000 secs)
0.000000 secs at [ 15:03:48 ]
NOTE: scheduling delay has not been sampled for 0.656762 secs 0.000000 secs from [ 15:03:44 - 15:03:49 ], 5 sec avg
0.000000 secs from [ 15:02:49 - 15:03:49 ], 1 min avg
0.000116 secs from [ 14:58:49 - 15:03:49 ], 5 min avg
===============================================================================
Chains most likely to have caused the hang:
[a] Chain 1 Signature: 'SQL*Net message from client'<='enq: TX - row lock contention'
Chain 1 Signature Hash: 0x38c48850
===============================================================================
Non-intersecting chains:
-------------------------------------------------------------------------------
Chain 1:
-------------------------------------------------------------------------------
Oracle session identified by:
{
instance: 1 (orcl11g.orcl11g)
os id: 10724
process id: 17, ORACLE.EXE (SHAD)
session id: 572
session serial #: 5
}
is waiting for 'enq: TX - row lock contention' with wait info:
{
p1: 'name|mode'=0x54580006
p2: 'usn<<16 | slot'=0x8000f
p3: 'sequence'=0x427
time in wait: 3 min 13 sec
timeout after: never
wait id: 24
blocking: 0 sessions
current sql: delete from t_lf where id=1
short stack: _ksedsts()+373<
wait history:
* time between current wait and wait #1: 0.000373 sec
1. event: 'Disk file operations I/O'
time waited: 0.000777 sec
wait id: 23 p1: 'FileOperation'=0x2
p2: 'fileno'=0x5
p3: 'filetype'=0x2
* time between wait #1 and #2: 0.000326 sec
2. event: 'SQL*Net message from client'
time waited: 1.912707 sec
wait id: 22 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
* time between wait #2 and #3: 0.000001 sec
3. event: 'SQL*Net message to client'
time waited: 0.000001 sec
wait id: 21 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
}
and is blocked by
=> Oracle session identified by:
{
instance: 1 (orcl11g.orcl11g)
os id: 12736
process id: 20, ORACLE.EXE (SHAD)
session id: 9
session serial #: 15
}
which is waiting for 'SQL*Net message from client' with wait info:
{
p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
time in wait: 3 min 24 sec
timeout after: never
wait id: 496
blocking: 1 session
current sql:
short stack: _ksedsts()+373
wait history:
* time between current wait and wait #1: 0.000015 sec
1. event: 'SQL*Net message to client'
time waited: 0.000003 sec
wait id: 495 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
* time between wait #1 and #2: 0.000564 sec
2. event: 'db file scattered read'
time waited: 0.000744 sec
wait id: 494 p1: 'file#'=0x5
p2: 'block#'=0x974
p3: 'blocks'=0xc
* time between wait #2 and #3: 0.000554 sec
3. event: 'db file scattered read'
time waited: 0.003634 sec
wait id: 493 p1: 'file#'=0x5
p2: 'block#'=0x967
p3: 'blocks'=0xd
}
Chain 1 Signature: 'SQL*Net message from client'<='enq: TX - row lock contention'
Chain 1 Signature Hash: 0x38c48850
-------------------------------------------------------------------------------
===============================================================================
Extra information that will be dumped at higher levels:
[level 4] : 1 node dumps -- [LEAF] [LEAF_NW]
[level 5] : 1 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]):
[8]/1/9/15/33A37DD0/12736/LEAF/
[571]/1/572/5/330D7A30/10724/NLEAF/[8]
===============================================================================
HANG ANALYSIS:
instances (db_name.oracle_sid): orcl11g.orcl11g
oradebug_node_dump_level: 3
analysis initiated by oradebug
os thread scheduling delay history: (sampling every 1.000000 secs)
0.000000 secs at [ 15:03:48 ]
NOTE: scheduling delay has not been sampled for 0.656762 secs 0.000000 secs from [ 15:03:44 - 15:03:49 ], 5 sec avg
0.000000 secs from [ 15:02:49 - 15:03:49 ], 1 min avg
0.000116 secs from [ 14:58:49 - 15:03:49 ], 5 min avg
===============================================================================
Chains most likely to have caused the hang:
[a] Chain 1 Signature: 'SQL*Net message from client'<='enq: TX - row lock contention'
Chain 1 Signature Hash: 0x38c48850
===============================================================================
Non-intersecting chains:
-------------------------------------------------------------------------------
Chain 1:
-------------------------------------------------------------------------------
Oracle session identified by:
{
instance: 1 (orcl11g.orcl11g)
os id: 10724
process id: 17, ORACLE.EXE (SHAD)
session id: 572
session serial #: 5
}
is waiting for 'enq: TX - row lock contention' with wait info:
{
p1: 'name|mode'=0x54580006
p2: 'usn<<16 | slot'=0x8000f
p3: 'sequence'=0x427
time in wait: 3 min 13 sec
timeout after: never
wait id: 24
blocking: 0 sessions
current sql: delete from t_lf where id=1
short stack: _ksedsts()+373<
wait history:
* time between current wait and wait #1: 0.000373 sec
1. event: 'Disk file operations I/O'
time waited: 0.000777 sec
wait id: 23 p1: 'FileOperation'=0x2
p2: 'fileno'=0x5
p3: 'filetype'=0x2
* time between wait #1 and #2: 0.000326 sec
2. event: 'SQL*Net message from client'
time waited: 1.912707 sec
wait id: 22 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
* time between wait #2 and #3: 0.000001 sec
3. event: 'SQL*Net message to client'
time waited: 0.000001 sec
wait id: 21 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
}
and is blocked by
=> Oracle session identified by:
{
instance: 1 (orcl11g.orcl11g)
os id: 12736
process id: 20, ORACLE.EXE (SHAD)
session id: 9
session serial #: 15
}
which is waiting for 'SQL*Net message from client' with wait info:
{
p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
time in wait: 3 min 24 sec
timeout after: never
wait id: 496
blocking: 1 session
current sql:
short stack: _ksedsts()+373
wait history:
* time between current wait and wait #1: 0.000015 sec
1. event: 'SQL*Net message to client'
time waited: 0.000003 sec
wait id: 495 p1: 'driver id'=0x42455100
p2: '#bytes'=0x1
* time between wait #1 and #2: 0.000564 sec
2. event: 'db file scattered read'
time waited: 0.000744 sec
wait id: 494 p1: 'file#'=0x5
p2: 'block#'=0x974
p3: 'blocks'=0xc
* time between wait #2 and #3: 0.000554 sec
3. event: 'db file scattered read'
time waited: 0.003634 sec
wait id: 493 p1: 'file#'=0x5
p2: 'block#'=0x967
p3: 'blocks'=0xd
}
Chain 1 Signature: 'SQL*Net message from client'<='enq: TX - row lock contention'
Chain 1 Signature Hash: 0x38c48850
-------------------------------------------------------------------------------
===============================================================================
Extra information that will be dumped at higher levels:
[level 4] : 1 node dumps -- [LEAF] [LEAF_NW]
[level 5] : 1 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]):
[8]/1/9/15/33A37DD0/12736/LEAF/
[571]/1/572/5/330D7A30/10724/NLEAF/[8]
*** 2013-10-21 15:03:49.299
===============================================================================
END OF HANG ANALYSIS
===============================================================================
===============================================================================
END OF HANG ANALYSIS
===============================================================================
*** 2013-10-21 15:03:49.299
===============================================================================
HANG ANALYSIS DUMPS:
oradebug_node_dump_level: 3
===============================================================================
State of LOCAL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[8]/1/9/15/33A37DD0/12736/LEAF/
[571]/1/572/5/330D7A30/10724/NLEAF/[8]
No processes qualify for dumping.
===============================================================================
HANG ANALYSIS DUMPS: END
===============================================================================
===============================================================================
HANG ANALYSIS DUMPS:
oradebug_node_dump_level: 3
===============================================================================
State of LOCAL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[8]/1/9/15/33A37DD0/12736/LEAF/
[571]/1/572/5/330D7A30/10724/NLEAF/[8]
No processes qualify for dumping.
===============================================================================
HANG ANALYSIS DUMPS: END
===============================================================================
*** 2013-10-21 15:03:49.299
Oradebug command 'hanganalyze 3' console output:
Hang Analysis in G:\ORACLE\diag\rdbms\orcl11g\orcl11g\trace\orcl11g_ora_10972.trc
Oradebug command 'hanganalyze 3' console output:
Hang Analysis in G:\ORACLE\diag\rdbms\orcl11g\orcl11g\trace\orcl11g_ora_10972.trc
通過上述分析:大概可以得出sid=572因為請求enq: TX - row lock contention(TX mode=6)被sid=9阻塞
3、查詢檢視驗證
SQL> select sid,event from v$session where wait_class#<>6;
SID EVENT
---------- ------------------------------
572 enq: TX - row lock contention
SQL> select sid,event from v$session where wait_class#<>6;
SID EVENT
---------- ------------------------------
572 enq: TX - row lock contention
SQL> select sid,blocking_session,event,p1,p2,p3 from v$session where sid=572;
SID BLOCKING_SESSION EVENT P1 P2 P3
---------- ---------------- ----------------------------------------------- ---------- ---------- ----------
572 9 enq: TX - row lock contention 1415053318 393245 1058
SQL> select * from v$lock where type in('TX','TM');
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
-------- -------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
31C81ED8 31C81F04 572 TX 393245 1058 0 6 51 0
0F1DA850 0F1DA880 9 TM 59713 0 3 0 66 0
0F1DA850 0F1DA880 572 TM 59713 0 3 0 51 0
2F48E894 2F48E8D4 9 TX 393245 1058 6 0 66 1
--查詢結果sid=9的會話持有TX MODE=6阻塞sid=572的TX MODE=6的請求,和HANG ANALYSIS分析基本一致。
---------- ---------------- ----------------------------------------------- ---------- ---------- ----------
572 9 enq: TX - row lock contention 1415053318 393245 1058
SQL> select * from v$lock where type in('TX','TM');
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
-------- -------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
31C81ED8 31C81F04 572 TX 393245 1058 0 6 51 0
0F1DA850 0F1DA880 9 TM 59713 0 3 0 66 0
0F1DA850 0F1DA880 572 TM 59713 0 3 0 51 0
2F48E894 2F48E8D4 9 TX 393245 1058 6 0 66 1
--查詢結果sid=9的會話持有TX MODE=6阻塞sid=572的TX MODE=6的請求,和HANG ANALYSIS分析基本一致。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24996904/viewspace-774739/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracledebug hanganalyze分析會話等待及儲存過程hangOracle會話儲存過程
- Oracle阻塞會話查詢Oracle會話
- 模擬阻塞會話例項會話
- hs message to agent'阻塞會話會話
- SQLServer如何監控阻塞會話SQLServer會話
- 使用ass109.awk 分析會話阻塞情況會話
- 為什麼sleeping的會話會造成阻塞會話
- Check_oracle_health 之阻塞會話數Oracle會話
- 為什麼sleeping的會話會造成阻塞(2)會話
- MySQL的共享鎖阻塞會話案例淺析MySql會話
- Kill會話過程分析會話
- 遭遇cursor:pin x等待事件定位阻塞會話診斷過程事件會話
- Web會話安全分析工具ProxyStrikeWeb會話
- Kill會話過程分析(二)會話
- 大白話搞懂什麼是同步/非同步/阻塞/非阻塞非同步
- 點陣圖索引導致的會話阻塞問題(p7)索引會話
- oracle會話阻塞查詢指令碼及對應欄位含義Oracle會話指令碼
- MySQL的共享鎖阻塞會話案例淺析輸入日誌標題MySql會話
- -t【Oracle-故障管理】-Trace跟蹤會話和會話執行慢故障分析Oracle會話
- Go 中的阻塞分析Go
- oracle鎖阻塞的分析Oracle
- Oracle使用hanganalyze 命令分析資料庫hang【轉】Oracle資料庫
- 【Oracle】使用hanganalyze 命令分析資料庫hang【轉】Oracle資料庫
- Oracle hanganalyzeOracle
- 轉貼_Oradebug hanganalyze分析library cache等待
- 使用oradebug dump hanganalyze分析oracle hang系列一Oracle
- 使用oradebug dump hanganalyze 分析oracle hang系列二Oracle
- 使用oradebug dump hanganalyze 分析oracle hang系列三Oracle
- css動畫是否會被js阻塞CSS動畫JS
- About Oracle HanganalyzeOracle
- hanganalyze 學習
- oracle資料庫hang住分析工具Hanganalyze使用總結Oracle資料庫
- Windows下大量SYSMAN會話超出會話限制Windows會話
- 會話管理會話
- Session會話Session會話
- SQL Server阻塞blocking案例分析SQLServerBloC
- 【Redis】redis阻塞監控項分析Redis
- ANALYZE導致的阻塞問題分析