如何将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)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
***Checked for relevance on 15-Apr-2014***

GOAL

- You have a RAC database backed up by RMAN to disk location  您有一个由RMAN备份到磁盘位置的RAC数据库
- You need to restore this backup as Single Instance on another node  您需要将此备份还原为另一个节点上的单实例

SOLUTION

1) Take appropriate RMAN backup of the production RAC database. Note that you should turn on the CONTROLFILE AUTOBACKUP configuration so that we have the controlfile backed up after the database backup. When we restore the controlfile on new host from this autobackup piece, it will have the information of the latest backup.

对生产RAC数据库进行适当的RMAN备份。请注意,您应该打开 CONTROLFILE AUTOBACKUP 配置,以便在数据库备份之后备份控制文件。当我们从此自动备份片段将控制文件还原到新主机上时,它将具有最新备份的信息。

RMAN> run{
2> allocate channel c1 type disk format ‘/<PATH>/%U‘;
3> backup database;
4> backup archivelog all;
5> }

allocated channel: c1
channel c1: sid=133 instance=<oracle_sid> devtype=DISK

Starting backup at 12-FEB-07
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=/<PATH>/system01.dbf
input datafile fno=00002 name=/<PATH>/undotbs01.dbf
input datafile fno=00005 name=/<PATH>/undotbs02.dbf
input datafile fno=00003 name=/<PATH>/sysaux01.dbf
input datafile fno=00004 name=/<PATH>/users01.dbf
channel c1: starting piece 1 at 12-FEB-07
channel c1: finished piece 1 at 12-FEB-07
piece handle=/<PATH>/09i9sruq_1_1 tag=TAG20070212T162458 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:05
Finished backup at 12-FEB-07

Starting backup at 12-FEB-07
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=56 recid=3 stamp=613417105
input archive log thread=1 sequence=57 recid=4 stamp=613417106
input archive log thread=1 sequence=58 recid=5 stamp=614363168
input archive log thread=2 sequence=1 recid=1 stamp=613417090
input archive log thread=2 sequence=2 recid=2 stamp=613417093
input archive log thread=2 sequence=3 recid=6 stamp=614363170
channel c1: starting piece 1 at 12-FEB-07
channel c1: finished piece 1 at 12-FEB-07
piece handle=/<PATH>/0ai9ss14_1_1 tag=TAG20070212T162610 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 12-FEB-07

Starting Control File and SPFILE Autobackup at 12-FEB-07
piece handle=/<PATH>/c-610677177-20070212-00 comment=NONE
Finished Control File and SPFILE Autobackup at 12-FEB-07
released channel: c1

2) Create a PFILE for the single instance database using the production RAC parameter file  使用生产RAC参数文件为单实例数据库创建PFILE
a) don‘t forget to modify the following parameters depending on the directory structure of the new host: audit_file_dest, background_dump_dest, control_files, core_dump_dest, log_archive_dest_1, user_dump_dest etc  不要忘记根据新主机的目录结构修改以下参数:audit_file_dest, background_dump_dest, control_files, core_dump_dest, log_archive_dest_1, user_dump_dest 等
b) remove RAC specific parameters such as cluster_database_instances, cluster_database etc  删除RAC特定的参数,例如 cluster_database_instances,cluster_database 等
c) for the parameter undo_tablespace, mention any one undo tablespace name  对于参数undo_tablespace,使用任何一个undo表空间名称

Known issue which may require an additional parameter to be set :  --可能需要设置其他参数的已知问题
   Note 334899.1RMAN Duplicate from RAC backup fails ORA-38856

3) Move the backup pieces and the modified INIT.ORA file to the new host. Starting from 10g it is NO longer compulsory to copy the RMAN backup pieces to exactly the same location on the new host as the production location.
    将备份片段和修改后的INIT.ORA文件移动到新主机。从10g开始,不再必须将RMAN备份片段复制到新主机上与生产位置完全相同的位置。
4) Use the pfile created above to STARTUP NOMOUNT the database on the new host  使用上面创建的pfile在新主机上启动NOMOUNT数据库

