Skip to Main Content
  • Questions
  • Merging Partitions Of Two Different Tables

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Shibaji.

Asked: March 21, 2017 - 4:53 pm UTC

Last updated: March 23, 2017 - 3:47 am UTC

Version: 11G

Viewed 1000+ times

You Asked

Hi,

Suppose i have a table A in which there is a varchar2(200) and a DATE column. I have created a range partition on the date column.I have another table B in same table space and in same database with similar structure. Is there any way by which we can exchange the partition of table A with Table B in such a way that the data from table A will be appended with the data of Table B , instead of replacing all the data in Table B.

and Connor said...

In the current versions of Oracle, you limits of EXCHANGE partition are within the same table.

But you could do it with a 2 step approach

1) exchange table A partition P out into its own standalone table S
2) exchange S with table B partition P1.

and you're done.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Follow up

Gh.., March 22, 2017 - 7:06 pm UTC

What is you opinion :

If big table say many millions od rows .Use exchange as you suggest above.

If small tables use a regular staging area ed. Insert..Select.

Plesae elaborate.


Connor McDonald
March 23, 2017 - 3:47 am UTC

Do whatever works easiest and best for you.

I hate "rules"...I prefer to test options, weigh pros and cons of each up against my business requirements, and work from that.