如何识别锁定的 PL/SQL 包(Oracle 10.0.4.2)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3010906/
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 to identify what locked PL/SQL package (Oracle 10.0.4.2)?
提问by Roman Kagan
I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This happen on (Oracle 10.2.0.4). Greatly appreciate for your help.
我试图重新编译 PL/SQL 包,但无济于事。因为某些东西获得了锁并且很长时间没有释放。一旦我终止了所有会话,我就能够重新编译但遇到相同的行为(即锁定的包),我想知道有哪些工具可以用来识别哪些可以获取它并且永远不会释放它?这发生在(Oracle 10.2.0.4)上。非常感谢您的帮助。
回答by Gary Myers
I think you mean 10.2.0.4, as there isn't a 10.0.x.x version series.
我认为您的意思是 10.2.0.4,因为没有 10.0.xx 版本系列。
select * from v$locked_object lo join dba_objects o on lo.object_id = o.object_id
where o.object_name = 'xxPACKAGE NAMExx' and o.object_type = 'PACKAGE';
回答by Alex S
select l.session_id, l.owner, l.name, l.type, inst_id, sql_id
, a.sql_fulltext
, 'alter system disconnect session '''||s.sid||','||s.serial#||',@'||inst_id||''' immediate' ddl
from dba_ddl_locks l
join gv$session s on s.sid = l.session_id
join gv$sqlarea a using(inst_id, sql_id)
where l.name = 'OBJECT_NAME'
;