Ask the Expert

Can't drop user connected to database

I have problem dropping a user from the database.

drop user "USERA" cascade;

This gives me the following error:

ORA-01940: cannot drop a user that is currently connected

But when I check the v$session table, I cannot see USERA connected to the database.

    Requires Free Membership to View

It could be that USERA is connecting right after you query V$SESSION and then logging off before you query V$SESSION again. I would lock the account so the user can no longer log in. Use the following command:
ALTER USER usera ACCOUNT LOCK;

Come back in a day and the user will not be logged in, most likely. You should be able to drop the user. Or wait until you bounce the database and then drop the user shortly after startup.

I have to add that if USERA is connected to the database, then dropping that user will break someone's application. Make sure you really want to do this before proceeding.

This was first published in July 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: