12-09-03, 09:04 #1Registered User
- Join Date
- Aug 2002
Unanswered: locking order - is that managed my a queue
I would like to know if there is an order queue when requesting a resource lock.
In order to check I have opened 5 sqlplus windows and try to lock a table using "lock table t1 in EXCLUSIVE mode;" in each window, only the first succeeded, the others were in wait mode (of-course).
then I have started to issue "rollback;" for each window, the order of the sessions locking the table was the same as issued at the beginning.
My questions are:
Is that guarantied or just a coincidence?
Does Oracle manage some sort of queue of request for locking a specific resource?, if yes where can I view this queue? if not, what is the mechanism algorithm, random? other?
12-09-03, 13:32 #2Registered User
- Join Date
- Apr 2003
- Minneapolis, MN
It is guarenteed that all transactions requesting exclusive lock on the same object are executed in order they arrive. Because they, first, all are placed in a Queue in Data Dictionary. As a Queue works on the First come First Serves bases, these all transactions are executed in iorder.
For more information on this topic, Please read a following book;
Oracle8i Internal Services for Waits, Latches, Locks, and memory
By Steve Adams which can be available at
MS Computer Science
OCP DBA 9i/8i