RMAN Restore Optimizat…
来源:互联网 发布:施耐德m258编程软件 编辑:程序博客网 时间:2024/05/16 17:14
In thisDocument
Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.3 andlaterInformation in this document applies to any platform.
Goal
How can I get restore optimization to skip already restoreddatafiles when datafiles have Oracle Managed File (OMF)names?
Solution
The following information applies to all use of Oracle ManagedFiles (OMF) and is not limited toASM.
The execution of restore optimization, NOT re-restoring an alreadyrestored file from the same backup, is dependent on if "setnewname" is used by the restore command.
When the database is restored to the same location, restoreoptimization will occur automatically.
Please review the following test case:
......................................
startup nomount;
connected to target database (not started)
Oracle instance started
Total System Global Area 698875904 bytes
Fixed Size 1346468 bytes
Variable Size 427820124 bytes
Database Buffers 264241152 bytes
Redo Buffers 5468160 bytes
RMAN> restore controlfile from'+FRA/l112asm/autobackup/2014_02_01/n_838350675.521.838350679';
restore controlfile from'+FRA/l112asm/autobackup/2014_02_01/n_838350675.521.838350679';
Starting restore at 04-FEB-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=+DATA/l112asm/controlfile/current.389.838607803
Finished restore at 04-FEB-14
RMAN> report schema;
Starting implicit crosscheck backup at 04-FEB-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 04-FEB-14
Starting implicit crosscheck copy at 04-FEB-14
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 04-FEB-14
searching for all files in the recovery area
cataloging files...
cataloging done
RMAN-06139: WARNING: control file is not current for REPORTSCHEMA
Report of database schema for database with db_unique_nameL112ASM
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- -------------------------------
1 0 SYSTEM *** +DATA/l112asm/datafile/system.423.838350483
2 0 SYSAUX *** +DATA/l112asm/datafile/sysaux.581.838350507
3 0 UNDOTBS1 ***+DATA/l112asm/datafile/undotbs1.580.838350533
4 0 USERS *** +DATA/l112asm/datafile/users.390.838350537
RMAN> restore database;
Starting restore at 04-FEB-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backupset
channel ORA_DISK_1: restoring datafile 00002 to+DATA/l112asm/datafile/sysaux.581.838350507
channel ORA_DISK_1: reading from backup piece+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.385.838346053
channel ORA_DISK_1: piecehandle=+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.385.838346053tag=TAG20140201T015348
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backupset
channel ORA_DISK_1: restoring datafile 00003 to+DATA/l112asm/datafile/undotbs1.580.838350533
channel ORA_DISK_1: reading from backup piece+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.387.838346079
user interrupt received
RMAN-00571:===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS===============
RMAN-00571:===========================================================
RMAN-03002: failure of restore command at 02/04/2014 02:38:59
RMAN-03099: job cancelled at user request
RMAN-06139: WARNING: control file is not current for REPORTSCHEMA
Report of database schema for database with db_unique_nameL112ASM
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- -------------------------------
1 0 SYSTEM *** +DATA/l112asm/datafile/system.423.838350483
2 600 SYSAUX *** +DATA/l112asm/datafile/sysaux.423.838607911
3 0 UNDOTBS1 ***+DATA/l112asm/datafile/undotbs1.580.838350533
4 0 USERS *** +DATA/l112asm/datafile/users.390.838350537
FROM ALERT:
-------------------
Tue Feb 04 02:38:53 2014
Full restore complete of datafile 2+DATA/l112asm/datafile/sysaux.423.838607911. Elapsed time:0:00:22
Tue Feb 04 02:39:40 2014
When using "set newname" within a restore script, then you areasking rman to restore to a brand new name. For non-OMF names, when'set newname' is used, the name is completely specified and henceRMAN has the ability to check that file has already restored.However, with OMF, when something like the following is used:
set newname for datafile 1 to '+DATA';
or
set newname for datafile 1 to new;
RMAN does not have enough information to identify an alreadyrestored file. There is an enhancement, bug 5683952, requestingthis functionality be added in future.
However, until this enhancement is implemented, you can work aroundthis problem by changing the "set newname" to the full datafilename already restored.
When using 'set newname' once RMAN completes restore of a datafile,it will record this information into the v$datafile_copy view andwithin RMAN can be viewed using:
RMAN> list copy of database;
Keeping this in mind, the following query can be used to generatethe necessary "set newname for datafile" syntax:
set linesize 1000;
select 'set newname for datafile ' || file# || ' to '
You can get a list of all the datafiles NOT restored using:
select file#, name from v$datafile where file# not in (select file#from v$datafile_copy where status = 'A');
In summary, in order to get restore optimization to work, you willneed to modify the script.
Please review the following test case:
......................................
Starting restore at 04-FEB-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=+DATA/l112asm/controlfile/current.390.838604453
Finished restore at 04-FEB-14
RMAN> alter database mount;
alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> run
2> {
3> set newname for database to new;
4> restore database;
5> }
executing command: SET NEWNAME
Starting restore at 04-FEB-14
Starting implicit crosscheck backup at 04-FEB-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 04-FEB-14
Starting implicit crosscheck copy at 04-FEB-14
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 04-FEB-14
searching for all files in the recovery area
cataloging files...
cataloging done
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backupset
channel ORA_DISK_1: restoring datafile 00002 to +DATA
channel ORA_DISK_1: reading from backup piece+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.385.838346053
channel ORA_DISK_1: piecehandle=+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.385.838346053tag=TAG20140201T015348
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backupset
channel ORA_DISK_1: restoring datafile 00003 to +DATA
channel ORA_DISK_1: reading from backup piece+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.387.838346079
user interrupt received
RMAN-00571:===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS===============
RMAN-00571:===========================================================
RMAN-03002: failure of restore command at 02/04/2014 02:12:25
RMAN-03099: job cancelled at user request
RMAN> **end-of-file**
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - --------------- ---------- ---------------
23 2 A 04-FEB-14 3686476254548 01-FEB-14
IN ALERT:
--------------
Tue Feb 04 02:12:19 2014
Full restore complete of datafile 2 to datafile copy+DATA/l112asm/datafile/sysaux.580.838606317. Elapsed time:0:00:21
IN SQLPLUS:
-----------
SQL> select 'set newname for datafile ' || file# || ' to '
'SETNEWNAMEFORDATAFILE'||FILE#||'TO'||''''||NAME||''''||';'
--------------------------------------------------------------
set newname for datafile 1 to new;
set newname for datafile 2 to'+DATA/l112asm/datafile/sysaux.580.838606317';
set newname for datafile 3 to new;
set newname for datafile 4 to new;
Things to note:
1. The sql presented assumes you have only ONE datafile copy withinthe view with a status of AVAILABLE (A). If multiple copies exist,the query needs to be modified.
2. The sql presented assumes you are using "to new" as part of the'set newname'. This creates the datafile in the location specifiedin db_create_file_dest. If this is not set, you must modify thequery to set an appropriate location, such as "to +DATA"
RMAN script is modified to be:
----------------------------------------
run
{
set newname for datafile 1 to new;
set newname for datafile 2 to'+DATA/l112asm/datafile/sysaux.580.838606317';
set newname for datafile 3 to new;
set newname for datafile 4 to new;
restore database;
}
RE-EXECUTING the RESTORE:
-------------------------------------------
2> {
3> set newname for datafile 1 to new;
4> set newname for datafile 2 to'+DATA/l112asm/datafile/sysaux.580.838606317';
5> set newname for datafile 3 to new;
6> set newname for datafile 4 to new;
7> restore database;
8> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 04-FEB-14
using channel ORA_DISK_1
datafile 2 is already restored to file+DATA/l112asm/datafile/sysaux.580.838606317
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backupset
channel ORA_DISK_1: restoring datafile 00003 to +DATA
channel ORA_DISK_1: reading from backup piece+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.387.838346079
channel ORA_DISK_1: piecehandle=+FRA/l112asm/backupset/2014_02_01/nnndf0_tag20140201t015348_0.387.838346079tag=TAG20140201T015348
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
References
BUG:5683952- RESTORE OPTIMIZATION DOESN'T WORK IF USING OMF.NOTE:873583.1 - Reusing the Datafiles Created By the FailedDatabase Duplication Attempt Using OMF Names
- RMAN Restore Optimizat…
- cannot restore segment…
- Windows 7 - Services - Restore D…
- RMAN-08591: WARNING: i…
- rman catalog 注销目标…
- RMAN-06054 report duri…
- rman 总结 (list r…
- RMAN-20004: target database name…
- RMAN-06207: WARNING: 1 objects c…
- RMAN-03014: implicit resync of r…
- RMAN备份类型 - 备份集(backupset)…
- Oracle Rman 命令详解(L…
- 转帖:完整的ORACLE RMAN 备份恢复…
- RMAN备份错误ORA-01264: Unable to…
- 关于RMAN恢复中的switch database …
- RMAN-6556 datafile %s&…
- RMAN 恢复实际操作(模拟数据文件…
- RMAN PARALLELISM与filesperset参…
- freemarker循环获取list中map的值
- INS-06101 IP ADRESS OF LOCALHOST
- IMP-00038: Could not&n…
- How to Reset the&…
- Solaris查看INODE信息
- RMAN Restore Optimizat…
- 索引分析后index_stats里没数据?
- Linux按文件夹大小排序命令 d…
- python:os.chdir() & sys.path.append() & No module name XXX
- std::list::splice
- ls命令列出某一天以及文件名模糊查…
- 推拉模型push/pull
- Pull解析xml
- android studio安装app异常-DELETE_FAILED_INTERNAL_ERROR