環境:IBM x346、3.2GHz×2、4GB RAM、RAID 1、DB2 V8.2.4、Win2000 Adv Server、DMS 表空間。LOAD 速度 60-100 萬行/分鐘。
需求:變更表空間或整庫遷移至新數據庫。
GATHER)。GATHER。SYSCAT.TABLES 自動拼裝 EXPORT TO table.ixf OF IXF SELECT * FROM table。LOAD FROM table.ixf OF IXF REPLACE INTO table COPY NO WITHOUT PROMPTING。public void createExportFile(Connection conn, String creator, String filePath) {
String sql = "SELECT NAME FROM SYSIBM.SYSTABLES WHERE CREATOR = '" + creator + "' AND TYPE='T'";
// 執行查詢獲取表名列表
StringBuffer sb = new StringBuffer();
for (int i=0; i
public void createLoadFile(Connection conn, String creator, String filePath) {
// 同樣查詢 SYSTABLES
for (int i=0; i
db2 connect to testdb user test password test
db2 "export to aa1.ixf of ixf select * from table1"
db2 "export to aa2.ixf of ixf select * from table2"
db2 connect reset
db2 connect to testdb user test password test
db2 "load from aa1.ixf of ixf replace into table1 COPY NO without prompting"
db2 "load from aa2.ixf of ixf replace into table2 COPY NO without prompting"
db2 connect reset
COPY NO 跳過備份窗口。STATISTICS YES、IDENTITYOVERRIDE 等高級參數。同平台/跨平台(同字節序)遷移首選。異構平台(大小端不同)需配合 db2move 或聯邦技術。大表並行 LOAD 可進一步縮短窗口。