ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 使用hanganalyze诊断db hang

使用hanganalyze诊断db hang

原创 Linux操作系统 作者:q418441117 时间:2013-05-17 13:39:24 0 删除 编辑

1.在session1中更新数据
SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
45
SQL> update test1 set object_id=1 where object_id=2;

1 row updated.

2.在session2中也更新统一条数据
SQL> select userenv('sid') from dual;

USERENV('SID')
--------------
56

SQL> update test1 set object_id=1 where object_id=2; --更新语句被hang住

3.在session3中使用命令
SQL> oradebug hanganalyze 3;
Hang Analysis in /oracle/diag/rdbms/xuhm/xuhm/trace/xuhm_ora_920.trc

4.查看跟踪文件
[root@hmx ~]# cat /oracle/diag/rdbms/xuhm/xuhm/trace/xuhm_ora_920.trc
Trace file /oracle/diag/rdbms/xuhm/xuhm/trace/xuhm_ora_920.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/product/11.2.0
System name: Linux
Node name: hmx
Release: 2.6.18-238.el5
Version: #1 SMP Sun Dec 19 14:22:44 EST 2010
Machine: x86_64
VM name: VMWare Version: 6
Instance name: xuhm
Redo thread mounted by this instance: 1
Oracle process number: 31
Unix process pid: 920, image: oracle@hmx (TNS V1-V3)


*** 2013-05-15 13:58:49.486
*** SESSION ID:(51.16719) 2013-05-15 13:58:49.486
*** CLIENT ID:() 2013-05-15 13:58:49.486
*** SERVICE NAME:(SYS$USERS) 2013-05-15 13:58:49.486
*** MODULE NAME:(sqlplus@hmx (TNS V1-V3)) 2013-05-15 13:58:49.486
*** ACTION NAME:() 2013-05-15 13:58:49.486

Processing Oradebug command 'hanganalyze 3'

*** 2013-05-15 13:58:50.197
===============================================================================
HANG ANALYSIS:
instances (db_name.oracle_sid): xuhm.xuhm
oradebug_node_dump_level: 3
analysis initiated by oradebug
os thread scheduling delay history: (sampling every 1.000000 secs)
0.000000 secs at [ 13:58:50 ]
NOTE: scheduling delay has not been sampled for 0.203323 secs 0.000000 secs from [ 13:58:45 - 13:58:51 ], 5 sec avg
0.000000 secs from [ 13:57:50 - 13:58:51 ], 1 min avg
0.000000 secs from [ 13:53:50 - 13:58:51 ], 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
[b] Chain 2 Signature: 'os thread startup'
Chain 2 Signature Hash: 0x7f6a526b

===============================================================================
Non-intersecting chains:

-------------------------------------------------------------------------------
Chain 1:
-------------------------------------------------------------------------------
Oracle session identified by:
{
instance: 1 (xuhm.xuhm)
os id: 725
process id: 30,
oracle@hmx (TNS V1-V3)
session id: 56
session serial #: 38477
}
is waiting for 'enq: TX - row lock contention' with wait info:

