How to detach a partition from a table and attach it to another in oracle?

走远了吗. 提交于 2019-12-03 17:37:08
alter table exchange partition 

is the answer. This command exange the segment of a partition with the segment of a table. It is at light speed because it does only some reference interchages. So, you need some temp tables, because AFAIK you can't exchange them directly.

Something like:

create table tmp_table(same columns);
Add partition p_2011 in table ARCH_TABLE;

ALTER TABLE CURR_TABLE EXCHANGE PARTITION P_2011 WITH TABLE tmp_table;
ALTER TABLE ARCH_TABLE EXCHANGE PARTITION P_2011 WITH TABLE tmp_table;

Please test test your code before run.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!