数据数据量达到一定时,需要进行表空间分区,下面代码是根据时间进行分区。
alter table TG_CONSIGNORG_ISSUEPLAN add partition part72 starting from '2015-01-01' ending at '2015-02-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part73 starting from '2015-02-01' ending at '2015-03-01' exclusive in USERSPACE1;alter table TG_CONSIGNORG_ISSUEPLAN add partition part74 starting from '2015-03-01' ending at '2015-04-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part75 starting from '2015-04-01' ending at '2015-05-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part76 starting from '2015-05-01' ending at '2015-06-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part77 starting from '2015-06-01' ending at '2015-07-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part78 starting from '2015-07-01' ending at '2015-08-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part79 starting from '2015-08-01' ending at '2015-09-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part80 starting from '2015-09-01' ending at '2015-10-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part81 starting from '2015-10-01' ending at '2015-11-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part82 starting from '2015-11-01' ending at '2015-12-01' exclusive in USERSPACE1;
alter table TG_CONSIGNORG_ISSUEPLAN add partition part83 starting from '2015-12-01' ending at '2015-12-31' in USERSPACE1;
--执行脚本前表信息
su - db2rdb
db2look -d tmisrpdb -e -l -f -a -x -dp -t "TG_CONSIGNORG_ISSUEPLAN" "TG_CONSIGNORG_PKG" "TG_DEBTCASH_DETAIL" "TG_DEBTIMPAWN" "TG_DEBTIMPAWN_DETAIL" "TG_DEBTIMPAWN_RELIEVE_DETAIL" "TG_DEBTISSUE_DETAIL" "TG_INVESTER_IMPAWNLOAN" "TG_INVESTERBUY_DISTRIBUTE" "TG_INVESTERBUY_STAT" "TG_INVESTERMOD_DETAIL" -o tablebeforeinfo.ddl
--执行脚本后表信息
su - db2rdb
db2look -d tmisrpdb -e -l -f -a -x -dp -t "TG_CONSIGNORG_ISSUEPLAN" "TG_CONSIGNORG_PKG" "TG_DEBTCASH_DETAIL" "TG_DEBTIMPAWN" "TG_DEBTIMPAWN_DETAIL" "TG_DEBTIMPAWN_RELIEVE_DETAIL" "TG_DEBTISSUE_DETAIL" "TG_INVESTER_IMPAWNLOAN" "TG_INVESTERBUY_DISTRIBUTE" "TG_INVESTERBUY_STAT" "TG_INVESTERMOD_DETAIL" -o tableafterinfo.ddl