6、将源表转换成分区表
| EXEC DBMS_REDEFINITION.FINISH_REDEF_TABLE(UNAME=>'LI',ORIG_TABLE=>'p_table',INT_TABLE=>'p_partion_table'); |
7、查看源表(li.p_table)的分区状态
| select table_owner,table_name,partition_name from dba_tab_partitions where table_name='P_TABLE' and table_owner='LI' 结果如下: LI P_TABLE MAXVALUE LI P_TABLE P_201301 LI P_TABLE P_201302 LI P_TABLE P_201303 LI P_TABLE P_201304 LI P_TABLE P_201305 LI P_TABLE P_201306 LI P_TABLE P_201307 LI P_TABLE P_201308 LI P_TABLE P_201309 LI P_TABLE P_201310 LI P_TABLE P_201311 LI P_TABLE P_201312 LI P_TABLE P_201401 |
以上说明,到此步为止,源表li.p_table已经从非分区表转换成了按月分区的时间范围分区表
8、查看源表(li.p_table)各个分区的数据分布情况
| select * from li.p_table partition (P_201301); 结果: 1 2013/1/2 1:01:01 select * from li.p_table partition (P_201303); 结果: 3 2013/3/3 1:01:01 |
说明,已经重定义成了分区表,而且数据还全部按照分区范围进行了分区存放
9、查看临时表(li.p_partion_table)的分区状态
| select table_owner,table_name,partition_name from dba_tab_partitions where table_name='P_PARTION_TABLE' and table_owner='LI' 结果:空 select owner,table_name,partitioned from dba_tables where table_name='P_PARTION_TABLE' and owner='LI'; 结果: LI P_PARTION_TABLE NO |
原本创建的临时分区表名,这时已经是一张非分区表了。
另有一点需要注意:SYS用户下的表,是不允许重定义的。
本文为“踩点”原作,转发请说明出处!