Friday, 16 February 2018

ORA-01940 cannot drop a user that is currently connected

When I am trying to drop a user and I get the error "ORA-01940: cannot DROP a user that is currently logged in".

Cause: An attempt was made to drop a user that was currently logged in.

Action: Make sure the user is logged out, then re-execute the command.

Solution:-
select s.sid, s.serial#, s.status, p.spid
from v$session s, v$process p
where s.username = 'myuser'
and p.addr (+) = s.paddr;

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

Also, check that the user is not associated with any active jobs:

select job from dba_jobs where log_user='myuser';

Hope it works ! 

No comments:

Post a Comment