Home  >  Article  >  Database  >  ORA-01940:无法删除当前已连接的用户

ORA-01940:无法删除当前已连接的用户

WBOY
WBOYOriginal
2016-06-07 17:46:011383browse

ORA-01940:无法删除当前已连接的用户

“ORA-01940:无法删除当前已连接的用户”错误的解决 当删除一个用户时,报 ORA-01940: 无法删除当前已连接的用户"的错误

解决方法:

1、查找会话

username,sid,serial# from v$session

---USERNAME       SID      SERIAL#

---MYNAME            9         476

 

2、强制关闭会话

alter system kill session'9,476'

3、然后再删除可以。

drop user MYNAME cascade

 


SQL> drop user a cascade;
drop user a cascade
*
ERROR 位于第 1 行:
ORA-01940: 无法删除当前已连接的用户

解决方法:

SQL> select username,sid,serial# from v$session;

USERNAME                              SID    SERIAL#
------------------------------ ---------- ----------
                                        1          1
                                        2          1
                                        3          1
                                        4          1
                                        5          1
                                        6          1
                                        7          1
SYS                                     8          3
A                                       9          4

已选择9行。

SQL> alter system kill session'9,4';

系统已更改。

SQL> drop user a cascade;//删除用户以及用户表空间下所有对象

用户已丢弃

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn