APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.2.0.2 [Release 10.1 to 11.2]
Oracle Database - Enterprise Edition - Version 11.2.0.4 to 11.2.0.4 [Release 11.2]
Oracle Database - Enterprise Edition - Version 11.2.0.3 to 11.2.0.3 [Release 11.2]
Oracle Database - Enterprise Edition - Version 12.1.0.1 to 12.1.0.1 [Release 12.1]
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.
***Checked for relevance on 21-AUG-15 ***

GOAL

The following note will guide a DBA through the process of restoring and recovering a database from an RMAN backup.  It will assist in a complete database restore.
以下说明将指导DBA通过RMAN备份还原和恢复数据库的过程。它将帮助完成完整的数据库还原
Assumption  假设
- A valid backup of the database is accessible.  可访问数据库的有效备份
- Required archive logsto recover the database are available and accessible.  恢复数据库所需的存档日志*可用且可访问。
Archive logs required are those generated from the start time of the backup until the completion of the backup if an online backup was performed. 
所需的存档日志是从备份开始时间到备份完成(如果执行了在线备份)生成的日志

If you need to perform restore/recovery on a different host for a backup taken on another host, also refer:

如果您需要在另一台主机上执行还原/恢复以在另一台主机上进行备份,请参考

Note 419137.1 How To Restore Rman Backups On A Different Node When The Directory Structures Are Different

SOLUTION

How to restore a complete database from an RMAN backup  如何从RMAN备份还原完整的数据库

This note assumes an RMAN catalog is not available. The use of a catalog is optional in this scenario as the backup information is available in the controlfile.

本说明假定RMAN目录不可用。在这种情况下,使用目录是可选的,因为控制文件中提供了备份信息

Prior to restoring a database you must ensure you have a valid RMAN backup.
在还原数据库之前,必须确保您具有有效的RMAN备份。
In this example we will assume all files are required to be restored:
在此示例中,我们假定需要还原所有文件:
* Datafiles
* Controlfiles
* Archivelogs (In order to perform recovery)

Online redo logs and temp files are recreated automatically by RMAN when a resetlogs is issued. Online redo logs and temp files are not backed up by RMAN

发出重置日志时,RMAN将自动重新创建联机重做日志和临时文件。RMAN不备份联机重做日志和临时文件

Step 1:  Identify controlfile backup to restore  确定要还原的控制文件备份

Note: If  you do not need to restore a controlfile proceed to step 3.  如果不需要还原控制文件,请继续执行 step 3

* Locate the RMAN backup you wish to restore.  找到要还原的RMAN备份。
* These files should be located in the directory where they were backed up to.  这些文件应位于它们备份到的目录中。
* If you have the RMAN backup log available this will also be of assistance. 如果您有可用的RMAN备份日志,这也将有所帮助。

Within the RMAN backup log you will see the controlfile is backed up last the the piece handle is shown.

在RMAN备份日志中,您将看到控制文件最后备份,并且显示了片段句柄
....
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2009/01/01 12:00:00
channel ORA_DISK_1: finished piece 1 at 2009/01/01 12:00:02
piece handle=/<FRA path>/o1_mf_ncsnf_TAG20090506T11_501tr0h7_.bkp tag=TAG20090506T11 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

If you do not have an RMAN backup log simply locate the last file RMAN backed up.  This should contain the controlfile backup.

如果您没有RMAN备份日志,只需找到备份的RMAN上一个文件即可。这应该包含控制文件备份。

Step 2:  Restore the controlfile

2a) If you DO NOT have a spfile.

If you do have an spfile or init.ora move to Step 2b  如果您有spfile或init.ora,请转到步骤2b

If you do not have a valid spfile or init.ora RMAN has the ability to nomount an instance without the requirement of a spfile. This will allow you to restore your spfile from a valid backup.

如果您没有有效的spfile或init.ora,RMAN可以在不需要spfile的情况下卸载实例。 这将允许您从有效备份中还原spfile。

% rman target /

RMAN> startup nomount force;

You will see this message:  您将看到以下消息:
..
starting Oracle instance without parameter file for retrieval of spfile

