(一)Determining the DBID of the Database

在使用autobackup恢复SPFILE及controlfile时需要指定DBID

In situations requiring the recovery of your server parameter file or control file from autobackup, you must know the DBID.

DBID记录在控制文件中,一定要把数据库的DBID记在小本本上,否则数据库无法mount时是看不到DBID的

Be sure to record the DBID along with other basic information about your database. If you do not have a record of the DBID of your database, then you can find it in the following places without opening your database:

DBID会在RMAN连接时显示或是通过SQL查询select dbid from v$database;也会记录在alert.log及各种trc等日志;另外控制文件的自动备份名中包含DBID

The piece name of the autobackup must use the %F substitution variable, so the autobackup piece name includes the string c-IIIIIIIIII-YYYYMMDD-QQ, where IIIIIIIIII stands for the DBID, YYYYMMDD is a time stamp in the Gregorian calendar of the day the backup is generated, and QQ is the sequence in hexadecimal.

Identifying the Database Files to Restore or Recover

2.1 Identifying a Lost Control File

如果控制文件复本可用则直接复制即可不需要RESTORE

Loss of some but not all copies of your control file does not require you to restore a control file from backup. If at least one control file remains intact, then you can either copy an intact copy of the control file over the damaged or missing control file, or update the initialization parameter file so that it does not refer to the damaged or missing control file. After the CONTROL_FILES parameter references only present, intact copies of the control file, you can restart your database.

使用备份的控制文件恢复需要OPEN RESETLOGS

If you restore the control file from backup, then you must perform media recovery of the whole database and then open it with the OPEN RESETLOGS option, even if no data files must be restored.

2.2 Identifying Data Files Requiring Media Recovery

确定哪些数据文件缺失最简单的办法是执行VALIDATE DATABASE,但也可通过SQL查询

  1. 通过VALIDATE DATABASE查看文件缺失,之后通过REPORT SCHEMA查看相应文件位置

RMAN> VALIDATE DATABASE;

RMAN> REPORT SCHEMA;

  1. 通过以下SQL查询数据文件缺失,较VALIDATE缺点是不会检查是否有坏块

SELECT FILE#, STATUS, ERROR, RECOVER, TABLESPACE_NAME, NAME

FROM V$DATAFILE_HEADER

WHERE RECOVER = 'YES' OR (RECOVER IS NULL AND ERROR IS NOT NULL);

Note: RECOVER indicates whether a file needs media recovery, and ERROR indicates whether there was an error reading and validating the data file header.

If ERROR is not NULL, then the data file header cannot be read and validated. Check for a temporary hardware or operating system problem causing the error. If there is no such problem, then you must restore the file or switch to a copy.

If the ERROR column is NULL and the RECOVER column is YES, then the file requires media recovery (and may also require a restore from backup).

Because V$DATAFILE_HEADER only reads the header block of each data file, it does not detect all problems that require the data file to be restored. For example, this view cannot tell whether a data file contains corrupt data blocks.

还可以通过V$RECOVER_FILE来查询

Optionally, query V$RECOVER_FILE to list data files requiring recovery by data file number with their status and error information. For example, execute the following query:

SELECT FILE#, ERROR, ONLINE_STATUS, CHANGE#, TIME FROM V$RECOVER_FILE;

You cannot use V$RECOVER_FILE with a control file restored from backup or a control file that was re-created after the time of the media failure affecting the data files. A restored or re-created control file does not contain the information needed to updateV$RECOVER_FILEaccurately.

To find data file and tablespace names, you can also perform joins using the data file number and the V$DATAFILE and V$TABLESPACE views, as shown in the following example.

SELECT r.FILE# AS df#, d.NAME AS df_name, t.NAME AS tbsp_name,

d.STATUS, r.ERROR, r.CHANGE#, r.TIME

FROM V$RECOVER_FILE r, V$DATAFILE d, V$TABLESPACE t

WHERE t.TS# = d.TS#

AND d.FILE# = r.FILE#;

The ERROR column identifies the problem for each file requiring recovery.

Restoring Archived Redo Logs Needed for Recovery

RMAN在执行recover时自动restore相关归档

RMAN restores archived redo log files from backup automatically as needed to perform recovery.

