码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-09-29 13:15:31      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:

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

 

 

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.

 

此时删除成功

 

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

标签:

原文地址:http://www.cnblogs.com/binfoo/p/4845988.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!