tags:

views:

3847

answers:

2

When I give the command to drop a user i.e. DROP USER 'username' cascade,

  1. Does it deletes all the tablespace and datafiles used by that particular user.

  2. If not, what is the command to delete all the tablespace / datafiles / disk space that were used by that particular user.

+4  A: 

After dropping the user, you need to, for each related tablespace, take it offline and drop it. For example if you had a user named 'SAMPLE' and two tablespaces called 'SAMPLE' and 'SAMPLE_INDEX', then you'd need to do the following:

DROP USER SAMPLE CASCADE;
ALTER TABLESPACE SAMPLE OFFLINE;
DROP TABLESPACE SAMPLE INCLUDING CONTENTS;
ALTER TABLESPACE SAMPLE_INDEX OFFLINE;
DROP TABLESPACE SAMPLE_INDEX INCLUDING CONTENTS;
Sliff
Thanks for your answer Sliff. I will try this out.But how can I find out which all tablspaces and datafiles are associated with a given user.
Sanjay Thakur
Firstly I'd suggest looking through the creation scripts for your database (if existent). Otherwise use Oracle Enterprise Manager as that will tell you which tablespaces particular tables, etc. are stored in.
Sliff
Thanks, I will check in Oracle Enterprise Manager.
Sanjay Thakur
A: 

nice one.very informative.

srikanthtechnologies

marlynn