删除分区需要更新全局索引

以下是一种方法:

记的要删除所在分区表数据

alter table tb_table truncate  partition TB_table_P200608 ; --删除这个分区数据

分区不删除

alter table tb_table drop partition TB_table_P200608 update global indexes;

这个语句功能,删除数据和分区,并且重建全局索引 

也可用

alter table tb_table truncate  partition TB_table_P200608 ;

alter table tb_table drop partition TB_table_P200608;

alter index  index_name rebuild online;

要是不重建全局索引 

sql 在做select,insert ,update 等操作时会失败

查询索引状态

select index_name,status from user_indexes;

要是状态为 unusable  就要重建 索引

自己心得

一定要测试好,不要想当然,用事实说话

 

 

请使用浏览器的分享功能分享到微信等