Oracle 分區表中索引失效

來源:互聯網
上載者:User

標籤:style   blog   color   io   ar   div   art   sp   log   

當對分區表進行 一些操作時,會造成索引失效。

 當有truncate/drop/exchange 操作分區  時全域索引 會失效。

exchange 的暫存資料表沒有索引,或者
有索引,沒有用including indexes的關鍵字,會導致局部的索引失效,就是某個分區失效
重建局部索引只能用alter index local_idx rebuild partition p1這樣的方式

分區表SPLIT的時候,如果MAX區中已經有記錄了,這個時候SPLIT就會導致有記錄的新增分區的局部索引失效!

 

查尋某個分區表中 各個分區 索引狀態  USABLE/UNUSABLE

select index_name, partition_name, status  from user_ind_partitions where index_name = ‘indexName‘; 

--重建索引

--local索引重建select b.table_name,a.INDEX_NAME,a.PARTITION_NAME,a.STATUS,‘alter index ‘ || a.index_name || ‘ rebuild partition ‘ ||partition_name || ‘;‘ 重建列from USER_IND_PARTITIONS a, user_part_indexes bwhere a.index_name = b.index_nameand b.TABLE_NAME IN (‘PART_TAB_SPLIT‘)and STATUS = ‘UNUSABLE‘ORDER BY b.table_name, a.INDEX_NAME, a.PARTITION_NAME;--全域索引重建 alter index idx_part_split_col3 rebuild;

在針對truncate等 操作時直接更新 index 也可以搞定。 

alter table part_tab_trunc truncate partition p2 Update GLOBAL  indexes;

  

Oracle 分區表中索引失效

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.