兩種DB2分區(qū)數(shù)據(jù)庫恢復方式
DB2分區(qū)數(shù)據(jù)庫恢復分為·分區(qū)間串行方式和分區(qū)間并行方式。下面就為您詳細介紹這兩種DB2分區(qū)數(shù)據(jù)庫恢復方式,供您參考學習。
分區(qū)數(shù)據(jù)庫的恢復操作:
由于備份和恢復操作都只作用于當前數(shù)據(jù)庫分區(qū),因此也可分為串行和并行的方式。為了在前滾恢復中介紹OVERFLOW 選項的使用,這里我們將 SAMPLE 數(shù)據(jù)庫恢復到同實例的一個名為SAMPNEW的新數(shù)據(jù)庫中,其命令應為:
·DB2分區(qū)數(shù)據(jù)庫恢復--分區(qū)間串行方式:
- db2_all "db2 restore db sample into sampnew without prompting"
注:由于是分區(qū)數(shù)據(jù)庫,因此在完成了***個分區(qū)的恢復操作,開始第二個分區(qū)的恢復操作時系統(tǒng)會出現(xiàn)SQL2529W的警告,表明數(shù)據(jù)庫已存在,是否要覆蓋數(shù)據(jù)恢復的提示,而在某些平臺下,如Linux,這一提示會導致分區(qū)數(shù)據(jù)庫恢復操作的失敗,如:
$ 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ù)恢復命令中加入了“WITHOUT PROMPTING”的選項,以避免該提示的出現(xiàn)。
DB2分區(qū)數(shù)據(jù)庫恢復--分區(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ū)是***個進行恢復的分區(qū),所以無需加“WITHOUT PROMPTING”選項。
由于我們使用的備份映象文件是通過聯(lián)機備份產(chǎn)生的,因此在恢復操作結(jié)束后,數(shù)據(jù)庫將處于前滾暫掛狀態(tài),必須通過前滾操作前滾歸檔日志,以取消前滾暫掛狀態(tài),使數(shù)據(jù)庫最終可用。
【編輯推薦】