Oracle Partition - Partition Exchange (between tables)

Card Puncher Data Processing

About

Partition Exchange permits to exchange partition between tables.

After the EXCHANGE PARTITION command is executed, the partition is empty and you can drop it

The data does not physically move from the partition to the new table. This exchange partition statement merely updates the data dictionary to reset a pointer from the partition to the table and vice versa. Because there is no physical movement of data, this exchange does not generate redo and undo, making it faster and far less likely to impact performance than traditional data-movement approaches such as INSERT.

Example

  • Create an interim table that is almost identical in structure to your original table, except that it is not partitioned:
create table trans_y05q1 as
select * from trans
where 1=2;

This creates an empty unpartitioned table TRANS_Y05Q1, whose structure is identical to that of TRANS. The 1=2 clause returns false, so no rows of the TRANS table are transferred.

  • Exchange the contents of the partition with this new table:
alter table trans 
   EXCHANGE partition y05q1 
   with table trans_y05q1;

This operation makes the data inside the Y05Q1 partition appear inside the TRANS_Y05Q1 table and empties the partition.

  • Drop the partition

After the EXCHANGE PARTITION command is executed, the partition is empty and you can drop it.

  • Transport the interim table. After the table is created, you can transport it out of the database and archive it for future use.





Discover More
Card Puncher Data Processing
Oracle - Partitions (Table and Indexes)

partition in Oracle. Partitioning enables you to store one logical object – a table or index – transparently in several independent segments. Partitioning can provide great performance improvements...
Card Puncher Data Processing
Oracle Partition - Data Load

Data Loading with partitions. Taking advantage of partitioning for fact tables reduces index and statistics maintenance time during ETL processes. Because the majority of inserts and updates impact...
Card Puncher Data Processing
Oracle Partition - Drop a partition (instead of records)

The conventional method is to delete the records, but deletion causes undo and redo information to be generated, which impacts database performance. This can also be a very time-consuming operation, depending...
Card Puncher Data Processing
Oracle Partition - Index (Local, Global)

You can create two types of indexes on partitioned tables: Usable: The index is partitioned in exactly the same way as the base table. For instance, you can create a local index on the...



Share this page:
Follow us:
Task Runner