{
p1: 'name|mode'=0x54580006
p2: 'usn<<16 | slot'=0x9001e
p3: 'sequence'=0x180d
time in wait: 24.177400 sec
timeout after: never
wait id: 13
blocking: 0 sessions
current sql: update test1 set object_id=1 where object_id=2
short stack: ksedsts()+461<-ksdxfstk()+32<-ksdxcb()+1900<-sspuser()+112<-__sighandler()<-semtimedop()+10<-skgpwwait()+160<-ksliwat()+1865<-kslwaitctx()+163<-ksqcmi()+2956<-ksqgtlctx()+3810<-ksqgelctx()+561<-ktuGetTxForXid()+131<-ktcwit1()+291<-kdddgb()+8086<-kdusru()+460<-kauupd()+412<-updrow()+2123<-qerupFetch()+810<-updaul()+1265<-updThreePhaseExe()+328<-updexe()+443<-opiexe()+9904<-kpoal8()+2231<-opiodr()+910<-ttcpip()+2289<-opitsk()+1670<-opiino()+966<-opiodr()+910<-opidrv()+570<-sou2o()+103<-opimai_real()+133<-ssthrdmain(
wait history:
* time between current wait and wait #1: 0.002334 sec
1. event: 'SQL*Net message from client'
time waited: 9.252124 sec
wait id: 12 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
* time between wait #1 and #2: 0.000117 sec
2. event: 'SQL*Net message to client'
time waited: 0.000001 sec
wait id: 11 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
* time between wait #2 and #3: 0.000032 sec
3. event: 'SQL*Net message from client'
time waited: 0.000516 sec
wait id: 10 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
}
and is blocked by
=> Oracle session identified by:
{
instance: 1 (xuhm.xuhm)
os id: 581
process id: 28,
oracle@hmx (TNS V1-V3)
session id: 45
session serial #: 11231
}
which is waiting for 'SQL*Net message from client' with wait info:

{
p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
time in wait: 48.995020 sec
timeout after: never
wait id: 40
blocking: 1 session
current sql:
short stack: ksedsts()+461<-ksdxfstk()+32<-ksdxcb()+1900<-sspuser()+112<-__sighandler()<-read()+14<-ntpfprd()+115<-nsbasic_brc()+338<-nsbrecv()+69<-nioqrc()+485<-__PGOSF36_opikndf2()+978<-opitsk()+850<-opiino()+966<-opiodr()+910<-opidrv()+570<-sou2o()+103<-opimai_real()+133<-ssthrdmain()+252<-main()+201<-__libc_start_main()+244<-_start()+36
wait history:
* time between current wait and wait #1: 0.000021 sec
1. event: 'SQL*Net message to client'
time waited: 0.000034 sec
wait id: 39 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
* time between wait #1 and #2: 0.005310 sec
2. event: 'SQL*Net message from client'
time waited: 29.498308 sec
wait id: 38 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
* time between wait #2 and #3: 0.000002 sec
3. event: 'SQL*Net message to client'
time waited: 0.000001 sec
wait id: 37 p1: 'driver id'=0x62657100
p2: '#bytes'=0x1
}

Chain 1 Signature: 'SQL*Net message from client'<='enq: TX - row lock contention'
Chain 1 Signature Hash: 0x38c48850
-------------------------------------------------------------------------------

===============================================================================
Sessions in an involuntary wait or not in a wait:

-------------------------------------------------------------------------------
Chain 2:
-------------------------------------------------------------------------------
Oracle session identified by:
{
instance: 1 (xuhm.xuhm)
os id: 13245
process id: 29, oracle@localhost.localdomain (CJQ0)
session id: 34
session serial #: 3
}
is waiting for 'os thread startup' with wait info:
{
time in wait: 0.447051 sec
heur. time in wait: 2.449184 sec
timeout after: 1 min 59 sec
wait id: 1874805
blocking: 0 sessions
current sql:
short stack: ksedsts()+461<-ksdxfstk()+32<-ksdxcb()+1900<-sspuser()+112<-__sighandler()<-semtimedop()+10<-skgpwwait()+160<-ksliwat()+1865<-kslwaitctx()+163<-ksoreq_wait()+508<-ksbsrv()+3908<-kkjcre1p()+137<-kkjcrenp()+233<-kkjsns()+567<-kkjcjexe()+914<-kkjssrh()+561<-ksbcti()+513<-ksbabs()+1735<-ksbrdp()+971<-opirip()+623<-opidrv()+603<-sou2o()+103<-opimai_real()+266<-ssthrdmain()+252<-main()+201<-__libc_start_main()+244<-_start()+36
wait history:
* time between current wait and wait #1: 0.000525 sec
1. event: 'os thread startup'
time waited: 1.000453 sec
wait id: 1874804
* time between wait #1 and #2: 0.000543 sec
2. event: 'os thread startup'
time waited: 1.000612 sec
wait id: 1874803
* time between wait #2 and #3: 0.000042 sec
3. event: 'enq: PR - contention'
time waited: 1.000780 sec
wait id: 1874802 p1: 'name|mode'=0x50520006
p2: '0'=0x0
p3: '0'=0x0
}

Chain 2 Signature: 'os thread startup'
Chain 2 Signature Hash: 0x7f6a526b
-------------------------------------------------------------------------------

===============================================================================
Extra information that will be dumped at higher levels:
[level 4] : 1 node dumps -- [LEAF] [LEAF_NW]
[level 5] : 2 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]):
[33]/1/34/3/0x91baf510/13245/SINGLE_NODE/
[44]/1/45/11231/0x91b8e930/581/LEAF/
[55]/1/56/38477/0x91b6dd50/725/NLEAF/[44]

*** 2013-05-15 13:58:50.245
===============================================================================
END OF HANG ANALYSIS
===============================================================================

*** 2013-05-15 13:58:50.245
===============================================================================
HANG ANALYSIS DUMPS:
oradebug_node_dump_level: 3
===============================================================================

State of LOCAL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[33]/1/34/3/0x91baf510/13245/SINGLE_NODE/
[44]/1/45/11231/0x91b8e930/581/LEAF/
[55]/1/56/38477/0x91b6dd50/725/NLEAF/[44]


No processes qualify for dumping.

===============================================================================
HANG ANALYSIS DUMPS: END
===============================================================================

*** 2013-05-15 13:58:50.245
Oradebug command 'hanganalyze 3' console output:
Hang Analysis in /oracle/diag/rdbms/xuhm/xuhm/trace/xuhm_ora_920.trc


5.kill掉hang住的os进程
[root@hmx ~]# kill -9 581


 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26655292/viewspace-761341/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: gallf啊
请登录后发表评论 登录
全部评论

注册时间:2012-09-11

  • 博文量
    203
  • 访问量
    471915