[email protected] ractest]$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 16 03:14:23 2007

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218292 bytes
Variable Size              62916876 bytes
Database Buffers           96468992 bytes
Redo Buffers                7168000 bytes

5) Now invoke RMAN and restore the controlfile specifying the location where the controlfile autobackup piece is restored on this new server. You can mount the database once the controlfile is restored successfully.

现在调用RMAN并还原控制文件,并指定该文件在该新服务器上的还原位置。控制文件成功还原后,您可以装载数据库

[[email protected] ractest]$ rman target / nocatalog

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 16 03:16:31 2007

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: <db_name> (not mounted)
using target database control file instead of recovery catalog

RMAN> restore controlfile from ‘/<PATH>/c-610677177-20070212-00‘;

Starting restore at 16-FEB-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/<PATH>/control01.ctl
Finished restore at 16-FEB-07

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

6) You can skip this step if you have restored the RMAN backup pieces to exactly the same location they were backed up on production. If this is not the case then you need to catalog the RMAN backup pieces to make RMAN aware of their new location on the new host. Note that CATALOG BACKUPPIECE command is available only starting from 10g.

如果已将RMAN备份片段还原到生产中备份的完全相同的位置,则可以跳过此步骤。如果不是这种情况,则需要对RMAN备份块进行分类,以使RMAN知道它们在新主机上的新位置。注意,CATALOG BACKUPPIECE 命令仅从10g开始可用。

RMAN> catalog backuppiece ‘/<PATH>/09i9sruq_1_1‘;

cataloged backuppiece
backup piece handle=/<PATH>/09i9sruq_1_1 recid=10 stamp=614661579

RMAN> catalog backuppiece ‘/<PATH>/0ai9ss14_1_1‘;

cataloged backuppiece
backup piece handle=/<PATH>/0ai9ss14_1_1 recid=11 stamp=614661599

7) Now we‘ll determine the point upto which media recovery should run on the restored database.

现在,我们确定在恢复的数据库上应该运行介质恢复的时间点

RMAN> list backup of archivelog all;

List of Archived Logs in backup set 9
Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
---- ------- ---------- --------- ---------- ---------
1    56      214541     01-FEB-07 226238     01-FEB-07
1    57      226238     01-FEB-07 226240     01-FEB-07
1    58      226240     01-FEB-07 233107     12-FEB-07
2    1       186185     28-JAN-07 225714     01-FEB-07
2    2       225714     01-FEB-07 226037     01-FEB-07
2    3       226037     01-FEB-07 233110     12-FEB-07

Check the last archive sequence for all redo threads and select the archive sequence having LEAST "Next SCN" among them. In our case sequence 58 of thread 1 has Next SCN of 233107 while sequence 3 of thread 2 has Next SCN of 233110. Since squence 58 of thread 1 has least Next SCN we will recover upto this point. (If you are keen to have recovery run until some specific time you can always give SET UNTIL TIME)

检查所有 redo 线程的最后一个归档序列,并选择其中具有最低 "Next SCN" 的归档序列。在我们的情况下,线程1的序列58的Next SCN为233107,而线程2的序列3的Next SCN为233110。由于线程1的序列58的Next SCN最少,我们将恢复到这一点。(如果您希望在特定时间之前执行恢复,则可以始终设置 SET UNTIL TIME)

8) Having determined the point upto which media recovery should run, start the restore/recovery using:  确定应该运行介质恢复的时间点后,使用以下命令开始 restore/recovery

Please note in below example we choose Until sequence as 59(one more then the value selected in step  7 that is sequence 58)  because When we specify a sequence number, it is considered as an UPPER limit, RMAN selects only

请使用以下步骤开始恢复:请注意,在以下示例中,我们选择 Until sequence 为59(比在步骤7中选择的值(序列58多一个)),因为当我们指定序列号时,它被视为 UPPER limit ,RMAN仅选择

those  files which are needed for the recovery and uses 59 as an upper log sequence number while recovering database and would recovery upt log sequence number upto 58  .

恢复所需的文件,在恢复数据库时使用59作为较高的日志序列号,并且最多恢复58个日志序列号。

