db2 connect to YOURDBdb2look -d YOURDB -a -e -x -o creatab.sql 匯出 DDL(含授權、索引、觸發器等)db2move YOURDB export 匯出資料(產生 *.ixf、*.msg、db2move.lst)creatab.sql 修改 CONNECT 陳述式db2move NEWDB load 載入資料db2 list tablespaces show detail
-- 找到 State = "Load Pending" 的表空間,記下 "State change object id" (TABLEID)
db2 "select tabname, tableid from syscat.tables where tableid = <TABLEID>"
-- 得到表名
查看 db2move.lst,找到該表對應的 tabxxx.ixf。
db2 load from tabxxx.ixf of ixf terminate into <schema>.<tablename>
db2 list tablespaces show detail
-- 表空間狀態應恢復正常 (Normal)
db2move load 預設 REPLACE 模式,目標表必須存在且結構一致。db2look -x 匯出授權,-e 匯出觸發器/程序,-a 所有 schema。db2look 可提取低版本物件完整 DDL。