DB2分区数据库恢复分为·分区间串行方式和分区间并行方式。下面就为您详细介绍这两种DB2分区数据库恢复方式,供您参考学习。
分区数据库的恢复操作:
由于备份和恢复操作都只作用于当前数据库分区,因此也可分为串行和并行的方式。为了在前滚恢复中介绍OVERFLOW 选项的使用,这里我们将 SAMPLE 数据库恢复到同实例的一个名为SAMPNEW的新数据库中,其命令应为:
·DB2分区数据库恢复--分区间串行方式:
- db2_all "db2 restore db sample into sampnew without prompting"
注:由于是分区数据库,因此在完成了***个分区的恢复操作,开始第二个分区的恢复操作时系统会出现SQL2529W的警告,表明数据库已存在,是否要覆盖数据恢复的提示,而在某些平台下,如Linux,这一提示会导致分区数据库恢复操作的失败,如:
$ 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
因此建议在上述硬盘数据恢复命令中加入了“WITHOUT PROMPTING”的选项,以避免该提示的出现。
DB2分区数据库恢复--分区间并行方式
- 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"
因编目分区是***个进行恢复的分区,所以无需加“WITHOUT PROMPTING”选项。
由于我们使用的备份映象文件是通过联机备份产生的,因此在恢复操作结束后,数据库将处于前滚暂挂状态,必须通过前滚操作前滚归档日志,以取消前滚暂挂状态,使数据库最终可用。
【编辑推荐】