oracle 锁查询

--查询用户的对象持有的锁 'SINOLIFE_DEV'为示例的用户名

select dbl.lock_type,
       dbl.mode_held,
       dbl.blocking_others,
       dbo.OBJECT_NAME,
       dbo.OBJECT_TYPE
  from dba_locks dbl, v$session v, dba_objects dbo
 where v.USERNAME = 'SINOLIFE_DEV'
   and dbl.session_id = v.SID
   and dbo.OBJECT_ID = dbl.lock_id1

--查看用户的会话是否被挂起

select d.session_id,
       d.lock_type,
       d.mode_requested,
       d.mode_held,
       d.blocking_others
  from dba_locks d, v$session v
 where v.USERNAME = 'SINOLIFE_DEV'
   and v.SID = d.session_id

posted on 2011-04-12 10:52  CodeFarmer  阅读(248)  评论(0编辑  收藏  举报

导航