DB2性能:DB2删除分区:detach分区后,detach表不能⽴即
select和dro。。。
DB2 删除分区:detach 分区后,detach表不能⽴即 select 和 drop 的处理措施
【报错】SQL20285N The statement or command is not allowed because the table named
drop删除表
"IND_TEST.TMP_DETACH_9001_V11_0311105038" has detached dependents or the asynchronous partition detach operation is not complete.
【措施1】偶能解决,不是总能解决
【措施2】不使⽤ detach表
1. select 的处理:改⽤create as和insert select保存分区的数据
--0.1 create:复制表结构
create table ind_test.T_DATA_MAX_0314140328 as (select DATA_STAMP,CYCLE_TYPE/CODE,DATA_ID,DATA_VALUE from
ind_test.T_IND_DATA_9001_V11) definition only;
--0.2 insert:保存表数据
insert into ind_test.T_DATA_MAX_0314140328
select * from ind_test.T_IND_DATA_9001_V11 where DATA_STAMP >= (
select t.lowvalue from syscat.datapartitions t where t.tabschema = upper('ind_test') and t.tabname = upper('T_IND_DATA_9001_V11') and t.partitionname = upper('data_max')
) with cs;
--0.3 select:查询 detach分区范围(全闭区间)的数据
select * from ind_test.T_DATA_MAX_0314140328;
2. drop 的处理:放在存储过程的最前⾯,即在本次detach之前,drop以往产⽣的detach表。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。