Rabu, 24 Juli 2013

ORA-01940 : Cannot Drop a User that is Currently Connected

SQL>drop user myuser cascade;
drop user username cascade

*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected



SQL>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;

SID           SERIAL# STATUS    SPID
----------   ----------    --------       ------------
159               29          INACTIVE 12349


SQL>alter system kill session '159,29';

System altered.

or

SQL>!kill -9 12349            - (kill the process in OS level)


SQL>drop user username cascade;


User dropped.