Re: Where does Oracle store it's locks ?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/11/26
Message-ID: <3298e5e0.835371_at_dcsun4>#1/1


On 24 Nov 1996 21:56:46 GMT, "Michael Agbaglo" <byteshif_at_cs.tu-berlin.de> wrote:

>
>
>Jonathan Lewis <ora_mail_at_jlcomp.demon.co.uk> schrieb im Beitrag
><3298A554.54E0_at_jlcomp.demon.co.uk>...
>> Michael Agbaglo wrote:
>> >
>> > How can I determine which rows are locked ?
>> > Don't want to do a lock attempt on each row. Is there a system table
 where
>> > I can retrieve these data from ?
>>
>>
>> Row locks are stored as flags on the rows themselves, so the only
>> way to find locked rows is the one you have identified.
>>
>
>If so, what the table V$LOCK good for - and how does oracle access this
>flag (in the method described above) ?
>

v$lock shows aggregate type locks (eg: table X has a lock on it somewhere, I am waiting for a row in table X.). To discover if a row you might be interested in locking yourself is locked, you must use SELECT * FROM T WHERE .... for update nowait. that will not only do the check but lock it for you.

If you don't need to lock the row, just read it. You won't block.

Using a two table solution (read one to see if row Y was locked, get row Y) would always lead to the potential for blocks anyhow in a multi-user database since between the time you read a row to see if Y is locked and actually go after Y, someone else could have locked Y on you.

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Tue Nov 26 1996 - 00:00:00 CET

Original text of this message