Home >> FAQs/Tutorials >> Oracle Tutorials

Oracle Tutorials - How Oracle Handles Dead Locks

By: FYIcenter.com

(Continued from previous topic...)

How Oracle Handles Dead Locks?

Oracle server automatically detects dead locks. When a dead lock is detected, Oracle server will select a victim transaction, and fail its statement that is blocked in the dead lock to break the dead lock. The tutorial exercise below shows you an example of statements failed by Oracle server because of dead locks:

(session 1)
SQL> connect HR/fyicenter

SQL> UPDATE fyi_links 
  SET notes='Session 1' 
  WHERE id=101;
1 row updated.
                                   (session 2)
                                   SQL> connect HR/fyicenter

                                   SQL> UPDATE fyi_links 
                                     SET notes='Session 2' 
                                     WHERE id=110;
                                   1 row updated.
                                     
                                   SQL> UPDATE fyi_links 
                                     SET notes='Session 2' 
                                     WHERE id=101;
                                   (blocked by lock id=101)

SQL> UPDATE fyi_links 
  SET notes='Session 1' 
  WHERE id=110;
(blocked by lock on row id=110)

                                   ORA-00060: deadlock 
                                   detected while waiting 
                                   for resource
                                   (statement failed)

  1. What Is a Transaction?
  2. How To Start a New Transaction?
  3. How To End the Current Transaction?
  4. How To Create a Test Table for Transaction Testing?
  5. How To Commit the Current Transaction?
  6. How To Rollback the Current Transaction?
  7. What Happens to the Current Transaction If a DDL Statement Is Executed?
  8. What Happens to the Current Transaction If the Session Is Ended?
  9. What Happens to the Current Transaction If the Session Is Killed?
  10. How Does Oracle Handle Read Consistency?
  11. What Is a READ WRITE Transaction?
  12. What Is a READ ONLY Transaction?
  13. How To Set a Transaction To Be READ ONLY?
  14. What Are the Restrictions in a READ ONLY Transaction?
  15. What Are the General Rules on Data Consistency?
  16. What Are Transaction Isolation Levels Supported by Oracle?
  17. What Is a Data Lock?
  18. How Data Locks Are Respected?
  19. How To Experiment a Data Lock?
  20. How To View Existing Locks on the Database?
  21. What Is a Dead Lock?
  22. How Oracle Handles Dead Locks?

Oracle Tutorials:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...