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

How to drop the user who is connected to database by force

Normally if you try to drop the user by using the sqlplus, it shows the below error:

SQL> drop user mir cascade;

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

If you are sure to drop this user, Verify by yourself & crosscheck with assign developer users.

Once confirm, Fallow below procedure

Syntax: Find the session for the user/schema

select sid,serial# from v$session where username = '<user_schema>';

Example:

SQL> select sid,serial# from v$session where username = 'MIR';

       SID    SERIAL#
---------- ----------
        41      13745

Syntax: To kill the user session

alter system kill session '<sid>,<serial#>';

Example:

SQL> alter system kill session ’41,13745’;
System altered.

Now Drop the user:

SQL> drop user  mir cascade;
User dropped.

-------------------------------------Hence Drop use successfully------------------------------------------------




Comments

Popular posts from this blog

ORA-01110: data file 1: '/oradata/datafiles/system01.dbf'

Expdp from Higher version 12c (12.1.0.2) to lower version 11g (11.2.0.4)

Solutions: error while starting of Oracle Single instance ASM Database