RMAN DUPLICATE Without Connecting To Target DB For Both Disk & Tape_1375864.1
Perform Backup Based RMAN DUPLICATE Without Connecting To Target Database For Both Disk & Tape Backups (Doc ID 1375864.1)
Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.
*** Check on currency 17-Apr-2013 ***
Goal
If you are performing a backup based RMAN duplicate and using a recovery catalog as well, it is not required to connect to the source database as TARGET in RMAN.
This technique is advantageous where network connections from the auxiliary host to the source database are restricted or prone to intermittent disruptions. In duplication without a TARGET connection, the source database is unaffected by the duplication.
For this RMAN duplication, we will connect rman to the auxiliary instance and recovery catalog database and run duplicate command similar to below:
duplicate database ora11gR2 dbid 82843743 to dup11gR2 until scn 274615 db_file_name_convert 'ora11gR2','dup11gR2' spfile parameter_value_convert 'ora11gR2','dup11gR2' set log_file_name_convert 'ora11gR2','dup11gR2';
Section below has more details regarding the complete step by step procedure. Note that:
b) Use of recovery catalog is mandatory
c) If you do not have a recovery catalog, you can still perform RMAN DUPLICATE without connecting to the target database but ONLY for disk backups. This is achieved via BACKUP LOCATION clause of DUPLICATE command i.e.
DUPLICATE DATABASE TO dupdb UNTIL TIME "TO_DATE('11/01/2007 14:00:00', 'MM/DD/YYYY HH24:MI:SS')" SPFILE BACKUP LOCATION '/prod_backups' NOFILENAMECHECK;
Below document has more details for this procedure:
Document 1113713.1 Creation Of Rman Duplicate Without Target And Recovery Catalog Connection
#
Additional Note: Targetless DUPLCIATE at same HOST as TARGET
If you are using TARGETLESS Duplicate using 'BACKUP LOCATION' on the same Host/Node as the Target exist
Then you must make sure that no existing files from TARGET are overwritten.
This is done by CONVERT Parameters as shown, but you must also ensure to get controlfile to a unique location
so using -> set control_files='
.
Otherwise it is possible that this error might be encountered because rman will restore
the spfile and then the control_files setting would point to the source/target db controlfile:
RMAN-06136: ORACLE error from auxiliary database: ORA-00600: internal error code, arguments: [kccsbck_first], [2], [4191010098], [], [],
Example:
run {
allocate auxiliary channel ch1 type disk;
duplicate database ora11gR2 dbid 82843743 to dup11gR2
until scn 274615
db_file_name_convert 'ora11gR2','dup11gR2'
spfile
parameter_value_convert 'ora11gR2','dup11gR2'
set control_files '/oradata/dup11gR2/control01.ctl'
set log_file_name_convert 'ora11gR2','dup11gR2';
}
Solution
+ Ensure that you have a full database backup and subsequent archivelog backups to perform backup based duplicate. If you currently do not have a backup but are planning to take a full database backup for duplication, you can use script such as below for the same. Ensure that you connect to the recovery catalog database while taking the backup.
RMAN> backup format '/oradata/backup/%U' database; RMAN> backup format '/oradata/backup/%U' archivelog all;
+ If you need to create the clone database on another server, we will have to move the backups from the source server to the destination server in exactly the same location where it was created on the source server. This step is needed only for disk backups. If you take backups to tape, this step is not applicable
+ It is not required to create a initialization parameter file for the auxiliary (clone) database. We will restore the spfile from source database backup during duplicate using the SPFILE clause.
+ To start duplicate, go to the auxiliary (clone) database server, set the appropriate ORACLE_HOME and ORACLE_SID (SID to be used for clone database) and start RMAN by connecting to ONLY the recovery catalog and the auxiliary instance. Start the auxiliary instance in NOMOUNT mode. Note that RMAN will start the auxiliary instance in NOMOUNT mode even though we have not yet created a initialization parameter file for the auxiliary instance:
[oracle@vmOraLinux6 ora11gR2]$ export ORACLE_SID=dup11gR2 [oracle@vmOraLinux6 ora11gR2]$ rman auxiliary / catalog rman/rman@ORA11GR2 Recovery Manager: Release 11.2.0.3.0 - Production on Thu Nov 10 13:56:42 2011 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database connected to auxiliary database (not started) RMAN> startup clone nomount; startup failed: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/orasoft/rdbms/11.2.0.3/dbs/initdup11gR2.ora' starting Oracle instance without parameter file for retrieval of spfile Oracle instance started Total System Global Area 158662656 bytes Fixed Size 2226456 bytes Variable Size 92276456 bytes Database Buffers 58720256 bytes Redo Buffers 5439488 bytes
+ We will use a script such as below to perform RMAN DUPLICATE:
run { allocate auxiliary channel ch1 type disk; duplicate database ora11gR2 dbid 82843743 to dup11gR2 until scn 274615 db_file_name_convert 'ora11gR2','dup11gR2' spfile parameter_value_convert 'ora11gR2','dup11gR2' set log_file_name_convert 'ora11gR2','dup11gR2'; }
Note that:
b) If your backups exist on tape, allocate SBT type auxiliary channel instead of DISK channel
c) I have specified UNTIL SCN 274615 clause here for duplicate. This was derived from the "Next SCN" value of the most recently backed up archivelog as per 'list backup of archivelog all' command. You can however also use UNTIL TIME clause to perform duplication till a particular time
d) We have specified DB_FILE_NAME_CONVERT and LOG_FILE_NAME_COVERT since the datafiles and redologs for the clone database will not reside in the same location as the source database. For example, the datafiles of my source database reside in location '/oradata/ora11gR2' location. With the above DB_FILE_NAME_CONVERT clause, the datafiles for clone database will be restored in location '/oradata/dup11gR2'
If the clone database resides on different server and you want the clone database datafiles to be restored in the same location as source, you need to skip DB_FILE_NAME_CONVERT / LOG_FILE_NAME_COVERT parameters and instead add NOFILENAMECHECK clause
e) SPFILE clause in the DUPLICATE command will restore the spfile from source database backup and will be used by the clone database. parameter_value_convert clause modifies any parameter which has a value with string 'ora11gR2' to 'dup11gR2'. For example, in my source database spfile, diagnostic_dest parameter has been defined as '/oradata/ora11gR2/dump'. This will be modified to '/oradata/dup11gR2/dump' after the spfile is restored on the clone database.
Here is the sample output from above DUPLICATE command:
RMAN> run { 2> allocate auxiliary channel ch1 type disk; 3> duplicate database ora11gR2 dbid 82843743 to dup11gR2 4> until scn 274615 5> db_file_name_convert 'ora11gR2','dup11gR2' 6> spfile 7> parameter_value_convert 'ora11gR2','dup11gR2' 8> set log_file_name_convert 'ora11gR2','dup11gR2'; 9> } allocated channel: ch1 channel ch1: SID=102 device type=DISK Starting Duplicate Db at 10-NOV-11 contents of Memory Script: { set until scn 274615; restore clone spfile to '/orasoft/rdbms/11.2.0.3/dbs/spfiledup11gR2.ora'; sql clone "alter system set spfile= ''/orasoft/rdbms/11.2.0.3/dbs/spfiledup11gR2.ora''"; } executing Memory Script executing command: SET until clause Starting restore at 10-NOV-11 WARNING: A restore time was estimated based on the supplied UNTIL SCN channel ch1: starting datafile backup set restore channel ch1: restoring SPFILE output file name=/orasoft/rdbms/11.2.0.3/dbs/spfiledup11gR2.ora channel ch1: reading from backup piece /oradata/backup/06mraa9p_1_1 channel ch1: piece handle=/oradata/backup/06mraa9p_1_1 tag=TAG20111110T130712 channel ch1: restored backup piece 1 channel ch1: restore complete, elapsed time: 00:00:01 Finished restore at 10-NOV-11 sql statement: alter system set spfile= ''/orasoft/rdbms/11.2.0.3/dbs/spfiledup11gR2.ora'' contents of Memory Script: { sql clone "alter system set db_name = ''DUP11GR2'' comment= ''duplicate'' scope=spfile"; sql clone "alter system set audit_file_dest = ''/oradata/dup11gR2/dump'' comment= '''' scope=spfile"; sql clone "alter system set control_files = ''/oradata/dup11gR2/control01.ctl'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest = ''/oradata/dup11gR2/fra'' comment= '''' scope=spfile"; sql clone "alter system set diagnostic_dest = ''/oradata/dup11gR2/dump'' comment= '''' scope=spfile"; sql clone "alter system set log_file_name_convert = ''ora11gR2'', ''dup11gR2'' comment= '''' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set db_name = ''DUP11GR2'' comment= ''duplicate'' scope=spfile sql statement: alter system set audit_file_dest = ''/oradata/dup11gR2/dump'' comment= '''' scope=spfile sql statement: alter system set control_files = ''/oradata/dup11gR2/control01.ctl'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest = ''/oradata/dup11gR2/fra'' comment= '''' scope=spfile sql statement: alter system set diagnostic_dest = ''/oradata/dup11gR2/dump'' comment= '''' scope=spfile sql statement: alter system set log_file_name_convert = ''ora11gR2'', ''dup11gR2'' comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 409194496 bytes Fixed Size 2228864 bytes Variable Size 255856000 bytes Database Buffers 142606336 bytes Redo Buffers 8503296 bytes allocated channel: ch1 channel ch1: SID=59 device type=DISK contents of Memory Script: { set until scn 274615; sql clone "alter system set db_name = ''ORA11GR2'' comment= ''Modified by RMAN duplicate'' scope=spfile"; sql clone "alter system set db_unique_name = ''DUP11GR2'' comment= ''Modified by RMAN duplicate'' scope=spfile"; shutdown clone immediate; startup clone force nomount restore clone primary controlfile; alter clone database mount; } executing Memory Script executing command: SET until clause sql statement: alter system set db_name = ''ORA11GR2'' comment= ''Modified by RMAN duplicate'' scope=spfile sql statement: alter system set db_unique_name = ''DUP11GR2'' comment= ''Modified by RMAN duplicate'' scope=spfile Oracle instance shut down Oracle instance started Total System Global Area 409194496 bytes Fixed Size 2228864 bytes Variable Size 255856000 bytes Database Buffers 142606336 bytes Redo Buffers 8503296 bytes allocated channel: ch1 channel ch1: SID=58 device type=DISK Starting restore at 10-NOV-11 channel ch1: starting datafile backup set restore channel ch1: restoring control file channel ch1: reading from backup piece /oradata/backup/06mraa9p_1_1 channel ch1: piece handle=/oradata/backup/06mraa9p_1_1 tag=TAG20111110T130712 channel ch1: restored backup piece 1 channel ch1: restore complete, elapsed time: 00:00:01 output file name=/oradata/dup11gR2/control01.ctl Finished restore at 10-NOV-11 database mounted contents of Memory Script: { set until scn 274615; set newname for datafile 1 to "/oradata/dup11gR2/system01.dbf"; set newname for datafile 2 to "/oradata/dup11gR2/sysaux01.dbf"; set newname for datafile 3 to "/oradata/dup11gR2/undotbs01.dbf"; set newname for datafile 4 to "/oradata/dup11gR2/users01.dbf"; set newname for datafile 5 to "/oradata/dup11gR2/rmantbs01.dbf"; restore clone database ; } executing Memory Script executing command: SET until clause executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 10-NOV-11 channel ch1: starting datafile backup set restore channel ch1: specifying datafile(s) to restore from backup set channel ch1: restoring datafile 00001 to /oradata/dup11gR2/system01.dbf channel ch1: restoring datafile 00002 to /oradata/dup11gR2/sysaux01.dbf channel ch1: restoring datafile 00003 to /oradata/dup11gR2/undotbs01.dbf channel ch1: restoring datafile 00004 to /oradata/dup11gR2/users01.dbf channel ch1: restoring datafile 00005 to /oradata/dup11gR2/rmantbs01.dbf channel ch1: reading from backup piece /oradata/backup/05mraa81_1_1 channel ch1: piece handle=/oradata/backup/05mraa81_1_1 tag=TAG20111110T130712 channel ch1: restored backup piece 1 channel ch1: restore complete, elapsed time: 00:01:27 Finished restore at 10-NOV-11 contents of Memory Script: { switch clone datafile all; } executing Memory Script datafile 1 switched to datafile copy input datafile copy RECID=6 STAMP=766851445 file name=/oradata/dup11gR2/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=7 STAMP=766851445 file name=/oradata/dup11gR2/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=8 STAMP=766851445 file name=/oradata/dup11gR2/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=9 STAMP=766851445 file name=/oradata/dup11gR2/users01.dbf datafile 5 switched to datafile copy input datafile copy RECID=10 STAMP=766851445 file name=/oradata/dup11gR2/rmantbs01.dbf contents of Memory Script: { set until scn 274615; recover clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 10-NOV-11 starting media recovery archived log for thread 1 with sequence 16 is already on disk as file /oradata/ora11gR2/fra/ORA11GR2/archivelog/2011_11_10/o1_mf_1_16_7cq0hxw9_.arc archived log for thread 1 with sequence 17 is already on disk as file /oradata/ora11gR2/fra/ORA11GR2/archivelog/2011_11_10/o1_mf_1_17_7cq0j7ng_.arc archived log file name=/oradata/ora11gR2/fra/ORA11GR2/archivelog/2011_11_10/o1_mf_1_16_7cq0hxw9_.arc thread=1 sequence=16 archived log file name=/oradata/ora11gR2/fra/ORA11GR2/archivelog/2011_11_10/o1_mf_1_17_7cq0j7ng_.arc thread=1 sequence=17 media recovery complete, elapsed time: 00:00:01 Finished recover at 10-NOV-11 Oracle instance started Total System Global Area 409194496 bytes Fixed Size 2228864 bytes Variable Size 272633216 bytes Database Buffers 125829120 bytes Redo Buffers 8503296 bytes contents of Memory Script: { sql clone "alter system set db_name = ''DUP11GR2'' comment= ''Reset to original value by RMAN'' scope=spfile"; sql clone "alter system reset db_unique_name scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set db_name = ''DUP11GR2'' comment= ''Reset to original value by RMAN'' scope=spfile sql statement: alter system reset db_unique_name scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 409194496 bytes Fixed Size 2228864 bytes Variable Size 272633216 bytes Database Buffers 125829120 bytes Redo Buffers 8503296 bytes allocated channel: ch1 channel ch1: SID=58 device type=DISK sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP11GR2" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 ( '/oradata/dup11gR2/redo01.log' ) SIZE 50 M REUSE, GROUP 2 ( '/oradata/dup11gR2/redo02.log' ) SIZE 50 M REUSE, GROUP 3 ( '/oradata/dup11gR2/redo03.log' ) SIZE 50 M REUSE DATAFILE '/oradata/dup11gR2/system01.dbf' CHARACTER SET WE8MSWIN1252 contents of Memory Script: { set newname for tempfile 1 to "/oradata/dup11gR2/temp01.dbf"; switch clone tempfile all; catalog clone datafilecopy "/oradata/dup11gR2/sysaux01.dbf", "/oradata/dup11gR2/undotbs01.dbf", "/oradata/dup11gR2/users01.dbf", "/oradata/dup11gR2/rmantbs01.dbf"; switch clone datafile all; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /oradata/dup11gR2/temp01.dbf in control file cataloged datafile copy datafile copy file name=/oradata/dup11gR2/sysaux01.dbf RECID=1 STAMP=766851460 cataloged datafile copy datafile copy file name=/oradata/dup11gR2/undotbs01.dbf RECID=2 STAMP=766851460 cataloged datafile copy datafile copy file name=/oradata/dup11gR2/users01.dbf RECID=3 STAMP=766851460 cataloged datafile copy datafile copy file name=/oradata/dup11gR2/rmantbs01.dbf RECID=4 STAMP=766851460 datafile 2 switched to datafile copy input datafile copy RECID=1 STAMP=766851460 file name=/oradata/dup11gR2/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=2 STAMP=766851460 file name=/oradata/dup11gR2/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=766851460 file name=/oradata/dup11gR2/users01.dbf datafile 5 switched to datafile copy input datafile copy RECID=4 STAMP=766851460 file name=/oradata/dup11gR2/rmantbs01.dbf contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script database opened Finished Duplicate Db at 10-NOV-11 released channel: ch1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1160627/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Table is specified twice, both as a target for 'UPDATE' and as a separate source
- RMAN Duplicate RAC to Single Instance
- rman duplicate操作手冊
- Oracle rman duplicate遷移測試Oracle
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- ORA-15020:discoverd duplicate ASM disk "XXX_CJCDB_OCR_0002"ASM
- RMAN-03009: failure of backup command on ORA_DISK_1 channelAI
- duplicate遇到RMAN-05535: warning: All redo log files were not defined
- DUMP-CX_SY_OPEN_SQL_DB-DBSQL_DUPLICATE_KEY_ERRORSQLError
- 【DG】備庫RMAN還原方式搭建DG(不使用duplicate命令)
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid相同UXDatabaseOracle
- Master of Both —— Trie的應用AST
- SCSS without和withCSS
- move linux os from disk A to disk B with 0 lossLinux
- NTFS Disk by Omi NTFS Mac;NTFS Disk by Omi NTFSMac
- Openfiler配置ISCSI Target及FC Target
- Performance Without the Event LoopORMOOP
- scp without interative password
- 【RMAN】RMAN備份至ASMASM
- ssh-add 報錯:Error connecting to agent No such file or directoryError
- docker_sshd without passwordDocker
- Installing Windows Features without InternetWindows
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- 【RMAN】RMAN的備份保留策略
- CSS E:targetCSS
- currentTarget VS target
- [LeetCode] Find the Duplicate NumberLeetCode
- yum error - package is a duplicate withErrorPackage
- ORACLE rman與RMAN-00054&ORA-09945Oracle
- WebStorm Exception: ...requested without authorization...WebORMException
- ESP32-MicroPython without ThonnyPython
- [Flutter翻譯]Flutter without FlutterFlutter
- RMAN(轉)
- iOS 配置多targetiOS
- JavaScript event.targetJavaScript
- firewalld: zone的target
- 【RMAN】Oracle rman 常用命令參考Oracle
- RMAN恢復之RMAN-06555處理