天天看点

rman duplicate standby active

//备参数文件配置

*.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

backup as copy current controlfile for standby auxiliary format '/u01/data02/control01.ctl';

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

sql clone 'alter database mount standby database';

sql statement: alter database mount standby database

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";

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 command: SET NEWNAME

renamed tempfile 1 to /u01/data02/temp01.dbf in control file

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

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

input datafile file number=00003 name=/u01/app/oracle/oradata/ora/undotbs01.dbf

output file name=/u01/data02/undotbs01.dbf tag=TAG20200705T204335

input datafile file number=00004 name=/u01/app/oracle/oradata/ora/users01.dbf

output file name=/u01/data02/users01.dbf tag=TAG20200705T204335

sql statement: alter system archive log current

switch clone datafile all;

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