Oracle批量删除某一个用户的Session
比如说杀掉cyrole用户的所有连接----在p/lsql的测试窗口中执行:
declare
begin
for temp in (
select username,sid,serial# from v$session s
where s.USERNAME='CYROLE'
) loop
dbms_output.put_line('alter system kill session '''||to_char(temp.sid)||','||to_char(temp.serial#)||''';');
end loop;
end;
/
输出结果形式为:
alter system kill session '251,110';
alter system kill session '416,1396';
alter system kill session '485,623';
alter system kill session '557,877';
alter system kill session '572,223';
alter system kill session '416,1396';
alter system kill session '485,623';
alter system kill session '557,877';
alter system kill session '572,223';
然后拿着输出结果执行以下就Ok了,呵呵。