Lock(三)查看是谁把表给锁了

查看是谁把表给锁了

select 
  se1.inst_id as 被阻塞的会话节点,
  se2.inst_id as 罪魁祸首节点,
  se1.sid as 被阻塞的会话ID,
  ob.object_name as 哪个表,
  se1.serial# as 被阻塞的会话序列号,
  se2.sid as  罪魁祸首会话ID,
  se2.serial# as  罪魁祸首会话序列号# , 
  se1.username as 被阻塞的用户,
  se2.username as 罪魁祸首名字,
  se1.blocking_instance,
  se1.final_blocking_instance blked_final_blocking_instance,        
  se1.final_blocking_session blked_final_blocking_session, 
  se1.event blked_event,
  se1.seconds_in_wait as 被阻塞的用户等待时间,
  se1."BLOCKING_SESSION_STATUS",
  se2.final_blocking_instance blking_final_blocking_instance,        
  se2.final_blocking_session blking_final_blocking_session, 
  se2.event blking_event
from 
  gv$session se1,  --被阻塞的会话
  gv$session se2,  --罪魁祸首
  dba_objects ob,  --
  gv$locked_object lck  --
where
  se1.blocking_session_status = 'VALID'
and
  se1.blocking_instance > 0
and 
  se1.blocking_session > 0
and 
  se1.blocking_session = se2.sid
and
  se1.sid = lck.session_id
and
  ob.object_id = lck.object_id;

 

posted @ 2017-11-30 11:28  gegeman  阅读(1087)  评论(0编辑  收藏  举报