# cd /opt/IBM/db2/v9.7/instance
# ./db2icrt -p 50004 -u db2inst4 db2inst4
$ db2 create db payment on /home/db2inst4 using codeset GBK territory CN
$ db2ckbkp -h PAYMENT.0.db2inst2.NODE0000.CATN0000.20130913013001.001
Backup Mode -- 1 #表示是在線備份文件
Includes Logs -- 1 #表示備份文件中包含恢復所需要的歸檔日志<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPGgzPsn6s8nHqNLGvcWxvjwvaDM+CjxwPiQgZGIyICZxdW90O3Jlc3RvcmUgZGIgcGF5bWVudCBmcm9tIC4gdGFrZW4gYXQgIDIwMTMwOTEzMDEzMDAxIG9uIC9ob21lL2RiMmluc3Q0IGludG8gcGF5bWVudCBsb2d0YXJnZXQgL2hvbWUvZGIyaW5zdDQgcmVkaXJlY3QgZ2VuZXJhdGUgc2NyaXB0IHBheTIuY2xwJnF1b3Q7PC9wPgo8cD4gICAgICAgIC0tLS2hsWxvZ3RhcmdldCAvaG9tZS9kYjJpbnN0NCChsdfWts6jrLHtyr7WuLaoyfqzydDCv+Jyb2xsZm9yd2FyZMv50Oi1xMjV1r7Ct762PC9wPgo8cD4gPGltZyBzcmM9"http://www.Bkjia.com/uploadfile/Collfiles/20131224/2013122410080743.jpg" alt="\">
$ vi pay.clp ----編輯
根據實際情況修改下面內容(新數據庫的存儲路徑):
下面參數中的數值和上面“生成遷移腳本”語句中的參數值意義對應
修改容器路徑(表空間)
根據pay.clp中修改的實際情況,創建對應的表空間:
$ db2 "SELECT BPNAME,NPAGES,PAGESIZE FROM SYSCAT.BUFFERPOOLS" ----查看緩沖池
$ cat pool.sql ----寫一個腳本,創建表空間
#!/bin/sh
db2 connect to payment
db2 create bufferpool PAYM_SYS_POOL_4K size 25000 pagesize 4k
db2 create bufferpool PAYM_SYS_POOL_8K size 25000 pagesize 8k
db2 create bufferpool PAYM_SYS_POOL_32K size 25000 pagesize 32k
db2 "create tablespace EPS_SPACE_8K PAGESIZE 8K MANAGED BY DATABASE USING (file "/home/db2inst4/db2inst4/tablespaces/EPS_SPACE_8K' 100M) AUTORESIZE YES BUFFERPOOL PAYM_SYS_POOL_8K"
db2 "create user temporary tablespace EPS_SPACE_32K PAGESIZE 32K MANAGED BY SYSTEM USING ('/home/db2inst4/db2inst4/tablespaces/EPS_SPACE_32K' ) BUFFERPOOL PAYM_SYS_POOL_32K "
db2 "create user temporary tablespace SYSTOOLSTMPSPACE PAGESIZE 4K MANAGED BY SYSTEM USING ('/home/db2inst4/db2inst4/tablespaces/SYSTOOLSTMPSPACE' ) BUFFERPOOL PAYM_SYS_POOL_4K "
db2 "create system temporary tablespace PAYMENT_TMP PAGESIZE 32K MANAGED BY DATABASE USING (file '/home/db2inst4/db2inst4/tablespaces/PAYMENT_TMP' 100M) BUFFERPOOL PAYM_SYS_POOL_32K "
創建的表空間和pay.clp中關於表空間的內容應該一一對應。
$ chmod +x pay.clp
$ db2 -tvf pay.clp
$ db2 "rollforward database payment to end of logs and stop overflow log path ("/home/db2inst4") "
$ db2 connect to payment ----連接數據庫
$ db2 list tables for schema db2inst2 ----列出表
$ db2 get db cfg for payment
$ mkdir payment_archive_log ----創建愛你歸檔日志文件夾
$ db2 update db cfg for payment using LOGARCHMETH1 DISK:/home/db2inst4/payment_archive_log ----更新歸檔日志路徑
$ db2 connect reset ----斷開所有連接
$ db2 force applications all
$ db2 terminate
$ db2 archive log for database payment