greenZ

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

DB2 性能:DB2 删除分区:detach 分区后,detach表 不能立即 select 和 drop 的处理措施

DB2 删除分区:detach 分区后,detach表 不能立即 select 和 drop 的处理措施
 
 
【报错】SQL20285N The statement or command is not allowed because the table named "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表。
posted on 2017-03-04 18:50  绿Z  阅读(2139)  评论(0)    收藏  举报