在執行drop user的時候,提示報錯信息:ORA-01940: cannot drop a user that is currently connectedsession
SQL> drop user ecity ; ERROR at line 1: ORA-01940: cannot drop a user that is currently connected
形成這個問題的緣由是很明顯的,有用戶在鏈接,不容許drop掉該user。spa
解決方案:code
首先查詢一下數據中有沒有用戶在使用blog
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 ---------------------------------------------------------------------------------------------------------- Oracle@oradb01 (DW00)
其次殺掉系統中的這個進程進程
SQL> alter system kill session '634,7'; System altered.
而後執行刪除操做,便可完成ci
SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null; SQL> drop user ecity CASCADE; User dropped.
問題解決,記得KILL進程前,先看看是啥進程,哪臺機連過來的,可否KILL等等。避免殺掉其餘進程it