[oracle@qs-dmm-rh2 dbs]$ rman target sys/oracle@sanfup auxiliary sys/oracle@sanfus
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Mar 8 16:10:25 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1272955137)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 08-MAR-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl' auxiliary format
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapworcl' ;
--用duplicate 创建standby 时会复制口令文件
}
executing Memory Script
Starting backup at 08-MAR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=45 device type=DISK
Finished backup at 08-MAR-11
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/dave/control01.ctl';
restore clone controlfile to '/u01/app/oracle/oradata/dave/control02.ctl' from
'/u01/app/oracle/oradata/dave/control01.ctl';
restore clone controlfile to '/u01/app/oracle/oradata/dave/control03.ctl' from
'/u01/app/oracle/oradata/dave/control01.ctl';
--创建控制文件
}
executing Memory Script
Starting backup at 08-MAR-11
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_orcl.f tag=TAG20110308T161152 RECID=4 STAMP=745258313
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 08-MAR-11
Starting restore at 08-MAR-11
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 08-MAR-11
Starting restore at 08-MAR-11
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 08-MAR-11
contents of Memory Script:
{
sql clone 'alter database mount standby database';
--将备库启动到mount standby
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/dave/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/dave/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/dave/sysaux01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/dave/undotbs01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/dave/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/dave/system01.dbf" datafile
2 auxiliary format
"/u01/app/oracle/oradata/dave/sysaux01.dbf" datafile
3 auxiliary format
"/u01/app/oracle/oradata/dave/undotbs01.dbf" datafile
4 auxiliary format
"/u01/app/oracle/oradata/dave/users01.dbf" ;
sql 'alter system archive log current';
--将datafile convert 到其他目录
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/dave/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 08-MAR-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
--开始copy datafile,如果数据文件比较大,这个会比较慢
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output file name=/u01/app/oracle/oradata/dave/system01.dbf tag=TAG20110308T161204
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
output file name=/u01/app/oracle/oradata/dave/sysaux01.dbf tag=TAG20110308T161204
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
output file name=/u01/app/oracle/oradata/dave/undotbs01.dbf tag=TAG20110308T161204
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
output file name=/u01/app/oracle/oradata/dave/users01.dbf tag=TAG20110308T161204
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 08-MAR-11
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=4 STAMP=745258432 file name=/u01/app/oracle/oradata/dave/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=745258432 file name=/u01/app/oracle/oradata/dave/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=745258432 file name=/u01/app/oracle/oradata/dave/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=745258432 file name=/u01/app/oracle/oradata/dave/users01.dbf
Finished Duplicate Db at 08-MAR-11
RMAN>
DG 复制到这一步已经操作完成了。 但是还有一些细节需要处理。
两点注意事项:
(1)如果使用的是非catalog,在rman 连接时,加上nocatalog关键字,如: