ITPub博客

首页 > IT职业 > IT职场 > V$LOCK vs DBA_DML_LOCK

V$LOCK vs DBA_DML_LOCK

原创 IT职场 作者:gjfb68 时间:2011-03-16 11:27:18 0 删除 编辑

Get current locks:

SQL> select s.username "Session User",
l.sid "Lock Session",
l.type "Lock Type",
DECODE(l.lmode, 0, 'None', 1, 'Null', 2, 'Row Share', 3, 'Row Excl.', 4,
'Share', 5, 'S/Row Excl.', 6, 'Exclusive', LTRIM(TO_CHAR(Lmode,'990')))
"Lock Mode",
DECODE(l.Request, 0, 'None', 1, 'Null', 2, 'Row Share', 3, 'Row Excl.', 4,
'Share', 5, 'S/Row Excl.', 6, 'Exclusive', LTRIM(TO_CHAR(l.Request, '990')))
"Request",
l.Id1, l.Id2,
d.owner||'.'||d.object_name||'.'||d.subobject_name "Object",
d.object_type "Object Type"
from v$session s, v$lock l, dba_objects d
where (s.sid = l.sid) and l.Id1=d.object_id;


A better way to check the locks:

SQL> select name, mode_held from dba_dml_locks;

NAME MODE_HELD
------------------------------ -------------
TEST_CLOB_SHRINK Row-X (SX)
TEST_CLOB_SHRINK Exclusive

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/17168579/viewspace-1047324/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-08-12

  • 博文量
    4
  • 访问量
    8375