Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Removing data from partitioned tables

VictorDimisichOct 21 2014 — edited Oct 22 2014

Hello,

Oracle version 11.2.0.3.0, running on Enterprise Linux.

I need to remove all data from two large tables (several hundred million rows in each) that are partitioned.

1) Table1 is a ranged partition table on a DATE column

2) Table2 is a reference partition table; the partitioning is referenced on a Foreign Key relationship to Table1 (column: Table1.Primary Key)

As I have no need for the data but want to keep the table structure, I'd ideally like to remove the partitions at the same time as removing the data, so that the 2 tables end up unpartitioned and empty.

Additionally, Table1 has some partitioned indexes that I'd like to be rebuilt as non-partitioned indexes (since Table1 will be empty).

I thought I'd start off by dropping all of Table1's partitions (via 'ALTER TABLE Table1 DROP PARTITION partition_name') but when the script got to the last partition, I got this error message:

ORA-14083: cannot drop the only partition of a partitioned table

ORA-06512: at "SYS.DROP_PARTITIONS", line 46

Could anyone advise as to the best approach for what I would like to achieve with respect to the two tables? Would dropping the two tables and then recreating them without partitions be the easiest way?

Thanks in advance for any guidance.

This post has been answered by unknown-7404 on Oct 21 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2014
Added on Oct 21 2014
3 comments
1,689 views