Home >Database >Mysql Tutorial >ORA-01940: cannot drop a user that is currently connecte

ORA-01940: cannot drop a user that is currently connecte

WBOY
WBOYOriginal
2016-06-07 17:29:121325browse

ORA-01940: cannot drop a user that is currently connecte

当我们删除某个用户时,如果要删除的用户当前正连接Oracle数据库,则会报错:

SQL> conn /as sysdba
Connected.

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

    通过v$session视图查出要删除的用户当前session信息,然后kill掉该用户session连接:

SQL> select sid,serial# from v$session where username='FC';
      SID    SERIAL#

---------- ----------

      150      9019
SQL> alter system kill session '150,9019';
System altered.

    再执行drop user操作便可成功:

SQL>  drop user fc cascade;
User dropped.

 

linux

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