1. 首页 > ITPUX技术网 > 正文

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

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

以下是一种方法:
记的要删除所在分区表数据
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 就要重建 索引
自己心得
一定要测试好,不要想当然,用事实说话

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息