本文共 9415 字,大约阅读时间需要 31 分钟。
某客户需要搭建dg,但是主库与备库剩余空间都不是很充足, 如果使用RMAN备份到本地,然后scp 备份文件到dg,空间需要考虑很多问题!
那么duplicate 方式搭建,是否会备份主库写到主库,或者写到备库的备份文件中呢?
本质上这个问题就是对duplicate操作的理解到什么程度!
Recovery Manager: Release 12.2.0.1.0 - Production on Tue Apr 20 06:38:37 2021Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.connected to target database: ORCL (DBID=1594123398)connected to auxiliary database: ORCL (not mounted)RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11>using target database control file instead of recovery catalogallocated channel: p1channel p1: SID=75 device type=DISKallocated channel: p2channel p2: SID=76 device type=DISKallocated channel: p3channel p3: SID=77 device type=DISKallocated channel: p4channel p4: SID=78 device type=DISKallocated channel: s1channel s1: SID=35 device type=DISKallocated channel: s2channel s2: SID=36 device type=DISKallocated channel: s3channel s3: SID=37 device type=DISKallocated channel: s4channel s4: SID=38 device type=DISKStarting Duplicate Db at 20-APR-21contents of Memory Script:{ backup as copy reuse targetfile '/picclife/app/oracle/product/12.2.0/db_1/dbs/orapwc11' auxiliary format '/picclife/app/oracle/product/12.2.0/db_1/dbs/orapwc12' ;}executing Memory ScriptStarting backup at 20-APR-21Finished backup at 20-APR-21contents of Memory Script:{ restore clone from service 'tns_pri' standby controlfile;}executing Memory ScriptStarting restore at 20-APR-21channel s1: starting datafile backup set restorechannel s1: using network backup set from service tns_prichannel s1: restoring control filechannel s1: restore complete, elapsed time: 00:00:04output file name=/picclife/app/oracle/oradata/orcldg/control01.ctloutput file name=/picclife/app/oracle/oradata/orcldg/control02.ctlFinished restore at 20-APR-21contents of Memory Script:{ sql clone 'alter database mount standby database';}executing Memory Scriptsql statement: alter database mount standby databasecontents of Memory Script:{ set newname for tempfile 1 to "/picclife/app/oracle/oradata/orcldg/temp01.dbf"; set newname for tempfile 2 to "/picclife/app/oracle/oradata/orcldg/pdbseeddg/temp012021-03-04_22-18-29-699-PM.dbf"; set newname for tempfile 3 to "/picclife/app/oracle/oradata/orcldg/c11pdbdg/temp01.dbf"; switch clone tempfile all; set newname for datafile 1 to "/picclife/app/oracle/oradata/orcldg/system01.dbf"; set newname for datafile 3 to "/picclife/app/oracle/oradata/orcldg/sysaux01.dbf"; set newname for datafile 4 to "/picclife/app/oracle/oradata/orcldg/undotbs01.dbf"; set newname for datafile 5 to "/picclife/app/oracle/oradata/orcldg/pdbseeddg/system01.dbf"; set newname for datafile 6 to "/picclife/app/oracle/oradata/orcldg/pdbseeddg/sysaux01.dbf"; set newname for datafile 7 to "/picclife/app/oracle/oradata/orcldg/users01.dbf"; set newname for datafile 8 to "/picclife/app/oracle/oradata/orcldg/pdbseeddg/undotbs01.dbf"; set newname for datafile 9 to "/picclife/app/oracle/oradata/orcldg/c11pdbdg/system01.dbf"; set newname for datafile 10 to "/picclife/app/oracle/oradata/orcldg/c11pdbdg/sysaux01.dbf"; set newname for datafile 11 to "/picclife/app/oracle/oradata/orcldg/c11pdbdg/undotbs01.dbf"; set newname for datafile 12 to "/picclife/app/oracle/oradata/orcldg/c11pdbdg/users01.dbf"; restore from nonsparse from service 'tns_pri' clone database ; sql 'alter system archive log current';}executing Memory Scriptexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMErenamed tempfile 1 to /picclife/app/oracle/oradata/orcldg/temp01.dbf in control filerenamed tempfile 2 to /picclife/app/oracle/oradata/orcldg/pdbseeddg/temp012021-03-04_22-18-29-699-PM.dbf in control filerenamed tempfile 3 to /picclife/app/oracle/oradata/orcldg/c11pdbdg/temp01.dbf in control fileexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting restore at 20-APR-21skipping datafile 5; already restored to SCN 1447512skipping datafile 6; already restored to SCN 1447512skipping datafile 8; already restored to SCN 1447512channel s1: starting datafile backup set restorechannel s1: using network backup set from service tns_prichannel s1: specifying datafile(s) to restore from backup setchannel s1: restoring datafile 00001 to /picclife/app/oracle/oradata/orcldg/system01.dbfchannel s2: starting datafile backup set restorechannel s2: using network backup set from service tns_prichannel s2: specifying datafile(s) to restore from backup setchannel s2: restoring datafile 00003 to /picclife/app/oracle/oradata/orcldg/sysaux01.dbfchannel s3: starting datafile backup set restorechannel s3: using network backup set from service tns_prichannel s3: specifying datafile(s) to restore from backup setchannel s3: restoring datafile 00004 to /picclife/app/oracle/oradata/orcldg/undotbs01.dbfchannel s4: starting datafile backup set restorechannel s4: using network backup set from service tns_prichannel s4: specifying datafile(s) to restore from backup setchannel s4: restoring datafile 00007 to /picclife/app/oracle/oradata/orcldg/users01.dbfchannel s4: restore complete, elapsed time: 00:00:17channel s4: starting datafile backup set restorechannel s4: using network backup set from service tns_prichannel s4: specifying datafile(s) to restore from backup setchannel s4: restoring datafile 00009 to /picclife/app/oracle/oradata/orcldg/c11pdbdg/system01.dbfchannel s3: restore complete, elapsed time: 00:01:04channel s3: starting datafile backup set restorechannel s3: using network backup set from service tns_prichannel s3: specifying datafile(s) to restore from backup setchannel s3: restoring datafile 00010 to /picclife/app/oracle/oradata/orcldg/c11pdbdg/sysaux01.dbfchannel s4: restore complete, elapsed time: 00:00:55channel s4: starting datafile backup set restorechannel s4: using network backup set from service tns_prichannel s4: specifying datafile(s) to restore from backup setchannel s4: restoring datafile 00011 to /picclife/app/oracle/oradata/orcldg/c11pdbdg/undotbs01.dbfchannel s4: restore complete, elapsed time: 00:00:20channel s4: starting datafile backup set restorechannel s4: using network backup set from service tns_prichannel s4: specifying datafile(s) to restore from backup setchannel s4: restoring datafile 00012 to /picclife/app/oracle/oradata/orcldg/c11pdbdg/users01.dbfchannel s2: restore complete, elapsed time: 00:01:38channel s4: restore complete, elapsed time: 00:00:07channel s1: restore complete, elapsed time: 00:01:53channel s3: restore complete, elapsed time: 00:00:47Finished restore at 20-APR-21sql statement: alter system archive log currentcontents of Memory Script:{ switch clone datafile all;}executing Memory Scriptdatafile 1 switched to datafile copyinput datafile copy RECID=4 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/system01.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=5 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/sysaux01.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=6 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/undotbs01.dbfdatafile 5 switched to datafile copyinput datafile copy RECID=7 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/pdbseeddg/system01.dbfdatafile 6 switched to datafile copyinput datafile copy RECID=8 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/pdbseeddg/sysaux01.dbfdatafile 7 switched to datafile copyinput datafile copy RECID=9 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/users01.dbfdatafile 8 switched to datafile copyinput datafile copy RECID=10 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/pdbseeddg/undotbs01.dbfdatafile 9 switched to datafile copyinput datafile copy RECID=11 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/c11pdbdg/system01.dbfdatafile 10 switched to datafile copyinput datafile copy RECID=12 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/c11pdbdg/sysaux01.dbfdatafile 11 switched to datafile copyinput datafile copy RECID=13 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/c11pdbdg/undotbs01.dbfdatafile 12 switched to datafile copyinput datafile copy RECID=14 STAMP=1070347457 file name=/picclife/app/oracle/oradata/orcldg/c11pdbdg/users01.dbfFinished Duplicate Db at 20-APR-21released channel: p1released channel: p2released channel: p3released channel: p4released channel: s1released channel: s2released channel: s3released channel: s4RMAN> 可以看到对于duplicate产生的日志: 1.连接主备,分配RMAN备份通道; 2.将主库口令文件 scp 到dg; 3.主库备份standby controlfile ->scp dg-> dg 启动到mount; 4.根据参数convert 转换文件路径; 5.主库在线进行copy datafile ->scp dg 6.结束! 如果是生产环境,会scp ->archive
PrimaryRMAN> list backup of datafile 1;using target database control file instead of recovery catalogspecification does not match any backup in the repositorylist backup 出现一堆乱七八糟的信息太多,全备肯定会存在datafile 1的备份信息StandbyRMAN> list backup of datafile 1;using target database control file instead of recovery catalogspecification does not match any backup in the repository
所以,在主备本地空间不是很充足的情况下,可以使用duplicate,这样不在需要考虑rman备份文件的存储空间占用。
转载地址:http://eolyz.baihongyu.com/