Previous articles on restoration of RMAN:
RMAN series (V)-RMAN restoration and Restoration
Http://blog.csdn.net/tianlesoftware/archive/2010/07/11/5700474.aspx
RMAN backup and recovery instance
Http://blog.csdn.net/tianlesoftware/archive/2009/10/20/4699320.aspx
Oracle RMAN cross-resetlogs version recovery
Http://blog.csdn.net/tianlesoftware/archive/2009/10/17/4682463.aspx
The RMAN in RAC focuses on the consistency between the backup and restoration policies. Different backup policies may result in different backup results step by step, thus affecting recovery policies and steps. Generally, the recovery policy and backup policy must correspond to each other. If the backup policy is modified, the same policy should be used for recovery. Previous reference to RMAN backup:
RMAN backup for RAC
Http://blog.csdn.net/tianlesoftware/archive/2010/09/22/5901053.aspx
There are two considerations:
- You must be able to view the archive files of all nodes on the recovered node. The method described in the RAC backup article is to transfer the archive file to other nodes so that you can see the archive file of all nodes.
- Storage of backup sets. If we put it on a shared device, the node can access all the backup files, and then the recovery operation can be performed directly. If it is not on a shared device, you can mount it through NFS mount or set two channels. Point to multiple instances.
Example:
1.1 stop the database first
[[Email protected] bin] $ srvctl stop DB-D orcl
[[Email protected] bin] $ crs_stat-T
Name type target State host
------------------------------------------------------------
Ora. orcl. DB application offline
Ora... OLTP. CS application offline
Ora... cl1.srv application offline
Ora... cl2.srv application offline
Ora... l1.inst application offline
Ora... l2.inst application offline
Ora... sm1.asm application online Rac1
Ora... c1.lsnr application online Rac1
Ora. rac1.gsd application online Rac1
Ora. rac1.ons application online Rac1
Ora. rac1.vip application online Rac1
Ora... sm2.asm application online rac2
Ora... c2.lsnr application online rac2
Ora. rac2.gsd application online rac2
Ora. rac2.ons application online rac2
Ora. rac2.vip application online rac2
1.2 start the node to the Mount status:
If the backup set exists on two nodes (the RAC of the two nodes), two channels need to be allocated to connect the corresponding nodes respectively. Each node must be started to the Mount state. Because each node has a backup file, you need to execute a restore on each node. If it is not started, an error will be reported. This is not necessary for storing backup sets on shared devices.
[[Email protected] bin] $ export oracle_sid = orcl1
[[Email protected] bin] $ RMAN target/
Recovery Manager: Release 10.2.0.1.0-production on Mon Sep 27 02:56:55 2010
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database (not started)
RMAN> startup Mount;
Oracle instance started
Database mounted
Total system global area 180355072 bytes
Fixed size 1218388 bytes
Variable Size 100665516 bytes
Database buffers 75497472 bytes
Redo buffers 2973696 bytes
[[Email protected] bin] $ export oracle_sid = orcl2
[[Email protected] bin] $ RMAN target/
Recovery Manager: Release 10.2.0.1.0-production on Mon Sep 27 02:57:44 2010
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database (not started)
RMAN> startup Mount;
Oracle instance started
Database mounted
Total system global area 180355072 bytes
Fixed size 1218388 bytes
Variable Size 83888300 bytes
Database buffers 92274688 bytes
Redo buffers 2973696 bytes
1.3 full recovery
Run the following command on any node:
RMAN> run {
Allocate channel C1 device type disk connect 'sys/[email protected] ';
Allocate channel C2 device type disk connect 'sys/[email protected] ';
Restore database;
Recover database;
}
2> 3> 4> 5> 6>
Using target database control file instead of recovery catalog
Allocated channel: C1
Channel C1: SID = 146 instance = orcl1 devtype = Disk
Allocated channel: C2
Channel C2: SID = 146 instance = orcl2 devtype = Disk
Starting restore at 27-sep-10
Skipping datafile 2; already restored to file + Data/orcl/datafile/undotbs1.278.730181053
Skipping datafile 3; already restored to file + Data/orcl/datafile/sysaux.277.730181053
Skipping datafile 5; already restored to file + Data/orcl/datafile/undotbs2.284.730181347
Skipping datafile 1; already restored to file + Data/orcl/datafile/system.276.730181051
Skipping datafile 4; already restored to file + Data/orcl/datafile/users.279.730181053
Skipping datafile 7; already restored to file + Data/orcl/datafile/anhuianqing. DBF
Finished restore at 27-sep-10
Starting recover at 27-sep-10
Starting media recovery
Media recovery complete, elapsed time: 00:00:04
Finished recover at 27-sep-10
Released channel: C1
Released channel: C2
RMAN> SQL 'alter database open ';
SQL statement: Alter database open
1.4 Incomplete recovery
1.4.1 Restoration Based on Time points
RMAN> run {
Allocate channel C1 device type disk connect 'sys/[email protected] ';
Allocate channel C2 device type disk connect 'sys/[email protected] ';
Set until time "to_date ('2014/1/27 03:30:00 ', 'yyyy/MM/DD hh24: MI: ss ')";
Restore database;
Recover database;
}
2> 3> 4> 5> 6> 7> 8>
Allocated channel: C1
Channel C1: SID = 143 instance = orcl1 devtype = Disk
Allocated channel: C2
Channel C2: SID = 146 instance = orcl2 devtype = Disk
Executing command: set until clause
Starting restore at 27-sep-10
Channel C1: Starting datafile backupset restore
Channel C1: specifying datafile (s) to restore from backup set
Restoring datafile 00001 to + Data/orcl/datafile/system.276.730181051
Restoring datafile 00004 to + Data/orcl/datafile/users.279.730181053
Restoring datafile 00007 to + Data/orcl/datafile/anhuianqing. DBF
Channel C1: reading from backup piece/u01/backup/orcl_2blotmnp_1_20171000020100927
Channel C2: Starting datafile backupset restore -- two channels are used here, because the test backup set is placed on two nodes.
Channel C2: specifying datafile (s) to restore from backup set
Restoring datafile 00002 to + Data/orcl/datafile/undotbs1.278.730181053
Restoring datafile 00003 to + Data/orcl/datafile/sysaux.277.730181053
Restoring datafile 00005 to + Data/orcl/datafile/undotbs2.284.730181347
Channel C2: reading from backup piece/u01/backup/orcl_2clotmno_00000000000020100927
Channel C2: restored backup piece 1
Piece handle =/u01/backup/orcl_2clotmno_0000000020100927 tag = orcl_hot_db_bk
Channel C2: restore complete, elapsed time: 00:01:21
Channel C1: restored backup piece 1
Piece handle =/u01/backup/orcl_2blotmnp_1_1_20100927 tag = orcl_hot_db_bk
Channel C1: restore complete, elapsed time: 00:02:48
Finished restore at 27-sep-10
Starting recover at 27-sep-10
Starting media recovery
Media recovery complete, elapsed time: 00:00:03
Finished recover at 27-sep-10
Released channel: C1
Released channel: C2
RMAN>
After the restoration is completed, run the following command on the two nodes:
Alter database open resetlogs;
Open the data.
1.4.2 SCN-based recovery
How to view the current SCN:
SQL> select current_scn from V $ database;
Current_scn
-----------
1118216
RMAN> run {
Allocate channel C1 device type disk connect 'sys/[email protected] ';
Allocate channel C2 device type disk connect 'sys/[email protected] ';
Restore database until SCN 1118215;
Recover database until SCN 1118215;
}
2> 3> 4> 5> 6>
Using target database control file instead of recovery catalog -- Non-catalog mode. In this mode, backup control files are very important.
Allocated channel: C1
Channel C1: SID = 142 instance = orcl1 devtype = Disk
Allocated channel: C2
Channel C2: SID = 151 instance = orcl2 devtype = Disk
Starting restore at 27-sep-10
Channel C1: Starting datafile backupset restore
Channel C1: specifying datafile (s) to restore from backup set
Restoring datafile 00001 to + Data/orcl/datafile/system.276.730181051
Restoring datafile 00004 to + Data/orcl/datafile/users.279.730181053
Restoring datafile 00007 to + Data/orcl/datafile/anhuianqing. DBF
Channel C1: reading from backup piece/u01/backup/orcl_2blotmnp_1_20171000020100927
Channel C2: Starting datafile backupset restore
Channel C2: specifying datafile (s) to restore from backup set
Restoring datafile 00002 to + Data/orcl/datafile/undotbs1.278.730181053
Restoring datafile 00003 to + Data/orcl/datafile/sysaux.277.730181053
Restoring datafile 00005 to + Data/orcl/datafile/undotbs2.284.730181347
Channel C2: reading from backup piece/u01/backup/orcl_2clotmno_00000000000020100927
Channel C2: restored backup piece 1
Piece handle =/u01/backup/orcl_2clotmno_0000000020100927 tag = orcl_hot_db_bk
Channel C2: restore complete, elapsed time: 00:03:58
Channel C1: restored backup piece 1
Piece handle =/u01/backup/orcl_2blotmnp_1_1_20100927 tag = orcl_hot_db_bk
Channel C1: restore complete, elapsed time: 00:05:47
Finished restore at 27-sep-10
Starting recover at 27-sep-10
Starting media recovery
Archive log thread 1 sequence 44 is already on disk as file/u02/racw.arch/201744_730181171.dbf
Archive log thread 2 sequence 38 is already on disk as file/u02/racw.arch/2_38_730181171.dbf
Archive log thread 1 sequence 1 is already on disk as file/u02/racw.arch/zookeeper 730784806.dbf
Archive log thread 2 sequence 1 is already on disk as file/u02/rac2_arch/2_2017730784806.dbf
Archive log filename =/u02/racw.arch/201744_730181171.dbf thread = 1 sequence = 44
Archive log filename =/u02/racw.arch/2_38_730181171.dbf thread = 2 sequence = 38
Archive log filename =/u02/rac2_arch/2_316730784806.dbf thread = 2 sequence = 1
Media recovery complete, elapsed time: 00:00:09
Finished recover at 27-sep-10
Released channel: C1
Released channel: C2
After the restoration is complete, use alter database open resetlogs to open the database.
Summary:
All of the above are simple tests, and the specific situation should be taken into consideration. After much experience is accumulated, you will know how to deal with it. In short, backup is more important than everything. With backup, recovery is possible.
-- This article from: http://blog.csdn.net/tianlesoftware/article/details/5909912