Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find what is causing ORA-00054?

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?

like image 583
AppleGrew Avatar asked Apr 30 '12 04:04

AppleGrew


3 Answers

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;
like image 77
Abey Tom Avatar answered Oct 08 '22 08:10

Abey Tom


Remove the NOWAIT, and monitor DBA_BLOCKERS/DBA_WAITERS.

like image 26
David Aldridge Avatar answered Oct 08 '22 06:10

David Aldridge


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

like image 24
psaraj12 Avatar answered Oct 08 '22 06:10

psaraj12