Oracle 12c - drop table and all associated partitions

你说的曾经没有我的故事 提交于 2021-02-10 18:50:26

问题


I created table t1 in Oracle 12c. Table has data and it is partitioned on list partition and also has subpartitions.

Now I want to delete whole table and all associated partitions (and subpartitions).

Is this the right command to delete all?

DROP TABLE t1 PURGE; 

回答1:


When you run DROP then the table is removed entirely from database, i.e. the table does not exist anymore.

If you just want to remove all data from that table run

truncate table T1 drop storage;

You can also truncate single (sub-)partition if required.




回答2:


The syntax is right but not preferable,

just drop without purge so that whenever you need you could have it back, if your flashback option is enabled. If your database's flashback option is in charge, you could issue this command (provided you don't use purge):

SQL> DROP TABLE T1;
SQL> FLASHBACK TABLE T1 TO BEFORE DROP RENAME TO T1_ver_2;


来源:https://stackoverflow.com/questions/46833784/oracle-12c-drop-table-and-all-associated-partitions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!