ORA-01940: cannot drop a user that is currently connected解决方法

我们在删除数据库用户时候会碰到如下错误

 

 

SQL> DROP USER sys_xj cascade;
DROP USER sys_xj cascade
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

解决方法:

 

1.查询出还在连接的此用户会话进程

 

SQL> SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='SYS_XJ'
2 ;

SID SERIAL#
---------- ----------
452 8801
474 1523

 

2.结束此用户所有会话

 

SQL> ALTER SYSTEM KILL SESSION '452,8801';

System altered.

SQL> ALTER SYSTEM KILL SESSION '474,1523';

System altered.

 

3.删除用户

SQL> DROP USER sys_xj cascade;

User dropped.

 

此时删除成功

 

posted @ 2015-09-29 12:04  binfoo  阅读(1215)  评论(0编辑  收藏  举报