Monday, August 13, 2007

oracle 'drop connected user'

scott@ORA92> drop user SHAMBHU;
drop user sunil
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected


scott@ORA92> select sid, serial# from v$session where username = 'SHAMBHU';

SID SERIAL#
---------- ----------
11 16

scott@ORA92> alter system kill session '11,16';

System altered.

scott@ORA92> drop user SHAMBHU;

User dropped.

scott@ORA92> select username from dba_users
2 where username = 'SHAMBHU'
3 /

no rows selected

2 comments:

Nedal said...

this is very beneficial.. u saved me.. thnx a lot

Mike Laramie said...

Great help, thanks!