|
本帖最后由 jiawang 于 2018-1-17 16:20 编辑
删除用户的时候报如下错误
SQL> drop user test cascade;
drop user test cascade
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
报错信息:该用户有连接,不能删除,我把我自己连接的Oracle Develop客户端断开了连接,再次执行,还是报相同的错误。
1、查询test用户的连接状况:
SQL> select username,sid,serial# from v$session where username='TEST';
USERNAME SID SERIAL#
------------------------------ ---------- ----------
TEST 22 3
TEST 43 5
TEST 45 25
2、把相关的session连接删掉:
SQL>alter system kill session '22,3';
System altered.
SQL>alter system kill session '43,5';
System altered.
SQL>alter system kill session '45,25';
System altered.
3、查询session连接的状态
SQL> select username,sid,serial#,status from v$session where username='TEST';
USERNAME SID SERIAL# STATUS
-------------------------- ---------- ---------- --------
TEST 22 3 KILLED
TEST 43 5 KILLED
TEST 45 25 KILLED
4、再次执行删除test用户就可以删除成功了
SQL> drop user test cascade;
User dropped.
|
|