ORA-01940 无法删除当前已连接的用户
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORA-01940 无法删除当前已连接的用户相关的知识,希望对你有一定的参考价值。
今天在进行测试环境导数据的时候,需要记性drop user操作。在执行drop user的时候,提示:ORA-01940: cannot drop a user that is currently connectedSQL> drop user ecity ; drop user ecity * ERROR at line 1: ORA-01940: cannot drop a user that is currently connected
问题很明显,有用户在连接,不允许drop掉该user。
select username,sid,serial#,paddr from v$session where username='ECITY'; USERNAME SID SERIAL# PADDR ------------------------------ ---------- ------------------------------------------------- ECITY 634 7 00000000C028D198 SQL> select PROGRAM from v$process where addr='00000000C028D198'; PROGRAM ---------------------------------------------------------------------------------------------------------- [email protected] (DW00) SQL> SQL> alter system kill session '634,7'; System altered. SQL> SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null; SQL> drop user ecity CASCADE; User dropped. SQL>
问题解决,记得KILL进程前,先看看是啥进程,哪台机连过来的,能否KILL等等。测试环境还好,生产无小事。
以上是关于ORA-01940 无法删除当前已连接的用户的主要内容,如果未能解决你的问题,请参考以下文章
删除oracle用户报ORA-01940: cannot drop a user that is current
ORA-01940: cannot drop a user that is currently connected 问题解析
ORA-01940: cannot drop a user that is currently