db2分割槽表的建立及分割槽索引建立可參考:
1、刪除乙個分割槽
(1)、oralce中刪除分割槽 part_201407
alter table dw_dep_acct_detail_history drop partition part_201407;
(2)、db2中刪除分割槽 part_201407
在db2中刪除需要兩步
1)、分離分割槽到其他表中
alter table table_name detach partition part_201407 into temp_dw_dep_acct_detail_history;
注意:這裡的表temp_dw_dep_acct_detail_history不需要建立。
2)、刪除暫存分割槽資料的表
drop table temp_dw_dep_acct_detail_history;
2、新增乙個分割槽:
(1)、oracle中新增分割槽part_201408
alter table dw_dep_acct_detail_history add partition part_201408 values less than ('20140831') tablespace sidy;
(2)、db2中新增分割槽part_201408
alter table dw_dep_acct_detail_history add partition part_201408 starting from ('20140801') inclusive ending at ('20140831') exclusive;
(1)、oracle中清空分割槽part_201408資料
alter table dw_dep_acct_detail_history truncate partition part_201408; delete from dw_dep_acct_detail_history partition(part_201408) ;
(2)、db2中清空分割槽part_201408資料
對於db2清空某個分割槽資料時比較複雜,需要三步。
1)、分離要刪除的分割槽
alter table table_name detach partition part_201407 into temp_dw_dep_acct_detail_history;
注意:這裡的表temp_dw_dep_acct_detail_history不需要建立。
2)、重建分割槽
alter table dw_dep_acct_detail_histroy add partition part_201408 starting from ('20140801') inclusive ending at ('20140831') exclusive;
3)、刪除暫存分割槽資料的表
drop table temp_dw_dep_acct_detail_history;
由此看來,oracle的分割槽表處理起來還是比較簡便高效的。
db2分割槽表的建立及分割槽索引建立可參考:
DB2 分割槽表增加分割槽
最近,需要在db2的分割槽表中增加新的分割槽,用於儲存資料,因此,就研究了db2表的分割槽機制。現在總結,實現的方式共有三種,分別是 1 建立臨時表,將原表資料匯入臨時表,之後將原表重建,擴大分割槽 2 通過alter table tab name add partition,為表增加分割槽 3 建...
Db2效能優化 表分割槽
前言 實驗環境 os 名稱 microsoft windows server 2008 r2 enterprise os 版本 6.1.7601 service pack 1 build 7601 product name db2 enterprise server edition license ...
db2 最大分割槽數 DB2表分割槽資料清空維護
清空一張表的資料,我們可以truncate這張表,亦或是用replace的方式載入乙個空檔案來清空表。那麼如果現在我只需清空表的某個分割槽的資料話,要如何來做呢?2b青年說 直接delete 條件嘛。那好,現在我有張表的情況是這樣的 每個分割槽中都有1g多點的資料,現在用delete來刪除1號分割槽...