2.创建测试表
drop table t_temp purge;
drop table t_part_list purge;
create table t_temp as select 1 id, t.owner,t.OBJECT_NAME,t.OBJECT_ID,t.OBJECT_TYPE from dba_objects t;
create table t_part_list (id number,owner varchar2(20),object_name varchar2(40),object_id number,object_type varchar2(20))
partition by list (id)
(partition p1 values(1) tablespace tbs1,
partition p2 values(2) tablespace tbs2
);
3.查看表数据
SQL> select count(*) from t_part_list;
COUNT(*)
---------
0
SQL> select count(*) from t_temp;
COUNT(*)
----------
80905
4.交换数据
alter table t_part_list exchange partition p1 with table t_temp;
或
alter table t_part_list exchange partition p1 with table t_temp without validation;--不再验证数据有效性
5.查看表数据
SQL> select count(*) from t_part_list;
COUNT(*)
----------
80905
SQL> select count(*) from t_part_list partition(p1);
COUNT(*)
----------
80905
SQL> select count(*) from t_temp;