RMAN> run {
2> set until sequence 59 thread 1;
3> set newname for datafile 1 to ‘/<PATH>/system01.dbf‘;
4> set newname for datafile 2 to ‘/<PATH>/undotbs01.dbf‘;
5> set newname for datafile 3 to ‘/<PATH>/sysaux01.dbf‘;
6> set newname for datafile 4 to ‘/<PATH>/users01.dbf‘;
7> set newname for datafile 5 to ‘/<PATH>/undotbs02.dbf‘;
8> restore database;
9> switch datafile all;
10> recover database;
11> }

In case you want to have the datafiles on a ASM diskgroup for the clone/destination database, you may use SET NEWNAME as below:

如果要将数据文件放在克隆/目标数据库的ASM磁盘组上,则可以使用SET NEWNAME,如下所示

set newname for datafile 1 to ‘+<disk_group>‘;
set newname for datafile 2 to ‘+<disk_group>‘;
....

Known issue in Oracle10g:
   Note 1146703.1 Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0]

CAUTION !!!!:  小心!!!!

If Online Redolog‘s (ORL‘s) are Oracle Managed Files (OM), and the Clone is being done on any of Source RAC Node (where ORLs are accessible from), renaming ORL will try to remove Source ORL files!

如果 Online Redolog(ORL)是 Oracle Managed Files(OM),并且正在任何Source RAC Node(可从中访问ORL)上完成克隆,则重命名ORL将尝试删除Source ORL文件
Please review: http://docs.oracle.com/cd/E11882_01/server.112/e25494/omf.htm#ADMIN11517

The following statements are used to rename files: 以下语句用于重命名文件

ALTER DATABASE RENAME FILE
ALTER TABLESPACE ... RENAME DATAFILE

These statements do not actually rename the files on the operating system, but rather, the names in the control file are changed. If the old file is an Oracle managed file and it exists, then it is deleted. You must specify each filename using the conventions for filenames on your operating system when you issue this statement."

这些语句实际不重命名操作系统上的文件,而是更改控制文件中的名称。如果旧文件是Oracle managed file并且存在,则将其删除。发出此语句时,必须使用操作系统上文件名的conventions指定每个文件名
Instead of renaming, we can recreate the controlfile with desired name for ORLs:  除了重命名,我们还可以使用所需的ORL名称重新创建控制文件

SQL> alter database backup controlfile to trace as ‘/tmp/control.sql‘ resetlogs ;

Edit /tmp/control.sql and modify desired ORL names.  编辑 /tmp/control.sql 并修改所需的ORL名称

Since we determined previously that media recovery should run until sequence 58 hence we use  SET UNTIL SEQUENCE 59 (+1) above. You also need to use SET NEWNAME clause to restore datafiles to a location on the new host which is different from the production path. Finally, SWITCH DATAFILE ALL clause updates these new datafile locations in the controlfile.

由于我们之前确定介质恢复应运行到序列58,因此我们使用上面的 SET UNTIL SEQUENCE 59(+1)。您还需要使用SET NEWNAME子句将数据文件还原到新主机上与生产路径不同的位置。最后,SWITCH DATAFILE ALL子句更新控制文件中的这些新数据文件位置。

9) Once RMAN restore/recovery finishes, you will want to rename the online redolog files before opening the database in case the production path of redo log files is not available on the new host. After renaming the redolog files, the database can be opened with RESETLOGS

RMAN restore/recovery 完成后,如果 online redolog files 的生产路径在新主机上不可用,您将需要在打开数据库之前重命名 online redolog files。重命名重做日志文件后,可以使用RESETLOGS打开数据库

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/<old_path>/redo01.log
/<old_path>/redo02.log
/<old_path>/redo03.log
/<old_path>/redo04.log
/<old_path>/redo05.log
/<old_path>/redo06.log

6 rows selected.

SQL> alter database rename file ‘/<old_path>/redo01.log‘ to ‘/<new_path>/redo01.log‘;

Database altered.

SQL> alter database rename file ‘/<old_path>/redo02.log‘ to ‘/<new_path>/redo02.log‘;

Database altered.

