批量删除oracle 会话

declare cursor mycur is   
select b.sid,b.serial# from v$session b  where b.MACHINE = 'svctag-79bp23x' and b.STATUS = 'INACTIVE';
  
  
begin  
  for cur in mycur  
    loop    
     execute immediate ( 'alter system  kill session  '''||cur.sid || ','|| cur.SERIAL# ||''' ');  
     end loop;  
  
end;  

根据计算机名批量删除会话,具体删除条件可以自行调整上面的查询语句。

你可能感兴趣的:(oracle)