Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> DESPERATE!! : Determining who locked a record?

DESPERATE!! : Determining who locked a record?

From: Paul <aspscott_at_tcp.co.uk>
Date: Fri, 08 Jan 1999 02:04:37 GMT
Message-ID: <369562f2.3573315@news.tcp.co.uk>


How do I determine who locked a record in Oracle 8?

In a Client/Server DB that I'm working on whenever the user edits/deletes a record an automatic record lock is implemented prior to editing via a
select
  1
from
  MyTable
where
  Primary_Key = Record_PK
for update nowait

I can detect that a record is already locked if a second user tries to edit the same record, but I need to know which Oracle User and OS User name so I can show
"Record is currently locked by <OracleUser> on machine <OSUserName>" The information I need is in the v$_locked_objects view, but how can I find out which lock in the view caused the second user to be refused?

My problem is the second user cannot implement a lock (because the first has already) so I cannot perform a join to get the information, and anyway several users may have several records locked in the same table so object_id (i.e. the table) is simply not unique enough to get the information I need. Also my Client front-end doesn't know which table it's trying to lock as scripts are transparently being sent directly to the Oracle server.

Is there anywhere in Oracle (views/logs) etc which can be queried to give me the information I need? I really need help as my deadlines are drawing in, and my spec says locking identification must be implemented.

Please help
Paul
aspscott_at_tcp.co.uk
^^please remove 'as' anti-spam prefix to contact me Received on Thu Jan 07 1999 - 20:04:37 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US