启动不带参数文件的Oracle实例以检索spfile
..
At this point you can restore the spfile:  此时,您可以还原spfile:

RMAN> restore spfile from '/<FRA path>/o1_mf_ncsnf_TAG20_501tr0h7_.bkp';

RMAN> shutdown immediate;

Once the spfile has been successfully restored proceed to Step 2b.

成功还原spfile后,请继续执行步骤2b。

2b)

SQL> startup nomount;

Following the successful nomount of the instance you are ready to restore the controlfile;  成功执行完实例之后,您就可以恢复控制文件了。
NOTE: The controlfile will be restored to the following location:
注意:控制文件将还原到以下位置:

SQL> show parameter control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /<oradata path>/control01.ctl
% rman target /

You will see the message:  您将看到以下消息:

connected to target database: V11 (not mounted)

RMAN> restore controlfile from '/<FRA path>/o1_mf_ncsnf_TAG20090506T113947_501tr0h7_.bkp';

Starting restore at 2009/05/11 11:01:26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=151 device type=DISK channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/<oradata path>/control01.ctl
Finished restore at 2009/05/11 11:01:27

In this example the controlfile has been restored to '/<oradata path>/control01.ctl'

Step 3:  Restore and recover the database

Your next task is to restore the database and perform recovery.  Mount the database now that the controlfile has been restored:

下一个任务是还原数据库并执行恢复。 现在已经恢复了控制文件,请装入数据库:

RMAN> alter database mount;

Now you have two options for recovery.   现在,您有两个恢复选项。

1) Full/Complete recovery.  完全恢复
2) Point In Time Recovery (PIT)  基于时间点的不完全恢复

In both examples it is assumed that all archivelogs are available to perform the recovery.

在两个示例中,均假定所有存档日志都可用于执行恢复。

Full recovery
==========

To Perform a full restore and recovery.

run{
restore database;
recover database;
alter database open resetlogs;
}

 

If you performed a complete recovery with current controlfile and online redologs in place, you might get below error when opening the database with resetlogs:
如果使用当前的控制文件和联机重做日志执行了完全恢复,则在使用复位日志打开数据库时,可能会遇到以下错误:
ORA-01139: RESET LOGS option only valid after an incomplete database recovery
At this point simply open the database without resetlogs option.

此时,只需打开不带resetlogs选项的数据库即可。

PITR Recovery
===========

Point-In-Time Recovery (PITR) would be used if you have decided to restore a database to a particular point in time. This may be warranted for a hardware fault or if you are aware of a database corruption that occured at a certain date/time.
如果您决定将数据库还原到特定的时间点,则将使用时间点恢复(PITR)。 如果发生硬件故障,或者您知道在特定日期/时间发生数据库损坏,则可能需要这样做。

run{
set until time "to_date('Aug 16 2014 10:30:00','Mon DD YYYY HH24:MI:SS')";
restore database;
recover database;
sql 'alter database open resetlogs';
}

  

NOTE: The above scripts may be altered to allocate more channels. Good practice would be to review the backup log and use the same number of channels for restore as that used by the backup.  注意:可以更改以上脚本以分配更多通道。 良好的做法是查看备份日志,并使用与备份所使用的相同数量的通道进行还原。


REFERENCES

NOTE:419137.1 - How To Restore Rman Backups On A Different Node When The Directory Structures Are Different

