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

前端之家收集整理的这篇文章主要介绍了如何识别Oracle死锁中涉及的行?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当Oracle检测到死锁时,会写入如下跟踪文件
*** 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)

如何根据上述信息确定所涉及的行,以帮助调试应用程序?

我找到了答案:

>字典objn之后的数字可用于从DBA_objects中选择.

SELECT owner,object_name,object_type 
FROM dba_objects 
WHERE object_id = 217431;

>识别完表后,可以使用rowid找到该行:

SELECT * 
FROM table_found_above 
WHERE rowid = 'AAA1FXAAxAAASfLAAn';

如果跟踪文件说没有“Rows等待”,这种技术将无效.问题可能是由于未编制索引的外键.

原文链接:https://www.f2er.com/oracle/204858.html

猜你在找的Oracle相关文章