SQL> alter database rename file ‘/<old_path>/redo03.log‘ to ‘/<new_path>/redo03.log‘;

Database altered.

SQL> alter database rename file ‘/<old_path>/redo04.log‘ to ‘/<new_path>/redo04.log‘;

Database altered.

SQL> alter database rename file ‘/<old_path>/redo05.log‘ to ‘/<new_path>/redo05.log‘;

Database altered.

SQL> alter database rename file ‘/<old_path>/redo06.log‘ to ‘/<new_path>/redo06.log‘;

Database altered.

SQL> alter database open resetlogs;

Database altered.

In case you want to create the online redo logs on a ASM diskgroup (+DATA for eg) for the clone/destination database, you may use below commands:
如果要在ASM磁盘组(例如+ DATA)上为克隆/目标数据库创建联机重做日志,则可以使用以下命令

alter database rename file ‘/<old_path>/redo01.log‘ to ‘+<disk_group>‘;
alter database rename file ‘/<old_path>/redo02.log‘ to ‘+<disk_group>‘;
...

10) Once the database is opened successfully, you may remove the redolog groups for redo threads of other instances

成功打开数据库后,您可以删除其他实例的重做线程的重做组

SQL> select THREAD#, STATUS, ENABLED
  2  from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC
         2 CLOSED PRIVATE

SQL> select group# from v$log where THREAD#=2;

    GROUP#
----------
         4
         5
         6

SQL> alter database disable thread 2;

Database altered.

SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00350: log 4 of instance racdb2 (thread 2) needs to be archived
ORA-00312: online log 4 thread 2: ‘/<PATH>/redo04.log‘

SQL> alter database clear unarchived logfile group 4;

Database altered.

SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile group 5;

Database altered.

SQL> alter database drop logfile group 6;

Database altered.

SQL> select THREAD#, STATUS, ENABLED from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC 

11) Now you can remove the undo tablespaces of other instances and create a new temporary tablespace to complete the activity.

现在,您可以删除其他实例的UNDO表空间,并创建一个新的TEMP表空间以完成活动

SQL> sho parameter undo;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1
SQL>
SQL>
SQL> select tablespace_name from dba_tablespaces where contents=‘UNDO‘;

TABLESPACE_NAME
------------------------------
UNDOTBS1
UNDOTBS2

SQL> drop tablespace UNDOTBS2 including contents and datafiles;

Tablespace dropped.

SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/<PATH>/temp01.dbf

SQL> select tablespace_name from dba_tablespaces where contents=‘TEMPORARY‘;

TABLESPACE_NAME
------------------------------
TEMP

SQL> create temporary tablespace TEMP1
  2  tempfile ‘/<PATH>/temp01.dbf‘
  3  size 50M;

Tablespace created.

SQL> alter database default temporary tablespace TEMP1;

Database altered.

SQL> drop tablespace TEMP including contents and datafiles;

Tablespace dropped.

REFERENCES

NOTE:1146703.1 - Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0]

原文地址:https://www.cnblogs.com/zylong-sys/p/12006130.html

时间: 2024-08-01 08:51:53

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

oracle 11.2.0.3 rac集群rman周备份策略

1 1.1备份策略 2 周日执行0级的增量备份 3 4 周一执行2级的增量备份 5 6 周二执行2级的增量备份 7 8 周三执行1级的增量备份 9 10 周四执行2级的增量备份 11 12 周五执行2级的增量备份 13 14 周六执行2级的增量备份 15 周日进行一次零级备份,周一.周二.进行二级备份:周三进行一级备份:周四.周五.周六进行二级备份.在执行备份的时候,我们考 虑将数据文件的全备和归档日志备份分开执行,避免造成一些不必要的麻烦.在进行全备的时候,由于RAC的两个节点是共享的所有数据

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

APPLIES TO: Oracle Database - Enterprise Edition - Version 10.1.0.2 and laterInformation in this document applies to any platform.***Checked for relevance on 20-July-2015*** GOAL Restoring Rman backup on a different node with different backup directo

中小型数据库 RMAN CATALOG 备份恢复方案(一)

