腳本殺用戶

connect system/qhdlgis@qhgis1;
declare
  cursor c is select sid,a.SERIAL# from v$session a where a.username='SDE' ;
begin
  for c1 in c loop
   begin 
   dbms_output.put_line('alter system kill session '||''''||c1.sid||','||c1.SERIAL#||'''');
   execute immediate 'alter system kill session '||''''||c1.sid||','||c1.SERIAL#||'''';
   exception when others then
     null;
   end;
  end loop;
end;
/

connect system/qhdlgis@qhgis2;
declare
  cursor c is select sid,a.SERIAL# from v$session a where a.username='SDE' ;
begin
  for c1 in c loop
   begin 
   dbms_output.put_line('alter system kill session '||''''||c1.sid||','||c1.SERIAL#||'''');
   execute immediate 'alter system kill session '||''''||c1.sid||','||c1.SERIAL#||'''';
   exception when others then
     null;
   end;
  end loop;
end;
/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章