If the directory on the master and backup is different, add the files in the pfile file on both ends. If the directory is the same, add the following files:
*. Log_file_name_convert = '/u01/oradata/orcl/', '/u02/oradata/orcl /'
*. Db_file_name_convert = '/u01/oradata/orcl/', '/u02/oradata/orcl /'
- -- Generate a full backup on the master end, including archiving logs and standby Control Files
- [Oracle @ source bak] rman target/
- Recovery Manager: Release 10.2.0.1.0-Production on Thursday April 26 23:22:58 2012
- Copyright (c) 1982,200 5, Oracle. All rights reserved.
- Connected to target database: ORCL (DBID = 1309351439)
- RMAN> run {
- Backup FORMAT '/home/oracle/bak/orcl _ % U _ % t'
- Database
- Include current controlfile for standby
- Plus archivelog
- ;
- } 2> 3> 4> 5> 6> 7>
- -- Copy the full backup to the backup
- [Oracle @ source bak] $ scp * 192.168.1.103: // home/oracle/bak
- -- Start pfile to nomount on the slave end and create a spfile;
- [Oracle @ target dbs] $ sqlplus/as sysdba
- SQL * Plus: Release 10.2.0.1.0-Production on Friday April 27 23:07:28 2012
- Copyright (c) 1982,200 5, Oracle. All rights reserved.
- Connected to an idle instance.
- SQL> startup pfile = initorcl. ora nomount;
- ORACLE instance started.
- Total System Global Area 276824064 bytes
- Fixed Size 2020160 bytes
- Variable Size 96472256 bytes
- Database Buffers 176160768 bytes
- Redo Buffers 2170880 bytes
- SQL> create spfile from pfile = 'initorcl. ora ';
- File created.
- -- Create dg using RMAN Duplicate on the master end. If the directory of the data file is the same as that of the redo log file, add nofilenamecheck. Otherwise, no need to add
- [Oracle @ source bak] $ rmant an target/
- Recovery Manager: Release 10.2.0.1.0-Production on 4 27 23:08:23 2012
- Copyright (c) 1982,200 5, Oracle. All rights reserved.
- Connected to target database: ORCL (DBID = 1309351439)
- RMAN> connect auxiliary sys/oracle @ orcl_st
- Connected to auxiliary database: ORCL (not mounted)
- RMAN> run {
- Duplicate target database
- For standby nofilenamecheck dorecover;
- } 2> 3> 4>
- Starting Duplicate Db at 2012-04-27 23:08:45
- Using target database control file instead of recovery catalog
- Allocated channel: ORA_AUX_DISK_1
- Channel ORA_AUX_DISK_1: sid = 155 devtype = DISK
- Contents of Memory Script:
- {
- Set until scn 611334;
- Restore clone standby controlfile;
- SQL clone 'alter database mount standby database ';
- }
- Executing Memory Script
- Executing command: SET until clause
- Starting restore at 2012-04-27 23:08:45
- Using channel ORA_AUX_DISK_1
- Channel ORA_AUX_DISK_1: starting datafile backupset restore
- Channel ORA_AUX_DISK_1: restoring control file
- Channel ORA_AUX_DISK_1: reading from backup piece/home/oracle/bak/orcl_0cn9gs8i_1_1_20120427
- Channel ORA_AUX_DISK_1: restored backup piece 1
- Piece handle =/home/oracle/bak/orcl_0cn9gs8i_1_1_20427 tag = TAG20120427T223632
- Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
- Output filename =/home/oracle/oradata/orcl/control01.ctl
- Output filename =/home/oracle/oradata/orcl/control02.ctl
- Output filename =/home/oracle/oradata/orcl/control03.ctl
- Finished restore at 23:08:47
- SQL statement: alter database mount standby database
- Released channel: ORA_AUX_DISK_1
- Contents of Memory Script:
- {
- Set until scn 611334;
- Set newname for tempfile 1
- "/Home/oracle/oradata/orcl/temp01.dbf ";
- Switch clone tempfile all;
- Set newname for datafile 1
- "/Home/oracle/oradata/orcl/system01.dbf ";
- Set newname for datafile 2
- "/Home/oracle/oradata/orcl/undotbs01.dbf ";
- Set newname for datafile 3
- "/Home/oracle/oradata/orcl/sysaux01.dbf ";
- Set newname for datafile 4
- "/Home/oracle/oradata/orcl/users01.dbf ";
- Restore
- Check readonly
- Clone database
- ;
- }
- Executing Memory Script
- Executing command: SET until clause
- Executing command: SET NEWNAME
- Renamed temporary file 1 to/home/oracle/oradata/orcl/temp01.dbf in control file
- Executing command: SET NEWNAME
- Executing command: SET NEWNAME
- Executing command: SET NEWNAME
- Executing command: SET NEWNAME
- Starting restore at 2012-04-27 23:08:53
- Allocated channel: ORA_AUX_DISK_1
- Channel ORA_AUX_DISK_1: sid = 155 devtype = DISK
- Channel ORA_AUX_DISK_1: starting datafile backupset restore
- Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
- Restoring datafile 00001 to/home/oracle/oradata/orcl/system01.dbf
- Restoring datafile 00002 to/home/oracle/oradata/orcl/undotbs01.dbf
- Restoring datafile 00003 to/home/oracle/oradata/orcl/sysaux01.dbf
- Restoring datafile 00004 to/home/oracle/oradata/orcl/users01.dbf
- Channel ORA_AUX_DISK_1: reading from backup piece/home/oracle/bak/orcl_0bn9gs3g_1_1_20120427
- Channel ORA_AUX_DISK_1: restored backup piece 1
- Piece handle =/home/oracle/bak/orcl_0bn9gs3g_0000000020120427 tag = TAG20120427T223632
- Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
- Finished restore at 23:10:10
- Contents of Memory Script:
- {
- Switch clone datafile all;
- }
- Executing Memory Script
- Datafile 1 switched to datafile copy
- Input datafile copy recid = 5 stamp = 781744210 filename =/home/oracle/oradata/orcl/system01.dbf
- Datafile 2 switched to datafile copy
- Input datafile copy recid = 6 stamp = 781744210 filename =/home/oracle/oradata/orcl/undotbs01.dbf
- Datafile 3 switched to datafile copy
- Input datafile copy recid = 7 stamp = 781744210 filename =/home/oracle/oradata/orcl/sysaux01.dbf
- Datafile 4 switched to datafile copy
- Input datafile copy recid = 8 stamp = 781744210 filename =/home/oracle/oradata/orcl/users01.dbf
- Contents of Memory Script:
- {
- Set until scn 611334;
- Recover
- Standby
- Clone database
- Delete archivelog
- ;
- }
- Executing Memory Script
- Executing command: SET until clause
- Starting recover at 23:10:10
- Using channel ORA_AUX_DISK_1
- Starting media recovery
- Archive log thread 1 sequence 13 is already on disk as file/home/oracle/archive/1_13_781570707.dbf
- Archive log filename =/home/oracle/archive/1_13_781570707.dbf thread = 1 sequence = 13
- Media recovery complete, elapsed time: 00:00:02
- Finished recover at 23:10:14
- Finished Duplicate Db at 23:10:14
After completion, the slave database starts to the mount state, and then verifies the DG.
For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12