How to restore and recover a database from an RMAN backup. (Doc ID 881395.1)的更多相关文章

  1. RMAN RECOVER TABLE 功能是 Oracle Database 12c 的新增功能 (Doc ID 1521524.1)

    RMAN RECOVER TABLE Feature New to Oracle Database 12c (Doc ID 1521524.1) APPLIES TO: Oracle Database ...

  2. 如何将RAC数据库的 RMAN Disk 备份 Restore 到另一个节点上的单个实例 (Doc ID 415579.1)

    HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node (Doc ID 415579.1) ...

  3. Checklist for an RMAN Restore (Doc ID 1554636.1)

    Checklist for an RMAN Restore (Doc ID 1554636.1) APPLIES TO: Oracle Database - Enterprise Edition - ...

  4. Oracle 12c: RMAN restore/recover pluggable database

    查看数据库状态 运行在归档模式,可拔插数据库name=pdborcl SQL> archive log list; Database log mode Archive Mode Automati ...

  5. EMC networker nmm can restore and recover sqlserver as different name to different location

    EMC networker nmm can restore and recover sqlserver as different name to different location That is ...

  6. 使用Active Database Duplication创建跨平台Data Guard设置 (Windows/Linux) (Doc ID 881421.1)

    Using Active Database Duplication to Create Cross Platform Data Guard Setup (Windows/Linux) (Doc ID ...

  7. How to recover a skipped tablespace after an incomplete recovery? (Doc ID 1561645.1)

    How to recover a skipped tablespace after an incomplete recovery? (Doc ID 1561645.1) APPLIES TO: Ora ...

  8. How To Restore Rman Backups On A Different Node When The Directory Structures Are Different (Doc ID 419137.1)

    How To Restore Rman Backups On A Different Node When The Directory Structures Are Different (Doc ID ...

  9. RMAN DUPLICATE DATABASE with SET NEWNAME failed: RMAN-05501 RMAN-05517 (Doc ID 387093.1)

    RMAN DUPLICATE DATABASE with SET NEWNAME failed: RMAN-05501 RMAN-05517 (Doc ID 387093.1) APPLIES TO: ...

随机推荐

  1. CompareAndSwap原子操作原理

    在翻阅AQS(AbstractQueuedSynchronizer)类的过程中,发现其进行原子操作的时候采用的是CAS.涉及的代码如下: 1: private static final Unsafe ...

  2. OD 快捷方式及窗口说明

    OD 快捷方式 其他窗口 L : log 保存日志信息 E :程序的所有模块的信息(加载基址,大小,OEP,路径) M :程序的内存映射视图 T :线程信息 W :窗口信息 H :句柄表 C :CPU ...

  3. 没想到Spring Boot居然这么耗内存,有点惊讶

    Spring Boot总体来说,搭建还是比较容易的,特别是Spring Cloud全家桶,简称亲民微服务,但在发展趋势中,容器化技术已经成熟,面对巨耗内存的Spring Boot,小公司表示用不起.如 ...

  4. strcat函数(字符串连接函数)

    srtcat函数原型在c中的<string.h>中. 语法: strcat(字符串a,字符串b): #include <stdio.h> #include <string ...

  5. CAD图纸怎么看?这两种方法值得看

    在CAD日常的工作中,每天都是需要接触到CAD图纸文件,有一些房屋设计.建筑施工图.室内家具设计图纸等,这些CAD图纸的格式均为dwg格式的.是不能够直接进行打开查看的,需要借助CAD看图软件来使用. ...

  6. Delphi CreateProcess 创建一个新的进程和它的主线程

    Delphi CreateProcess WIN32API函数CreateProcess用来创建一个新的进程和它的主线程,这个新进程运行指定的可执行文件 CreateProcess百科名片 WIN32 ...

  7. Vue学习笔记Day2

    1.mustache语法 如何将data中的文本数据插入到HTML中? 通过使用mustache语法(也就是双大括号),将data中的变量名插入到HTML元素中,显示在页面上. 如下图:并且数据是响应 ...

  8. Cesium数据可视化-仓储调度系统可视化部分(附github源码)

    Cesium数据可视化-仓储调度系统可视化部分 目的 仓储调度系统需要一个可视化展示物资运输实况的界面,需要配合GPS设备发送的位置信息,实时绘制物资运输情况和仓储仓库.因此,使用Cesium可视化该 ...

  9. 【Objective-C】Objective-C语言的动态性

    Objective-C语言的动态性主要体现在以下3个方面 (1)动态类型:运行时确定对象的类型. (2)动态绑定:运行时确定对象的方法. (3)动态加载:运行时加载需要的资源或者或代码模块. 一.动态 ...

  10. pycharm报错:Process finished with exit code -1073741819 (0xC0000005)解决办法

    这个是几个月前的问题了,有小伙伴在CSDN问我咋解决的,那我今天在这边把这个问题解决办法分享下吧,免得大家把很多时间都浪费在安装排坑上面,有些坑虽然解决了还真不知道啥原因. 我的pycharm一直用的 ...