ORA-14016: 对 LOCAL 分区索引的基础表进行分区
1、查看一个表是不是分区表
select table_name from dba_part_tables where owner = 'HS_HIS' and table_name='HIS_TRADEDAILYTOTAL';
这里查询结果为空,代表该表不是分区表
2、创建分区表(结构和非分区表相同)
create table hs_his.t_his_tradedailytotal
partition by range(init_date)
(partition PMAX values less than (maxvalue))
as select * from hs_his.his_tradedailytotal where 1=2;
3、对原表进行备份包括索引也进行备份
PL/SQL 有个查看SQL的功能,
4、交换数据(数据从非分区表到分区表)
alter table hs_his.t_his_tradedailytotal exchange partition pmax with table hs_his.his_tradedailytotal;
5、删除非分区表
drop table his_tradedailytotal;
6、将分区表重命名为原非分区表名
alter table t_his_tradedailytotal rename to his_tradedailytotal;
7、再次检查表是否为分区表
select table_owner,table_name,partition_name from dba_tab_partitions a where a.table_owner='HS_HIS' and a.table_name='HIS_TRADEDAILYTOTAL';
8、对pmax进行split分区,(把所需分区从pmax split出来):
ALTER TABLE HIS_TRADEDAILYTOTAL SPLIT PARTITION PMAX AT (20180800) INTO (partition P201801, partition PMAX) ;
分区区间仅供参考
9、备份的索引进行重建,以及检查分区表是否正确