How to delete a user in Oracle 10 including all it

2019-03-09 16:24发布

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.

标签: oracle10g
3条回答
【Aperson】
2楼-- · 2019-03-09 16:47

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;
查看更多
孤傲高冷的网名
3楼-- · 2019-03-09 16:54

You can check which table space is used by which user with the following query.

SELECT USERNAME, DEFAULT_TABLESPACE FROM DBA_USERS;

You can also see the list of table spaces by looking at the following tables

DBA_TABLESPACES
USER_TABLESPACES
查看更多
甜甜的少女心
4楼-- · 2019-03-09 16:56
DROP USER---->
DROP USER USER_NAME CASCADE;
DROP TABLESPACE---->
DROP TABLESPACE TABLESPACE_NAME INCLUDING CONTENTS AND DATAFILES;
查看更多
登录 后发表回答