Oracle杀锁

declare cursor mycur is   
select b.sid,b.serial#   
  from v$locked_object a,v$session b   
  where a.session_id = b.sid group by b.sid,b.serial#;   
   
begin   
  for cur in mycur   
    loop     
     execute immediate ( 'alter system  kill session  '''||cur.sid || ','|| cur.SERIAL# ||''' ');   
     end loop;   
end;

 

posted @ 2020-11-25 21:23  韩梦芫  阅读(131)  评论(0编辑  收藏  举报