sqlplus "sys/password@azuay as sysdba"
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;
/
最好在cmd命令下进入数据库然后用下列语句执行
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;
/
执行完成之后则该用户被终止连接