By default, RMAN restores archived redo logs with names constructed using the LOG_ARCHIVE_FORMAT and the highest LOG_ARCHIVE_DEST_n parameters of the target database. These parameters are combined in a platform-specific fashion to form the name of the restored archived log.

如果归档还原到闪回恢复区,在应用后自己删除;反之需要手动删除

If RMAN restores archived redo logs to the fast recovery area during a recovery, then it automatically deletes the restored logs after applying them to the data files. Otherwise, you can use the DELETE ARCHIVELOG command to delete restored archived redo logs from disk when they are no longer needed for recovery:

RECOVER DATABASE DELETE ARCHIVELOG;

Restoring Archived Redo Logs to a New Location

使用SET ARCHIVELOG DESTINATION指定自动还原归档日志位置

You can override the default location for restored archived redo logs with the SET ARCHIVELOG DESTINATION command. During recovery, RMAN knows where to find the newly restored archived logs; it does not require them to be in the location specified in the initialization parameter file.

RUN

{ SET ARCHIVELOG DESTINATION TO '/oracle/temp_restore';

RESTORE DATABASE;

RECOVER DATABASE; # restores and recovers logs automatically}

This example restores 300 archived redo logs from backup, distributing them across the directories /fs1/tmp, /fs2/tmp, and /fs3/tmp:

RUN

{ SET ARCHIVELOG DESTINATION TO '/fs1/tmp';

RESTORE ARCHIVELOG FROM SEQUENCE 1 UNTIL SEQUENCE 100;

SET ARCHIVELOG DESTINATION TO '/fs2/tmp';

RESTORE ARCHIVELOG FROM SEQUENCE 101 UNTIL SEQUENCE 200;

SET ARCHIVELOG DESTINATION TO '/fs3/tmp';

RESTORE ARCHIVELOG FROM SEQUENCE 201 UNTIL SEQUENCE 300;

... }

Previewing Backups Used in Restore Operations预览还原需要的备份

可以在任何RESOTRE操作加PREVIEW来查看使用到的备份以及RESTORE后恢复的起始SCN

You can apply RESTORE ... PREVIEW to any RESTORE operation to create a detailed list of every backup to be used in the requested RESTORE operation, and the necessary target SCN for recovery after the RESTORE operation is complete.

This command accesses the RMAN repository to query the backup metadata, but does not actually read the backup files to ensure that they can be restored.

RESTORE.. PREVIEW不会对备份进行校验,可能替代使用RESOTERE .. VALIDATE HEADER,它不仅可以显示还原需要的备份还会对备份文件头进行校验

As an alternative to RESTORE ... PREVIEW, you can use the RESTORE ... VALIDATE HEADER command. In addition to listing the files needed for restore and recovery, the RESTORE ... VALIDATE HEADER command validates the backup file headers to determine whether the files on disk or in the media management catalog correspond to the metadata in the RMAN repository.

通过这两个命令可以查看所需要备份是否可用以及在不想用某个备份时用CHANGE命令改变备份状态以避免使用

When planning your restore and recovery operation, use RESTORE ... PREVIEW or RESTORE ... VALIDATE HEADER to ensure that all required backups are available or to identify situations in which you may want to direct RMAN to use or avoid specific backups. If needed, use the CHANGE command to set the backup status of any temporarily unavailable backups to UNAVAILABLE.

RESTORE DATABASE PREVIEW;

RESTORE ARCHIVELOG FROM TIME 'SYSDATE-7' PREVIEW;

RESTORE DATABASE PREVIEW SUMMARY;

Validating Backups Before Restoring Them

PRIVIEW并不核查备份到底是否可用,可以使用RMAN进行VALIDATE测试

  1. RESTORE ... VALIDATE tests whether RMAN can restore a specific object from a backup. RMAN chooses which backups to use.
  2. VALIDATE BACKUPSET tests the validity of a backup set that you specify.

Preparing for Complete Database Recovery相关推荐

  1. SQL Server 2012笔记分享-47:Database Recovery Advisor

    下面英文的部分,参考了官方的语言.     简单来说,两大优势: 帮助数据库管理员创建最佳的恢复序列 使用msdb中的备份历史纪录 The Database Recovery Advisor(数据库恢 ...

  2. Commvault Complete™ Backup Recovery v11 SP18 OVF 下载

    下载地址 请访问:https://sysin.org/article/DL-Commvault-Complete-Backup-Recovery-11/ Commvault Complete™ Bac ...

  3. linux系统提示faralerror,Linux系统报错Fatal error, run database recovery如何解决

    Linux用户在使用过程中,有时会遇到Fatal error,run database recovery 等错误,那么要怎么才能解决这些错误问题呢?今天小编就教大家如何解决这些错误问题吧. 升级系统的 ...

  4. Performing User-Managed Database-18.7、Performing Complete User-Managed Media Recovery

    18.7.Performing Complete User-Managed Media Recovery 完毕一致性备份,把数据库恢复到当前的scn是最好的结果.能够恢复整个数据库.恢复单个表空间.或 ...

  5. brtools备份与恢复

    brtools是sap自带的一个备份和恢复工具,可以单独安装,用这个工具来做备份与恢复比较方便. 一.备份过程 C:\Documents and Settings\bwdevadm>brtool ...

  6. OCP课程48:管理II之使用RMAN执行恢复

    课程目标: 对关键或者非关键数据文件丢失进行恢复 使用增量更新备份进行恢复 切换到镜像拷贝进行快速恢复 还原数据库到异机 使用备份的控制文件进行恢复 1.使用RMAN还原和恢复命令 恢复数据库一般包括 ...

  7. 分布式事务2PC论文翻译(Concurrency Control and Recovery in Database Systems )

    作者:Philip A. Bernstein, Vassos Hadzilacos, Nathan Goodman. 1987 原文:Concurrency Control and Recovery ...

  8. Oracle的C 模板,Oracle 19c 官方文档系列-《Database Administrator’s Guide》

    Oracle 19c 官方文档系列-<Database Administrator's Guide> 免费 专栏简介 19c 作为 Oracle Database 12c 的最终稳定版版, ...

  9. 聊聊Oracle 11g的Snapshot Standby Database(上)

    Oracle 11g是Data Guard的重要里程碑版本.在11g中,Active DataGuard.Advanced Compression等特性大大丰富了Data Guard的功能和在实践领域 ...

最新文章

  1. 3-flutter 项目结构 资源 依赖
  2. Maven初探-如何快速入手一个项目
  3. mysql从一张表更新另外一张表_MySQL 从一张表update字段到另外一张表中
  4. 6.5 不同类型的数据集
  5. 何杰月c语言课程,多线程 - 何杰leo的个人空间 - OSCHINA - 中文开源技术交流社区...
  6. python 的钻石继承问题
  7. 湖南师大计算机学院院长,董新汉(数学与计算机科学学院)老师 - 湖南师范大学 - 院校大全...
  8. IOS高级编程之二:IOS的数据存储与IO
  9. webpack 3 零基础入门教程 #12 - 如何使用模块热替换 HMR 来处理 CSS
  10. B站2021品牌营销手册
  11. [转]配置nginx+apache 其中动态由apache处理,静态由nginx处理
  12. iOS 编译百度地图静态库-合二为一
  13. Pytorch 学习笔记:
  14. 从泰勒展开到牛顿迭代
  15. 毕业设计实战:单片机智能温控风扇设计 带智能调速人体感应 论文仿真 源码 原理图
  16. python怎么下载安装教程_python怎么下载?《python软件下载安装教程》
  17. element-ui MessageBox弹框确定和取消位置(this.$confirm)
  18. FREQCON OVERSPEED 1.2 368U4 204S
  19. Jetson TK1 刷机安装Ubuntu系统与Mini PCI-e无线网卡
  20. STM32 通过定时器产生PPM信号

热门文章

  1. JavaScript文字虚幻抖动
  2. 【LeetCode】1518. 换酒问题(Java)
  3. 电子秤芯片方案,蓝牙体脂秤方案芯片CSU18M91
  4. pythonmacbook pro13.3和15.6_surface laptop 3 15寸和macbook pro 16寸 使用感受对比
  5. 改变查看修改安卓手机的DNS
  6. 使用vscode下载插件在线打开html界面,解决没有Open in default brower选择问题
  7. 听说你,不想错过。。。
  8. 进制转换—FY的蓝桥
  9. 【4】疯壳开源蓝牙智能健康手表(心率血压血氧心电监测可定制)_心电采集
  10. 剑指offer(三十三)-丑数(Java版)