oracle exchange partition 1

oracle exchange partition

-- ORACLE partition swap
ALTER TABLE target_table
EXCHANGE PARTITION target_partition
WITH TABLE source_table;
/*
. source_table and target_table have the same structure 
	(columns, data types, respect constraints).
. indexes have to be rebuilt
*/

Here is what the above code is Doing:
1. Create a new table with the same structure as the original table.
2. Insert the data from the original table into the new table.
3. Drop the original table.
4. Rename the new table to the original table name.

Similar Posts