Oracle查询锁表的SQL语句

select a.sid "会话ID",
       a.serial# "会话序列号",
       c.object_name "被锁的表名",
       a.machine "锁表的机器名",
       'alter system kill session ' || '''' || a.sid || ',' || a.serial# ||
       ''' ;' "KILL_SQL",
       a.*
  from v$session       a,
       v$locked_object b,
       dba_objects     c,
       v$bgprocess     d,
       v$process       e
 where a.sid = b.session_id
   and b.object_id = c.object_id
   and a.paddr = e.addr
   and a.paddr = d.paddr(+);

猜你喜欢

转载自fanjf.iteye.com/blog/2007028