欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Oracle中cannot drop a user that is currently connected

程序员文章站 2022-03-26 08:49:54
...

Cannot drop a user that is currently connected

SQL〉DROP USER USER1 CASCADE

ERROR:ORA-01940: cannot drop a user that is currently connected

由于当前用户正连接到数据库,所以无法删除

解决办法:

1、查询此用户的会话进程,

SQL〉SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='USER1';

 

       SID    SERIAL#
---------- ----------
        24      25341
        86      18117

 

2、结束此用户的所有会话

SQL>ALTER SYSTEM KILL SESSION '24,25341';

System altered.

SQL>ALTER SYSTEM KILL SESSION '86,18117';

System altered.

 

3、删除用户

SQL〉DROP USER USER1 CASCADE;

相关标签: orcle sql