虚拟化容器,大数据,DBA,中间件,监控。

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

04 07月
作者:admin|分类:DBA运维

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


  当我们删除某个用户与用户所有对象时,如果用户正当前有连接数据库,则会报错:

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.

    再执行dropuser操作便可成功:

SQL>  drop user fc cascade;
User dropped.

浏览1808 评论0
返回
目录
返回
首页
Oracle用户多个表空间权限配置与数据表指定存放表空间 drop user和drop user cascade的区别