實(shí)現(xiàn)DB2數(shù)據(jù)庫恢復(fù)的路如何走好?
以下的文章主要向大家講述的是DB2數(shù)據(jù)庫恢復(fù)的正確操作步驟,以及對(duì)在實(shí)現(xiàn)DB2數(shù)據(jù)庫恢復(fù)的實(shí)際操作中所要涉及到的相關(guān)操作的描述,以下就是相關(guān)內(nèi)容的具體描述,希望會(huì)給你帶來一些幫助在此方面。
恢復(fù)數(shù)據(jù)庫
1)、手工drop數(shù)據(jù)庫,模擬災(zāi)難DB2數(shù)據(jù)庫恢復(fù)的情況,執(zhí)行如下操作:
- DB2 drop db sample
2)、恢復(fù)備份歷史紀(jì)錄(每次backup,不論類型,都會(huì)備份歷史紀(jì)錄文件)。這里的時(shí)間戳應(yīng)該是***的:
- DB2 restore db sample history file use tsm taken at 20030102223107 buffer 100
3)、使用DB2的恢復(fù)幫助工具:
- DB2ckrst -d sample -t 20030101224424 -r database
命令返回建議的必需的恢復(fù)操作命令。
4)、按照幫助工具的提示,先做版本恢復(fù),DB2數(shù)據(jù)庫恢復(fù)命令如下:
- DB2 restore db sample incremental use tsm taken at 20030101224424 buffer 100
同樣先做主節(jié)點(diǎn)的恢復(fù),再做其他節(jié)點(diǎn)的恢復(fù)操作。
5)、這時(shí)數(shù)據(jù)庫處于rollforward-pending state的狀態(tài),需要做roll forward 操作:
- DB2 rollforward db sample to 2003-01-12-13.27.25.000000 on all nodes and stop
前滾到同一個(gè)時(shí)間點(diǎn)。這個(gè)操作要在主節(jié)點(diǎn)來做。
5、有關(guān)說明:
1)、恢復(fù)操作也有online和offline的,區(qū)別如同backup的操作。
2)、按照表空間的備份和恢復(fù)類似,加子句TABLESPACE ( tablespace-name )即可。表空間級(jí)別的備份/恢復(fù)操作要求數(shù)據(jù)庫處于歸檔日志和啟用增量備份模式下。
3)、恢復(fù)的例子中只做了版本恢復(fù)。若還有更新的全備份和增量備份的image,可以依次做DB2數(shù)據(jù)庫恢復(fù)(注意使用DB2ckrst的建議恢復(fù)次序和次數(shù))后,再做roll forward.
- DB2 force applications all
- DB2 backup db ldapDB2 to directory_or_device
DB2 restore db ldapDB2 from directory_or_device replace existing其中 directory_or_device 是存儲(chǔ)備份的目錄或設(shè)備的名稱。
windows 遷移到 linux:
- DB2move tfms export;
- create db tfms;
- DB2move tfms -u -p import > a.txt;
- DB2move tfmsw179 import -u DB2admin -p DB2admin > a.txt
確認(rèn)執(zhí)行:TERMINATE
6、恢復(fù)數(shù)據(jù)庫
(1)先創(chuàng)建空數(shù)據(jù)庫:DB2 create db NewdbName
(2)DB2 restore olddbName(需DB2數(shù)據(jù)庫恢復(fù)數(shù)據(jù)庫名稱) taken at Times(時(shí)間點(diǎn)) into NewdbName(新數(shù)據(jù)庫名稱)
注:在恢復(fù)新的數(shù)據(jù)庫的名稱和剛創(chuàng)建的名稱一樣。
【編輯推薦】