Monday, June 22, 2015

How to drop connected users in Oracle database

Solution 1:
sql>Shutdown immediate;
sql>startup restrict;
sql>drop user TEST cascade;
If you want to re-activate DB normally either reset the server or :
sql>Shutdown immediate;
sql>startup;

Solution 2: find the sessions for the users/schema , as a DBA use :
select sid,serial# from v$session where username = '<user_schema>'
Then kill them with :
 alter system kill session '<sid>,<serial#>'
Now Drop the user :  
drop user <user_schema_name> cascade;


Or: 
 select 'alter system kill session ''' || sid || ',' || serial# || ''';' from v$session where username = 'USER_SCHEMA';

Share this

0 Comment to "How to drop connected users in Oracle database"

Post a Comment