ORACLE Exchange 分区和分区索引

ORACLE EXCHANGE PARTITION and PARTITION INDEXES

为了压缩单个分区的数据,我使用了以下方法:

-- I create a table with the same structure of the ORIGINAL TABLE, but
-- on a new tablespace (NEW_TBS_DATA)

CREATE TABLE AUXILIARY_TABLE TABLESPACE NEW_TBS_DATA AS 
SELECT * FROM ORIGINAL_TABLE WHERE 1=0

-- I create the index on the AUXILIARY_TABLE, on a new tablespace 
-- for indexes (NEW_TBS_IDX)

CREATE   INDEX I_1 ON AUXILIARY_TABLE( START_DATE) TABLESPACE NEW_TBS_IDX
CREATE   INDEX I_2 ON AUXILIARY_TABLE( ID_FILE) TABLESPACE NEW_TBS_IDX
CREATE   INDEX I_3 ON AUXILIARY_TABLE( DESCRIPTION) TABLESPACE NEW_TBS_IDX
CREATE   INDEX I_4 ON AUXILIARY_TABLE( ZIP_CODE) TABLESPACE NEW_TBS_IDX
CREATE   INDEX I_5 ON AUXILIARY_TABLE( BH_TRAFFIC) TABLESPACE NEW_TBS_IDX 

-- I move data from partition 20160529 to auxiliary_table

ALTER TABLE ORIGINAL_TABLE EXCHANGE PARTITION PARTITION_20160529 WITH TABLE AUXILIARY_TABLE INCLUDING INDEXES WITHOUT VALIDATION

-- I compress data using the new tablespace NEW_TBS_DATA on auxiliary_table

ALTER TABLE AUXILIARY_TABLE  MOVE  TABLESPACE NEW_TBS_DATA PARALLEL 4 COMPRESS

-- I move the data back to the original table, with the same exchange statement:

ALTER TABLE ORIGINAL_TABLE EXCHANGE PARTITION PARTITION_20160529 WITH TABLE AUXILIARY_TABLE including indexes without validation

-- I drop the auxiliary_table

DROP TABLE AUXILIARY_TABLE CASCADE CONSTRAINTS PURGE

为什么在该过程结束时,分区索引位于旧表空间而不是新表空间 (NEW_TBS_IDX) 上?

"including indexes" 部分仅对本地索引有效。看 https://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm 部分(交换分区)