Re: Who is locking the row I want?

From: David Randolph - Shared Logic Inc. <sli_at_crash.cts.com>
Date: Thu, 5 May 1994 20:26:41 GMT
Message-ID: <CpCJGJ.JA1_at_crash.cts.com>


Doug Bitting (dbitting_at_us.oracle.com) wrote:

: >>>>> On Tue, 3 May 94 09:11:58 +0100, jna_at_astrakan.se (Johan Andersson)
: >>>>> said:
 

: Johan> How do I identify the session that holds a lock on a specific
: Johan> row in a table? Is it possible in Oracle7?
 

: Connecting to an Oracle 7.0.15 database, I can do the following:
 

: --- snip here ---
: SQLDBA> insert into scott.footest values (1);
: 1 row processed.
: SQLDBA> select osuser from v$session
: 2> where sid in
: 3> (select sid from v$lock
: 4> where id1 = (select object_id from dba_objects
: 5> where object_name = 'FOOTEST'
: 6> and owner = 'SCOTT'));
: OSUSER
: ----------
: dbitting
: 1 row selected.
: --- snip here ---
 

: In this particular example, I use "in" on line 2> because it's possible
: that more than one person could have a lock on the table footest.
 

: Hope this helps.
: --Doug
: --

Your SQL statement displays the users which have _any_ type of lock on the table, not just the users which have a particular record locked, which therefore doesn't answer the question. I'm also very interested to see if there is a way to find out which users have a particular record locked because this is easy to do with some PC databases, such as Paradox, but I've not found a solution to this either yet.

  • Dave R.
Received on Thu May 05 1994 - 22:26:41 CEST

Original text of this message