Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 17:29:12
Original
1275 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!