分区表卸载分区
alter table xxx.xxxx detach partition PARTx into table xxx.xxxx_xxx;
卸载之后会有一段时间数据表为不可用状态,此时查询syscat.datapartitions表会有对应的分区status为‘I’/‘L’,表示正在做异步索引清理,待清理完成后才具备attach条件。
select status from syscat.datapartitions
where tabschema='ill' and tabname='illxxx' and (status='I' or status='L');
分区表挂载分区
alter table xxx.xxxx attach partition PARTx
starting from '2022-01-01' ending at '2022-02-01' exclusive
from table xxx.xxxx_xx
挂载之后需要进行完整性检查,否则数据处于不可查看状态,(数据加载了但是查不出来)
db2 set integrity for ill.illxxx all immediate unchecked