Forum Stats

  • 3,874,704 Users
  • 2,266,767 Discussions
  • 7,911,957 Comments

Discussions

Why the Deadlock is takes place on the table?

User_M3JHT
User_M3JHT Member Posts: 1 Green Ribbon

We are not able to insert data into the table. Although we can select data properly. The procedure on that table is continuously in running process but there is no status having fail or success.

Answers

  • Solomon Yakobson
    Solomon Yakobson Member Posts: 19,949 Red Diamond

    Well, deadlock is result of two or more session conflict. It can't occur just in one session. You need to check deadlock graph to see what sessions are causing deadlock. In short session S1 makes changes to row R1 in table T1 but not yet commits so row is locked by session S1 . Session S2 makes changes to row R2 in table T2 but not yet commits so row is locked by session S2. Then session S1 tries to make change to row R2 in table T2 and waits for session S2 to release lock (commit/rollback) on row R2 in table T2. Meanwhile session S2 tries to make change to row R1 in table T1 and waits for session S1 to release lock (commit/rollback) on row R1 in table T1. As a result we have a deadlock - session 1 is waiting on session 2 while session2 is waiting on session 1. Oracle detects it and kills one of the sessions so the other can continue. In most cases deadlock is result of bad scheduling.

    SY.