【DB2】——分区表的摘除和挂载

分区表卸载分区

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
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值