5

For past some time I have noticed that we get ORA-00054 error while trying to issue SELECT ... FOR UPDATE NOWAIT, during large number of concurrent updates to the db. This our development system and we really do not have any other user, or at least that is what we believe.

We have been through the logs of our application and it seems everything is in order; no threads are trying to update the same row.

How can I configure Oracle db to generate a log on which would let me know the user id which holds the lock when this error occurred?

4

3 回答 3

9

from here: ORA-00054: resource busy and acquire with NOWAIT specified

You can also look up the sql,username,machine,port information and get to the actual process which holds the connection

SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,S.USERNAME,
S.MACHINE,S.PORT , S.LOGON_TIME,SQ.SQL_FULLTEXT 
FROM V$LOCKED_OBJECT L, DBA_OBJECTS O, V$SESSION S, 
V$PROCESS P, V$SQL SQ 
WHERE L.OBJECT_ID = O.OBJECT_ID 
AND L.SESSION_ID = S.SID AND S.PADDR = P.ADDR 
AND S.SQL_ADDRESS = SQ.ADDRESS;
于 2012-08-10T03:24:27.667 回答
3

Remove the NOWAIT, and monitor DBA_BLOCKERS/DBA_WAITERS.

于 2012-04-30T08:12:54.937 回答
1

Kindly use

select * from v$locked_object 

for getting the lock information

Since it is development environment you can try the approach provided in the below link

https://forums.oracle.com/forums/thread.jspa?threadID=324530

A more comprehensive Approach is provided using v$lock at the below link

http://www.orafaq.com/node/854

于 2012-04-30T05:45:46.090 回答