select l.sid,s.serial#,s.username,s.terminal,s.program,
decode(l.type,'RW','RW - Row Wait Enqueue',
'TM','TM - DML Enqueue',
'TX','TX - Trans Enqueue',
'UL','UL - User',l.type||'System') res,
substr(t.name,1,10) tab,u.name owner,
l.id1,l.id2,
decode(l.lmode,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Shr Row Excl',
6,'Exclusive',null) lmode,
decode(l.request,1,'No Lock',
2,'Row Share',
3,'Row Excl',
4,'Share',
5,'Shr Row Excl',
6,'Exclusive',null) request
from v$lock l, v$session s,
sys.user$ u,sys.obj$ t
where l.sid = s.sid
and s.type != 'BACKGROUND'
and t.obj# = l.id1
and u.user# = t.owner#
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-619513/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/35489/viewspace-619513/
本文介绍了一种使用SQL查询来获取Oracle数据库中锁相关信息的方法。通过连接v$lock、v$sessions视图及sys.user$、sys.obj$表,可以详细了解等待锁的会话及其所涉及的对象信息。
269

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



