oracle 行级死锁_如何识别Oracle死锁中涉及的行?

When Oracle detects a deadlock, a trace file like this is written:

*** SESSION ID:(56.27081) 2012-05-14 08:16:28.013

DEADLOCK DETECTED ( ORA-00060 )

[Transaction Deadlock]

The following deadlock is not an ORACLE error. It is a

deadlock due to user error in the design of an application

or from issuing incorrect ad-hoc SQL. The following

information may aid in determining the deadlock: Deadlock graph:

---------Blocker(s)-------- ---------Waiter(s)---------

Resource Name process session holds waits process session holds waits

TX-0010002c-002719b5 146 56 X 164 44 X

TX-000f002a-002edd1e 164 44 X 146 56 X

session 56: DID 0001-0092-00050D0D session 44: DID 0001-00A4-0002E3C2

session 44: DID 0001-00A4-0002E3C2 session 56: DID 0001-0092-00050D0D

Rows waited on:

Session 44: obj - rowid = 00035157 - AAA1FXAAxAAASfLAAn

(dictionary objn - 217431, file - 49, block - 75723, slot - 39)

Session 56: obj - rowid = 00035157 - AAA1FXAAsAACjuiAAP

(dictionary objn - 217431, file - 44, block - 670626, slot - 15)

How can I determine the rows involved based on the information above in order to assist in debugging the application?

解决方案

I found the answer:

The number after dictionary objn can be used to select out of DBA_objects.

SELECT owner, object_name, object_type

FROM dba_objects

WHERE object_id = 217431;

Once the table is identified, the row can be found using the rowid:

SELECT *

FROM table_found_above

WHERE rowid = 'AAA1FXAAxAAASfLAAn';

If the trace file says that there are no "Rows waited on" this technique will not work. The problem may be due to an unindexed foreign key.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值