oracle 如何找到导致 ORA-00054 的原因?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10378651/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I find what is causing ORA-00054?
提问by AppleGrew
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.
在过去的一段时间里,我注意到在对数据库进行大量并发更新期间,我们ORA-00054
在尝试发出时出错SELECT ... FOR UPDATE NOWAIT
。这是我们的开发系统,我们真的没有任何其他用户,或者至少我们是这么认为的。
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?
如何配置 Oracle db 以生成一个日志,以便在发生此错误时让我知道持有锁的用户 ID?
回答by Abey Tom
from here: ORA-00054: resource busy and acquire with NOWAIT specified
从这里开始:ORA-00054: 资源繁忙并使用指定的 NOWAIT 获取
You can also look up the sql,username,machine,port information and get to the actual process which holds the connection
您还可以查找 sql、用户名、机器、端口信息并获得持有连接的实际进程
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;
回答by David Aldridge
Remove the NOWAIT, and monitor DBA_BLOCKERS/DBA_WAITERS.
删除NOWAIT,并监视DBA_BLOCKERS/DBA_WAITERS。
回答by psaraj12
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
https://forums.oracle.com/forums/thread.jspa?threadID=324530
A more comprehensive Approach is provided using v$lock at the below link
使用以下链接中的 v$lock 提供了更全面的方法