ORA-01940 無法刪除當前已串連的使用者

來源:互聯網
上載者:User

ORA-01940 無法刪除當前已串連的使用者

 

今天在進行測試環境導資料的時候,需要記性drop user操作。在執行drop user的時候,提示:ORA-01940: cannot drop a user that is currently connected

 

 SQL> 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
----------------------------------------------------------------------------------------------------------
Oracle@oradb01 (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等等。測試環境還好,生產無小事。

https://www.bkjia.com/topicnews.aspx?tid=12

本文永久更新連結地址:https://www.bkjia.com/Linux/2018-03/151511.htm

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.