//备参数文件配置
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(ora,dg)'
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ora','/u01/data02'
*.LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/ora','/u01/data02'
*.DB_UNIQUE_NAME=dg
//监听配置:UR=A
dg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.230)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dg)
(UR=A)
)
)
//duplicate命令自动更改数据库文件位置到/u01/data02
//auxiliary为备数据库。
rman target sys/oracle@ora auxiliary sys/oracle@dg
duplicate target database for standby from active database
[oracle@db01 data01]$ rman target sys/oracle@ora auxiliary sys/oracle@dg
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jul 5 20:43:09 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA (DBID=1662995064)
connected to auxiliary database: ORA (not mounted)
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 05-JUL-20
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=41 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwora' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg' ;
}
executing Memory Script
Starting backup at 05-JUL-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
Finished backup at 05-JUL-20
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/u01/data02/control01.ctl';
}
executing Memory Script
Starting backup at 05-JUL-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_ora.f tag=TAG20200705T204328 RECID=2 STAMP=1044996208
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-JUL-20
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/data02/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/data02/system01.dbf";
set newname for datafile 2 to
"/u01/data02/sysaux01.dbf";
set newname for datafile 3 to
"/u01/data02/undotbs01.dbf";
set newname for datafile 4 to
"/u01/data02/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/data02/system01.dbf" datafile
2 auxiliary format
"/u01/data02/sysaux01.dbf" datafile
3 auxiliary format
"/u01/data02/undotbs01.dbf" datafile
4 auxiliary format
"/u01/data02/users01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/data02/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 05-JUL-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/ora/system01.dbf
output file name=/u01/data02/system01.dbf tag=TAG20200705T204335
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/ora/sysaux01.dbf
output file name=/u01/data02/sysaux01.dbf tag=TAG20200705T204335
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/ora/undotbs01.dbf
output file name=/u01/data02/undotbs01.dbf tag=TAG20200705T204335
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/ora/users01.dbf
output file name=/u01/data02/users01.dbf tag=TAG20200705T204335
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-JUL-20
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=1044996227 file name=/u01/data02/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=1044996227 file name=/u01/data02/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=1044996227 file name=/u01/data02/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=1044996227 file name=/u01/data02/users01.dbf
Finished Duplicate Db at 05-JUL-20