Reputation: 878
Is it possible that a Deadlock in Oracle won't be rolled back in which we have to manually clear the Deadlock?
I read in the Oracle Documentation, it says:
Oracle Database automatically detects deadlocks and resolves them by rolling back one statement involved in the deadlock, releasing one set of the conflicting row locks.
My question is, can there be a scenario where this does not happen?
Upvotes: 2
Views: 668
Reputation: 49082
Is it possible that a Deadlock is not being rolled back in which we have to manually clear the Deadlock.
Well, it is not that all the transactions are rolled back. Oracle detects a deadlock automatically, throws ORA-00060: deadlock detected while waiting for resource
, and rolls back one of the transactions involved in the deadlock which Oracle decided as the victim. The previous successful transactions are not rolled back. Even after the deadlock error, if a commit is issued, the previous successful transaction will be committed. At this time, the other session's transaction will also succeed and you could issue a commit.
Deadlocks are automatically cleared -- you never need to clear them.
For a detailed example, look at this answer. You can reproduce with a simple test case as demonstrated here : Understanding Oracle Deadlock
Upvotes: 3