oracle drop table space

os: 7.6 hundreds
db: Oracle 19.3

If the table space is not empty, it can not be deleted, so when you delete the table space, you need to delete the relevant user, or move an object to a different table space
always forget grammar, record it.
It is strongly recommended to achieve sqlplus help drop tablespace

delete users

SQL> drop user user_name cascade;

Delete empty table space, but does not contain the physical files

SQL> drop tablespace tbs_name;

Delete non-empty table space, but does not contain the physical files

SQL> drop tablespace tbs_name including contents;

Delete empty table space contains the physical file

SQL> drop tablespace tbs_name including datafiles;

Delete non-empty table space contains the physical file

SQL> drop tablespace tbs_name including contents and datafiles;

If there are other tables in the tablespace foreign key constraint associated with other fields of the table according to the table space shall add CASCADE CONSTRAINTS

SQL> drop tablespace tbs_name including contents and datafiles cascade constraints;

Reference:
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/DROP-TABLESPACE.html#GUID-C91F3E94-4503-48DE-9BCA-42E495E6BE11

Guess you like

Origin blog.csdn.net/ctypyb2002/article/details/92657932