程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> DB2數據庫 >> DB2教程 >> DB2異庫(異機)重定向恢復步驟

DB2異庫(異機)重定向恢復步驟

編輯:DB2教程

創建實例

# 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

\

rollforward 數據庫

$ 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


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved