在执行drop user的时候,提示报错信息:ORA-01940: cannot drop a user that is currently connected
SQL> drop user la; 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='LA'; USERNAME SID SERIAL# PADDR ------------------------------ ---------- ------------------------------------------------- LA 18 168 000000008D490130 SQL> select PROGRAM from v$process where addr='000000008D490130'; PROGRAM ---------------------------------------------------------------------------------------------------------- Oracle@oradb01 (DW00)
其次杀掉系统中的这个进程
SQL> alter system kill session '18,168'; System altered.
然后执行删除操作,即可完成
SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null; SQL> drop user ecity CASCADE; User dropped.
tips:问题解决,记得KILL进程前,先看看是啥进程,哪台机连过来的,能否KILL等等。避免杀掉其他进程
来自:https://www.cnblogs.com/lwlxqlccc/p/8694696.html