对于数据库的稳定性,高可用,跨平台以及海量数据库的处理,Oracle 数据库通常是大型数据库和大企业的首选.尽管如此,仍然不乏很多中小企业想要品尝一下Oracle腥味,因此在Oracle环境中也有不少中小型数据库.出于成本的考虑,通常有可能就搞个标准版了,跑在Linux上.谁叫Oracle太贵呢?对于中小企业而言,选择合理的才是最好的.对我们这些个搞DB的,贵的一定有贵的道理,我们也可以都进多几斗米.哈哈......典型的打工者的心态哟.言归正传,中小企业的成本限制了我们搞高可用,RAC和DG也

【RAC】将单实例备份集恢复为rac数据库

[RAC]将单实例备份集恢复为rac数据库 BLOG文档结构图 前言部分 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~: ① 单实例环境的备份集如何恢复到rac环境(重点) ② rman恢复数据库的一般步骤 ③ rac环境的简单操作 注意:本篇BLOG中代码部分需要特别关注的地方我都用***背景和红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方.

中小型数据库 RMAN CATALOG 备份恢复方案(二)

中小型数据库呈现的是数据库并发少,数据库容量小,版本功能受限以及N多单实例等特点.尽管如此,数据库的损失程度也会存在零丢失的情形.企业不愿意花太多的钱又要保证数据库的可靠稳定,可是苦煞了我这些搞DB的.接上一篇文章,中小型数据库 RMAN CATALOG 备份恢复方案(一),我们继续来给出基于中小型数据库的恢复的脚本与其部署. 1.RMAN还原shell脚本 [python] view plain copy print? --下面的shell脚本用于实现数据库的自动还原,还原成功后,数据库被关闭

Oracle数据库从RMAN备份集片段还原指定单个归档日志进行日志挖掘分析

起因:业务已知在之前某个时间点范围内发生了可疑异常操作,希望通过日志挖掘来审查SQL动作 现状:生产库在线归档已备份后删除,RMAN归档备份已经刷出超期的备份集文件 需求:通过RMAN还原归档到线上以进行日志挖掘 定位归档日志涉及范围: select * from v$archived_log l where to_date('2018-11-12 16:18:51','yyyy-mm-dd hh24:mi:ss') between L.FIRST_TIME and L.NEXT_TIME; 假

validate命令---rman进行备份和回复的验证

rman作为oracle备份与恢复工具,为我们提供了强大的功能.当中包含对数据文件的物理和逻辑检測以及备份文件的有效性检測. 首先.来看一下rman对数据文件的检測. 我们知道,rman在备份数据时,会将数据读入读缓存,然会将数据从读缓存写入写缓存并终于写入数据库.在从读缓存到写缓存的过程中,rman会进行物理一致性的检測(db_block_checksum未true)和逻辑一致性检測(使用了check logical选项).比如: SQL> show parameter db_block NA

[转]Oracle DB 使用RMAN创建备份2

归档备份:概念 归档备份:概念 如果需要在指定时间内保留联机备份,RMAN 通常会假定用户可能需要在自执行该备份以来到现在之间的任意时间执行时间点恢复.为了满足这一要求,RMAN 会在此时段内保留归档日志.但是,可能仅需要在指定的时间(如两年)内保留特定备份(并使其保持一致和可恢复).用户不打算恢复到自执行该备份以后的某一时间点,只是希望能够正好恢复到执行该备份的确切时间.此外,用户还需要维护保留策略以使备份区井然有序,因此无法使备份恢复到两年前.为了满足保留数据的商业或法律要求,通常需要这么做

Redhat 5.4 Orcle RAC 数据库 从10.2.0.1升级到 10.2.0.4

之前安装的是两个节点的RAC 平台. 数据库版本是10.2.0.1. 这个实验的目的就是将这个数据库版本从10.2.0.1 升级到 10.2.0.4.  升级包可以从Oracle metalink上进行下载,这个下载需要Oracle 付费的帐号. 网络可能也有资源下载. 10.2.0.4的patch number 是:p6810189. 两个节点的RAC 安装,参考Blog: Redhat 5.4 + ASM + RAW+ Oracle 10g RAC 安装文档 http://blog.csdn