兩種DB2分區(qū)數(shù)據(jù)庫恢復(fù)方式
DB2分區(qū)數(shù)據(jù)庫恢復(fù)分為·分區(qū)間串行方式和分區(qū)間并行方式。下面就為您詳細(xì)介紹這兩種DB2分區(qū)數(shù)據(jù)庫恢復(fù)方式,供您參考學(xué)習(xí)。
分區(qū)數(shù)據(jù)庫的恢復(fù)操作:
由于備份和恢復(fù)操作都只作用于當(dāng)前數(shù)據(jù)庫分區(qū),因此也可分為串行和并行的方式。為了在前滾恢復(fù)中介紹OVERFLOW 選項(xiàng)的使用,這里我們將 SAMPLE 數(shù)據(jù)庫恢復(fù)到同實(shí)例的一個(gè)名為SAMPNEW的新數(shù)據(jù)庫中,其命令應(yīng)為:
·DB2分區(qū)數(shù)據(jù)庫恢復(fù)--分區(qū)間串行方式:
- db2_all "db2 restore db sample into sampnew without prompting"
注:由于是分區(qū)數(shù)據(jù)庫,因此在完成了***個(gè)分區(qū)的恢復(fù)操作,開始第二個(gè)分區(qū)的恢復(fù)操作時(shí)系統(tǒng)會(huì)出現(xiàn)SQL2529W的警告,表明數(shù)據(jù)庫已存在,是否要覆蓋數(shù)據(jù)恢復(fù)的提示,而在某些平臺(tái)下,如Linux,這一提示會(huì)導(dǎo)致分區(qū)數(shù)據(jù)庫恢復(fù)操作的失敗,如:
$ db2_all "db2 restore db sample into sapmnew"
DB20000I The RESTORE DATABASE command completed successfully.
rhas3: db2 restore db sample into sapmnew completed ok
SQL2529W Warning! Restoring to an existing database that is different from the backup image database, and the alias name "SAPMNEW" of the existing database do es not match the alias name "SAMPLE" of the backup image, and the database name "SAPMNEW" of the existing database does not match the database name "SAMPLE" of the backup image. The target database will be overwritten by the backup version. The Roll-forward recovery logs associated with the target database will be deleted.
Do you want to continue ? (y/n) SQL2001N The utility was interrupted. The output data may be incomplete.
rhas3: db2 restore db sample into sapmnew completed rc=4
因此建議在上述硬盤數(shù)據(jù)恢復(fù)命令中加入了“WITHOUT PROMPTING”的選項(xiàng),以避免該提示的出現(xiàn)。
DB2分區(qū)數(shù)據(jù)庫恢復(fù)--分區(qū)間并行方式
- db2_all "<<+0< db2 restore db sample into sampnew"
- db2_all "||<<-0< db2 restore db sample into sampnew without prompting"
或
- db2_all "<<-0<; db2 restore db sample into sampnew without prompting"
因編目分區(qū)是***個(gè)進(jìn)行恢復(fù)的分區(qū),所以無需加“WITHOUT PROMPTING”選項(xiàng)。
由于我們使用的備份映象文件是通過聯(lián)機(jī)備份產(chǎn)生的,因此在恢復(fù)操作結(jié)束后,數(shù)據(jù)庫將處于前滾暫掛狀態(tài),必須通過前滾操作前滾歸檔日志,以取消前滾暫掛狀態(tài),使數(shù)據(jù)庫最終可用。
【編輯推薦】
DB2批量執(zhí)行SQL腳本的實(shí)現(xiàn)