一、匯入匯出
ixf:
db2 export to /tmp/***.csv of ixf lobs to . xml to . modified by codepage=1208 "select * from sysibm.dual"
db2 import from tablename of ixf insert into schema.tablename
del:
db2 export to /tmp/file.csv of del modified by codepage=1208 "select * from sysibm.dual"
db2 import from tablename of del insert into schema.tablename
匯出表結構
db2look -d $dbname -z schema -e -dp -cor -o test1.sql
匯出表資料
db2move $dbname export -sn sample
二、備份還原
離線備份:
db2 backup db sample to /data/dbbak/ compress
離線還原:
db2 restore database sample from /data/dbbak/ into newdbname taken at 20090622164642
db2 backup db sample online to /data/dbbak/ compress include logs
切記,需要拷貝備份時候生成的活動日誌,否則無法還原
1、生成還原指令碼,修改最終容器路徑及數量
db2 restore db sample from /data/dbbak/ taken at 20090622164642 into sample redirect generate script ***x.sql
2、執行還原
db2 -tvf ***x.sql -z ***x.log
把備份時候複製的活動日誌拷貝到當前資料庫的活動日誌目錄去,然後執行下面的前滾
db2 rollforward database sample to end of backup and complete
v9.7之前
db2 update db cfg for sample using userexit on
db2 update db cfg for sample using logretain on
db2 update db cfg for sample using trackmod on
v10.0
db2 update db cfg for sample using logarchment1 "disk:/data/archive"
db2 update db cfg for sample using trackmod on
db2備份還原 自動備份指令碼
c documents and settings db2admin db2 create db tt on d db20000i create database命令成功完成。c documents and settings db2admin db2 connect to tt 資料庫連線資訊 資料庫...
db2備份還原資料庫
備份資料庫 開始 執行 db2cmd 進入到命令列 執行如下命令 db2 backup db bxfund2 to e testbackup 提示資訊當前正在使用資料庫,這時,需要先將db2重啟一下,執行以下命令 db2stop force強制停掉db2,然後db2start 啟動資料庫,重新執行備...
DB2資料庫備份還原
db2資料庫備份還原 db2 備份命令 www.2cto.com db2 connect to dbname user username using password db2 update db cfg for dbname using logretain on db2 force applicat...