Re: How to know which row is locked ?

From: Martin Bronstein <martin.bronstein_at_trw.com>
Date: 1998/09/30
Message-ID: <3612AD0F.6EC56B98_at_trw.com>#1/1


I have a similar problem which I cannot completely solve. I have a SQL script that lists all tables that have row locks, who the user is, and how long it has been locked. I can also see users who are waiting on a locked row, and for how long. I can identify which row a user is waiting to be unlocked from the block, row, and file values returned by my script. But I cannot identify who locked a particular row because the block, row, and file values for locked rows are all zero.

column 'User' format a10
column 'Object' format a20
column 'Block' format 999999
column 'Row' format 9999
column 'File' format 9999
column 'Time' format 99999
column 'SID' format 999
column 'Serial #' format 99999
SELECT object_name "Object", username "User",
       row_wait_block# "Block", row_wait_row# "Row",
       row_wait_file# "File", ctime "Time",
       v$session.sid "SID", serial# "Serial #"
  FROM v$lock, v$session, all_objects
  WHERE v$lock.type = 'TM'
  AND v$lock.sid = v$session.sid
  AND id1 = object_id
UNION ALL
SELECT object_name "Object", username "User",
       row_wait_block# "Block", row_wait_row# "Row",
       row_wait_file# "File", last_call_et "Time",
       v$session.sid "SID", serial# "Serial #"
  FROM v$session, all_objects
  WHERE row_wait_obj# != -1
  AND row_wait_obj# = object_id
;

Martin Bronstein

Jean-Philippe Squelbut wrote:

> I don't really know how you tell your row is still locked !
>
> Guillaume MAISON a écrit dans le message <36124631.BF4F7193_at_easynet.fr>...
> >Hi all,
> >
> >here's my problem :
> >
> >in our application, we lock a row to prevent concurent access, and then
> >we process a few works.
> >At the end, the first row should still be locked.
> >
> >our problem is that this row is still locked, but a row from another
> >table is also locked.
> >
> >We'd like to know how to do to identify this second row and its datas ?
> >
> >If anyone has an answer, thanks in advance !
> >
> >Guillaume
Received on Wed Sep 30 1998 - 00:00:00 CEST

Original text of this message