分类: Oracle
删除用户ORA-01940: cannot drop a user that is currently connected解决方法 - Oracle

出现场景:Oracle删除用户时报错

SQL〉DROP USER USERXXXX CASCADE

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

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

解决办法:

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

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

SID SERIAL#
---------- ----------
98 27341
23 18117

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

SQL>ALTER SYSTEM KILL SESSION '98,27341';

System altered.

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

System altered.

如果没有发现会话.要就要看是不是自己当前有没有使用这个用户.

3、删除用户

SQL〉DROP USER USERXXXX CASCADE;

相关博文:

仅有 1 条评论
  1. Chase R

    Hi Dbanote Com team, <br> <br>I came across your website and wanted to ask, do you reach out to potential customers, or do most find you first? <br> <br>I help businesses use website contact forms to start conversations with potential customers who haven’t found them yet. <br> <br>See how you can put your offer in front of more businesses at https://zeroshift.live/ <br> <br>See you there! <br> <br>Chase <br> <br>Opt-out here: https://gsa-domain-opt-out.iamreena.chatgpt.site/
    Chase R 回复
发表评论
💡 支持 Markdown 语法