How to identify strings involved in an Oracle deadlock?

When Oracle detects a deadlock, such a trace file 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 which strings to use based on the information above to help debug the application?

+6
source share
1 answer

I found the answer:

  • The number after dictionary objn can be used to select from DBA_objects.

     SELECT owner, object_name, object_type FROM dba_objects WHERE object_id = 217431; 
  • After defining the table, the row can be found using rowid:

     SELECT * FROM table_found_above WHERE rowid = 'AAA1FXAAxAAASfLAAn'; 

If the trace file says that there are no "pending lines", this method will not work. The problem may be caused by an unindexed foreign key.

+12
source

Source: https://habr.com/ru/post/915625/


All Articles