How to delete a user in Oracle 10 including all it's tablespace and datafiles

前端 未结 3 1117
迷失自我
迷失自我 2021-01-31 20:45

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.

3条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 20:58

    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;
    

提交回复
热议问题