Oracle中删除用户和表空间的常见问题(比如:ORA-01940无法删除当前已连接用户的解决方案)(二)
kill session '''||v_info.sid||','||v_info.serial#||''' immediate';
execute immediate sql_mgr;
dbms_output.put_line('All the sessions of '||v_name||' have been killed');
end loop;
close loguser;
if i=0 then
raise_application_error(-20004,'The user '||v_name||' is not login the database currently!');
end if;
exception
when no_data_found then
raise_application_error(-20004,'The user '||v_name||' is not login the database currently!');
end;
/
调用上面存储过程,终止用户所有进程的方法如下:
SQL> execute kill_user('user_name');