暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle ORA-04020: 从过程中撤销priv时检测到死锁

ASKTOM 2020-09-29
360

问题描述

嗨,汤姆,

尝试从同一过程内部撤消对过程的执行特权时,会发生死锁。
你能就这种行为提出建议吗:

create procedure test_proc 
as
begin
    execute immediate 'revoke execute on test_proc from some_user';
end;

exec test_proc;

Error starting at line : 7 in command -
BEGIN test_proc; END;
Error report -
ORA-04020: deadlock detected while trying to lock object TEST_PROC
ORA-06512: at "TEST_PROC", line 4
ORA-06512: at line 1
04020. 00000 -  "deadlock detected while trying to lock object %s%s%s%s%s"
*Cause:    While trying to lock a library object, a deadlock is detected.
*Action:   Retry the operation later.


谢谢!

专家解答

这样想:

想象你在开车。在这样做的同时,你决定取消一些司机对这辆车的驾驶特权。

请记住,这些驱动程序可能是一群有权访问 (角色) 的人。所以你可能会取消你自己的驾驶权限from the car you're driving!

听起来很冒险,对吧?

这与从过程中撤销访问权限相似。为了避免出现问题,在运行该过程的过程中,如何更改过程受到限制。

如果你看v $ session,同时调用这个过程,你会看到会话阻塞本身:

select sid, blocking_session
from   v$session 
where  username is not null
and    blocking_session is not null;

       SID BLOCKING_SESSION
---------- ----------------
       194              194

文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论