6

In Oracle 11g, is there a way to introduce subpartitions into an existing partitioned table?

I cannot seem to find a combination of EXCHANGE and SPLIT partition that does the right thing. SPLIT will split a partition into multiple partitions, not introduce subpartitions. Any suggestions?

I did find an existing post on partitioning an existing non-partitioned table by exchanging to a table with one partition and then using SPLIT, but can't figure out the equivalent process for subpartitions.

Paul White
95.3k30 gold badges439 silver badges689 bronze badges
asked Oct 29, 2013 at 16:06

2 Answers 2

6

A new subpartition can be added to the existing partitioned table using the following command:

ALTER TABLE PART_TEST
modify partition OCT19 
add subpartition OCT19AXCS 
values ('AXCS');
Paul White
95.3k30 gold badges439 silver badges689 bronze badges
answered Jan 28, 2014 at 12:55
1
  • Where have you mentioned the subpartition key? What if the subpartition is to be made on other column? Commented Mar 14, 2016 at 6:08
1

I think I figured it out but it's tedious, requiring two temp tables and has to be done one partition at a time. Is there a better way?

For each partition in original (source) table

  1. exchange partition to unpartitioned temp table (alter table source exchange partition X with table TEMP1)
  2. exchange temp table into a second temp table, partitioned by same key as the subpartitions in the target table, with a single default partition (alter table TEMP2 exchange partition Y with table TEMP1)
  3. exchange partitioned temp table into target table (alter table target exchange partition X with table TEMP2)
  4. target table now has partition X with subpartition Y - split subpartition Y into desired subpartitions (alter table target split subpartition Y ....)
answered Oct 29, 2013 at 17:15
3
  • 1
    Any thoughts about creating a new table with desired partitions/subpartitions and then migrating data from current to new? Commented Oct 30, 2013 at 12:30
  • yes, that is an obvious technique - but operationally more complex in terms of migration length and potential downtime. Commented Oct 30, 2013 at 13:30
  • 1
    You dont say why you are doing partitioning, but if it is to maintain historical data, you can implement new partitioning along with existing, go on migrating old data. When time comes, do the latest partitions, flip names, manage index/constraints/synonyms/grants etc and you are done. Thus you can reduce final downtime considerably. Of course this may not work in every environment and if you keep updating historical data. So, YMMV, but just wanted to point out that it is doable if your business process and environment supports it. Commented Oct 31, 2013 at 17:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.