Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DEADLOCK DETECTED - DELETE statement - how/why is it waiting in SHARE mode?

650635Jul 22 2009 — edited Jul 24 2009
Hi,

I'm wondering if anyone can provide any guidance here. Environment is:

Microsoft Windows 2003 Server
Oracle Standard Edition 10.2.0.4

We had a deadlock detected in our app at a client site - I'm attaching the relevant part of the trace file below. Whilst we think we have found the reason for the deadlock (looks like it's due to a cascading foreign key) I'm confused as to the lock mode that is being requested.

Here's the trace information:
Deadlock graph:
                       ---------Blocker(s)--------  ---------Waiter(s)---------
Resource Name          process session holds waits  process session holds waits
TX-00120012-00003b59        28     475     X             29     481           S
TX-000a0029-0003508b        29     481     X             28     475           X
session 475: DID 0001-001C-000F96B0	session 481: DID 0001-001D-00000079
session 481: DID 0001-001D-00000079	session 475: DID 0001-001C-000F96B0
Rows waited on:
Session 481: no row
Session 475: obj - rowid = 00014625 - AAAUYlAAIAAAAawAAo
  (dictionary objn - 83493, file - 8, block - 1712, slot - 40)
Information on the OTHER waiting sessions:
Session 481:
  pid=29 serial=18261 audsid=202192707 user: 51/info
  O/S info: user: SYSTEM, term: our_term, ospid: 5244:940, machine: our_machine
            program: our_exe.exe
  client info: GUI
  application name: app, hash value=3864155245
  action name: our_action, hash value=3631189430
  Current SQL Statement:
  DELETE FROM TABLE_1 T WHERE T.T_ID = :B1
End of information on OTHER waiting sessions.
Current SQL statement for this session:
UPDATE TABLE_1 T SET T.STATUS_ID = :B2 WHERE T.T_ID = :B1 
It looks to me like session *481* is trying to do a delete when the deadlock is thrown:
 DELETE FROM TABLE_1 T WHERE T.T_ID = :B1
and that is requesting in S (hared) mode.
                                   ---------Blocker(s)--------  ---------Waiter(s)---------
Resource Name          process session holds waits  process session holds waits
TX-00120012-00003b59        28     475     X             29     481           S
(also the "no row" for rows waited on)
Session 481: no row
I believed it would be in (e) X (clusive) mode (for the row being deleted). In fact yes, I set up a quick and simple deadlock test and a the final delete is waiting for (e) X (clusive) mode.

So, am I misinterpreting the trace information, or is the DELETE statement requesting the lock in S (hare) mode?!! If that's the case, I would very much appreciate a quick explanation of how/why this is...



Regards,

Ados
This post has been answered by brtk on Jul 23 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 21 2009
Added on Jul 22 2009
23 comments
9,280 views