if the user reconnects automatically you may also need to lock the account
alter user THE_USER account lock;
then disconnect the user, then drop the user
Main Topics
Browse All Topicsi have a 11g oracle database. I want to drop a schema, but one user is still connected, so i couldnt drop the schema. how could i disable the user and after disconnect the user from the schema in sql plus?
or are there other options how i could drop a schema with connected users?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
To find the sessions
select sid,serial# from v$session where username = '<your_schema>'
Then kill them with
alter system kill session '<sid>,<serial#>';
A query that produces ready-built kill-statements could be
select 'alter system kill session ''' || sid || ',' || serial# || ''';' from v$session where username = '<your_schema>'
This will return one kill statement per session for that user
alter system kill session '375,64855';
alter system kill session '346,53146';
You got good advices.
I also experience such problems.
Alternative solution is to disconnect and to drop the schema in the same program.
In many cases the application will not be able to connect so fast:
DECLARE
v_sid number;
v_serial# number;
v_kill VARCHAR2(200);
BEGIN
SELECT sid, serial# INTO v_sid, v_serial# FROM v$session
WHERE username = 'MY_USER';
v_kill := 'alter system kill session ''' || v_sid || ',' || v_serial# || '''' || ' IMMEDIATE';
dbms_output.put_line(v_kil
execute immediate v_kill;
v_kill := 'alter system kill session ''' || v_sid || ',' || v_serial# || '''' || ' IMMEDIATE';
v_kill := 'drop user ' || 'MY_USER|| ' cascade';
dbms_output.put_line(v_kil
execute immediate v_kill;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Erro
dbms_output.put_line(subst
END;
Business Accounts
Answer for Membership
by: sdstuberPosted on 2009-11-04 at 04:45:38ID: 25738712
you will have to end the user's session first
lookup the sid and serial# for the user from v$session
SELECT sid, serial# FROM v$session
where username = 'THE_USER'
then using those values, plug them in to the string below
alter system disconnect session 'sid , serial#' immediate