select /*+ rule */
s.username,
decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', null) lock_level,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#,
s.terminal,
s.machine,
s.program,
s.osuser
from v$session s, v$lock l, dba_objects o
where l.sid = s.sid
and l.id1 = o.object_id(+)
and s.username is not null
and object_name is not null
and decode(l.type, 'TM', 'TABLE LOCK', 'TX', /*'ROW LOCK',*/ null) is not null;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10359218/viewspace-677407/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10359218/viewspace-677407/
本文提供了一个Oracle数据库中用于查询锁定信息的SQL语句。通过连接v$sessions、v$lock和dba_objects视图,可以获取到当前会话的用户名、锁级别、对象所有者等详细信息。

被折叠的 条评论
为什么被折叠?



