Search This Blog

Total Pageviews

Thursday, 22 September 2016

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



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


SYS@mactlm1> drop user anuj cascade ;
drop user anuj cascade ;
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected


find and kill session ...


set linesize 200 pagesize 200
col kill for a70
select username ,'alter system kill Session ' || ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||''''||' immediate;' kill from gv$session s
where username = '&USERNAME' ;

Now drop the user 

drop user anuj cascade;

Oracle DBA

anuj blog Archive