Joe
Joe

Reputation: 13111

Oracle 12c - drop table and all associated partitions

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; 

Upvotes: 2

Views: 3391

Answers (2)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59476

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.

Upvotes: 3

Barbaros Özhan
Barbaros Özhan

Reputation: 65313

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;

Upvotes: 3

Related Questions