how to overcome Oracle Dead lock error ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mohan_seenippandian
Posted On:   Wednesday, November 5, 2003 04:28 PM

			

I am using Staless Session beans with JDBC Code to interact with

Oracle Database, all the transaction issues are taken care by

Custom coding.Everything goes well, however when multiple users try to update

the same table at same time , DB Dead lock (ORA-00060) occurs

Can anyone guide me to overcome this problem.



Mohan S


Re: how to overcome Oracle Dead lock error ?

Posted By:   Nick_Maiorano  
Posted On:   Wednesday, November 5, 2003 06:49 PM

Mohan,



Deadlocks can be occur when you are inconsistent in the way you access 2 related tables. Consider this:


1. methodA() reads tableA and then tableB. Each table is accessed with a read/write lock.

2. methodB() reads tableB and then tableA. Again each table is accessed with a read/write lock.



If 2 concurrent threads call these methods simultaneously, there will be a deadlock as both threads will require the other to finish before proceding since they have read/write locks. As a general rule, you should always access 2 related tables in the same order. If both methods always access tableA first then tableB second, there will never be a deadlock.



Deadlocks can also occur if you lock more than one table within a transaction. As a general rule, you should consistently use the same table for locking and lock only 1 table. The code above should only lock tableA and access it first.

About | Sitemap | Contact