加入收藏 | 设为首页 | 会员中心 | 我要投稿 核心网 (https://www.hxwgxz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

【Oracle】RMAN duplicate复制库

发布时间:2020-12-25 21:07:23 所属栏目:站长百科 来源:网络整理
导读:基础环境: 172.17.4.60 操作系统:Linux 6.4 数据库:Oracle11gR2 (源数据库) 172.17.4.61 操作系统:Linux 6.4 数据库:Oracle11gR2 (测试库) 目的:从源数据库以RMAN的物理恢复的方式,恢复至测试库中。 如何验证,在源数据库,插入几条数据如下: [email?protec

测试端(172.17.4.61)rman连接源数据库和辅助库:

[[email?protected] ~]$ rman target sys/[email?protected] auxiliary sys/[email?protected]

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Dec 29 16:25:33 2018

Copyright (c) 1982,2011,Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORADB (DBID=2697310494)
connected to auxiliary database: ZSDDUMMY (not mounted)

Step 7.开始 RMAN duplicate通过网络复制数据库

测试端(172.17.4.61)开始 RMAN 通过网络复制数据库

RMAN> duplicate target database to zsddb from active database spfile nofilenamecheck;

日志如下:

Starting Duplicate Db at 02-JAN-19
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=429 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/product/11.2.0/db_1/dbs/spfileoradb.ora' auxiliary format 
 '/u01/app/product/11.2.0/db_1/dbs/spfileoradb.ora'   ;
   sql clone "alter system set spfile= ''/u01/app/product/11.2.0/db_1/dbs/spfileoradb.ora''";
}
executing Memory Script

Starting backup at 02-JAN-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
Finished backup at 02-JAN-19

sql statement: alter system set spfile= ''/u01/app/product/11.2.0/db_1/dbs/spfileoradb.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''ZSDDB'' comment=
 ''duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ZSDDB'' comment= ''duplicate'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1202556928 bytes

Fixed Size                     2252704 bytes
Variable Size                419430496 bytes
Database Buffers             771751936 bytes
Redo Buffers                   9121792 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''ORADB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''ZSDDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u01/app/oradata/oradb/control01.ctl';
   restore clone controlfile to  '/u01/app/fast_recovery_area/oradb/control02.ctl' from 
 '/u01/app/oradata/oradb/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ORADB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''ZSDDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    1202556928 bytes

Fixed Size                     2252704 bytes
Variable Size                419430496 bytes
Database Buffers             771751936 bytes
Redo Buffers                   9121792 bytes

Starting backup at 02-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/product/11.2.0/db_1/dbs/snapcf_oradb.f tag=TAG20190102T144945 RECID=2 STAMP=996504585
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:01
Finished backup at 02-JAN-19

Starting restore at 02-JAN-19
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=85 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 02-JAN-19

database mounted
RMAN-05538: WARNING: implicitly using DB_FILE_NAME_CONVERT

contents of Memory Script:
{
   set newname for datafile  1 to 
 "/u01/app/oradata/oradb/system01.dbf";
   set newname for datafile  2 to 
 "/u01/app/oradata/oradb/sysaux01.dbf";
   set newname for datafile  3 to 
 "/u01/app/oradata/oradb/undotbs01.dbf";
   set newname for datafile  4 to 
 "/u01/app/oradata/oradb/users01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format 
 "/u01/app/oradata/oradb/system01.dbf"   datafile 
 2 auxiliary format 
 "/u01/app/oradata/oradb/sysaux01.dbf"   datafile 
 3 auxiliary format 
 "/u01/app/oradata/oradb/undotbs01.dbf"   datafile 
 4 auxiliary format 
 "/u01/app/oradata/oradb/users01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 02-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oradata/oradb/system01.dbf
output file name=/u01/app/oradata/oradb/system01.dbf tag=TAG20190102T144953
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oradata/oradb/sysaux01.dbf
output file name=/u01/app/oradata/oradb/sysaux01.dbf tag=TAG20190102T144953
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oradata/oradb/undotbs01.dbf
output file name=/u01/app/oradata/oradb/undotbs01.dbf tag=TAG20190102T144953
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oradata/oradb/users01.dbf
output file name=/u01/app/oradata/oradb/users01.dbf tag=TAG20190102T144953
channel ORA_DISK_1: datafile copy complete,elapsed time: 00:00:03
Finished backup at 02-JAN-19

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/u01/app/fast_recovery_area/ORADB/archivelog/2019_01_02/o1_mf_1_12_g2rqto2s_.arc" auxiliary format 
 "/u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_%u_.arc"   ;
   catalog clone recovery area;
   switch clone datafile all;
}
executing Memory Script

Starting backup at 02-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=12 RECID=7 STAMP=996504662
output file name=/u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_0btmat2m_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete,elapsed time: 00:00:01
Finished backup at 02-JAN-19

searching for all files in the recovery area

List of Files Unknown to the Database
=====================================
File Name: /u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_0btmat2m_.arc
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_0btmat2m_.arc

datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=996504659 file name=/u01/app/oradata/oradb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=996504659 file name=/u01/app/oradata/oradb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=996504659 file name=/u01/app/oradata/oradb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=996504659 file name=/u01/app/oradata/oradb/users01.dbf

contents of Memory Script:
{
   set until scn  1150015;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 02-JAN-19
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 12 is already on disk as file /u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_0btmat2m_.arc
archived log file name=/u01/app/fast_recovery_area/ZSDDB/archivelog/2019_01_02/o1_mf_1_12_0btmat2m_.arc thread=1 sequence=12
media recovery complete,elapsed time: 00:00:00
Finished recover at 02-JAN-19
Oracle instance started

Total System Global Area    1202556928 bytes

Fixed Size                     2252704 bytes
Variable Size                419430496 bytes
Database Buffers             771751936 bytes
Redo Buffers                   9121792 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name = 
 ''ZSDDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ZSDDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1202556928 bytes

Fixed Size                     2252704 bytes
Variable Size                419430496 bytes
Database Buffers             771751936 bytes
Redo Buffers                   9121792 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ZSDDB" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 50 M,GROUP   2  SIZE 50 M,GROUP   3  SIZE 50 M 
 DATAFILE
  '/u01/app/oradata/oradb/system01.dbf'
 CHARACTER SET ZHS16GBK


contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/u01/app/oradata/oradb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oradata/oradb/sysaux01.dbf","/u01/app/oradata/oradb/undotbs01.dbf","/u01/app/oradata/oradb/users01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oradata/oradb/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u01/app/oradata/oradb/sysaux01.dbf RECID=1 STAMP=996504682
cataloged datafile copy
datafile copy file name=/u01/app/oradata/oradb/undotbs01.dbf RECID=2 STAMP=996504682
cataloged datafile copy
datafile copy file name=/u01/app/oradata/oradb/users01.dbf RECID=3 STAMP=996504682

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=996504682 file name=/u01/app/oradata/oradb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=996504682 file name=/u01/app/oradata/oradb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=996504682 file name=/u01/app/oradata/oradb/users01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 02-JAN-19

(编辑:核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读