Oracle中cannot drop a user that is currently connected

Cannot drop a user that is currently connected

SQL〉DROP USER USER1 CASCADE

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

Cannot delete because the current user is connected to the database

Solution:

1. Query the session process of this user,

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

 

       SID    SERIAL#
---------- ----------
        24      25341
        86      18117

 

2. End all sessions of this user

SQL>ALTER SYSTEM KILL SESSION '24,25341';

System altered.

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

System altered.

 

3. Delete user

SQL〉DROP USER USER1 CASCADE;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326777847&siteId=291194637