11g的RMAN duplicate 可以通过Active databaseduplicate和Backup-based duplicate两种方法实现。这里的测试使用的是Active databaseduplicate,因为Active database duplicate 功能强大,不需要先把目标数据库进行rman备份,只要目标数据库处于归档模式下即可直接通过网络对数据库进行copy,且copy完成后自动open数据库。这对于大数据特别是T级别的数据库来说优点非常明显,复制前不需要进行备份,减少了备份和传送备份的时间,同时节省备份空间。下面来进行具体的duplicate操作。

监听,口令文件配置,pfile配置,创建clone库相关目录等过程同基于备份的RMAN复制一样

SQL>startup pfile=$ORACLE_HOME/dbs/initclonedb.ora nomount;
ORACLEinstance started.
 
TotalSystem Global Area  630501376 bytes
FixedSize                    2215984 bytes
VariableSize                  184553424 bytes
DatabaseBuffers          440401920 bytes
RedoBuffers                    3330048 bytes
[oracle@HE4~]$ rman target sys/MANAGER@orcl auxiliarysys/MANAGER@clonedb
 
RecoveryManager: Release 11.2.0.1.0 - Production on Thu Jan 28 19:57:31 2016
 
Copyright(c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
 
connectedto target database: ORCL (DBID=1426154421)
connectedto auxiliary database: CLONEDB (not mounted)
RMAN> duplicate target database to clonedb from active database;  (这里是异机异构恢复,如果是同结构的参数会报错,需添加nofilenamecheck,谨慎使用,防止文件被覆盖)
Starting DuplicateDb at 28-JAN-16
using targetdatabase control file instead of recovery catalog
allocated channel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1: SID=20 device type=DISK
 
contents of MemoryScript:
{
   sql clone "create spfile frommemory";
}
executing MemoryScript
 
sql statement:create spfile from memory
 
contents of MemoryScript:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing MemoryScript
 
Oracle instance shutdown
 
connected toauxiliary database (not started)
Oracle instancestarted
 
Total System GlobalArea     630501376 bytes
 
Fixed Size                     2215984 bytes
Variable Size                188747728 bytes
DatabaseBuffers             436207616 bytes
Redo Buffers                   3330048 bytes
 
contents of MemoryScript:
{
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 ''Modified by RMAN duplicate''scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''CLONEDB'' comment=
 ''Modified by RMAN duplicate''scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliaryformat '/u01/app/oracle/oradata/clonedb/control01.ctl';
   restore clone controlfile to '/u01/app/oracle/oradata/clonedb/control02.ctl' from
 '/u01/app/oracle/oradata/clonedb/control01.ctl';
   alter clone database mount;
}
executing MemoryScript
 
sql statement: altersystem set  db_name =  ''ORCL'' comment= ''Modified by RMANduplicate'' scope=spfile
 
sql statement: altersystem set  db_unique_name =  ''CLONEDB'' comment= ''Modified by RMANduplicate'' scope=spfile
 
Oracle instance shutdown
 
Oracle instancestarted
 
Total System GlobalArea     630501376 bytes
 
Fixed Size                     2215984 bytes
Variable Size                188747728 bytes
DatabaseBuffers             436207616 bytes
Redo Buffers                   3330048 bytes
 
Starting backup at28-JAN-16
allocated channel:ORA_DISK_1
channel ORA_DISK_1:SID=36 device type=DISK
channel ORA_DISK_1:starting datafile copy
copying currentcontrol file
output filename=/u01/app/oracle/product/11gr2/db_1/dbs/snapcf_orcl.ftag=TAG20160128T204953 RECID=5 STAMP=902350193
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:03
Finished backup at28-JAN-16
 
Starting restore at28-JAN-16
allocated channel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1: SID=18 device type=DISK
 
channelORA_AUX_DISK_1: copied control file copy
Finished restore at28-JAN-16
 
database mounted
 
contents of MemoryScript:
{
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/clonedb/system01.dbf";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/clonedb/sysaux01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/clonedb/undotbs01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/clonedb/users01.dbf";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/clonedb/example01.dbf";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/clonedb/heleitbs01.dbf";
   backup as copy reuse
   datafile 1 auxiliary format
 "/u01/app/oracle/oradata/clonedb/system01.dbf"   datafile
 2 auxiliary format
 "/u01/app/oracle/oradata/clonedb/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u01/app/oracle/oradata/clonedb/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u01/app/oracle/oradata/clonedb/users01.dbf"   datafile
 5 auxiliary format
 "/u01/app/oracle/oradata/clonedb/example01.dbf"   datafile
 6 auxiliary format
 "/u01/app/oracle/oradata/clonedb/heleitbs01.dbf"   ;
   sql 'alter system archive log current';
}
executing MemoryScript
 
executing command:SET NEWNAME
 
executing command:SET NEWNAME
 
executing command:SET NEWNAME
 
executing command:SET NEWNAME
 
executing command:SET NEWNAME
 
executing command:SET NEWNAME
 
Starting backup at28-JAN-16
using channelORA_DISK_1
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output filename=/u01/app/oracle/oradata/clonedb/system01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:59
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
output filename=/u01/app/oracle/oradata/clonedb/sysaux01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00006 name=/u01/app/oracle/oradata/orcl/heleitbs01.dbf
output filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:16
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
output filename=/u01/app/oracle/oradata/clonedb/example01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
output filename=/u01/app/oracle/oradata/clonedb/undotbs01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:08
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
output filename=/u01/app/oracle/oradata/clonedb/users01.dbf tag=TAG20160128T205002
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:01
Finished backup at28-JAN-16
 
sql statement: altersystem archive log current
 
contents of MemoryScript:
{
   backup as copy reuse
   archivelog like "/u01/archivelog/1_13_898373685.dbf" auxiliary format
 "/u01/archivelog/1_13_898373685.dbf"   ;
   catalog clone archivelog "/u01/archivelog/1_13_898373685.dbf";
   switch clone datafile all;
}
executing MemoryScript
 
Starting backup at28-JAN-16
using channelORA_DISK_1
channel ORA_DISK_1:starting archived log copy
input archived logthread=1 sequence=13 RECID=9 STAMP=902350337
output filename=/u01/archivelog/1_13_898373685.dbf RECID=0 STAMP=0
channel ORA_DISK_1:archived log copy complete, elapsed time: 00:00:01
Finished backup at28-JAN-16
 
cataloged archivedlog
archived log filename=/u01/archivelog/1_13_898373685.dbf RECID=9 STAMP=902350338
 
datafile 1 switchedto datafile copy
input datafile copyRECID=5 STAMP=902350338 file name=/u01/app/oracle/oradata/clonedb/system01.dbf
datafile 2 switchedto datafile copy
input datafile copyRECID=6 STAMP=902350338 file name=/u01/app/oracle/oradata/clonedb/sysaux01.dbf
datafile 3 switchedto datafile copy
input datafile copyRECID=7 STAMP=902350338 file name=/u01/app/oracle/oradata/clonedb/undotbs01.dbf
datafile 4 switchedto datafile copy
input datafile copyRECID=8 STAMP=902350338 file name=/u01/app/oracle/oradata/clonedb/users01.dbf
datafile 5 switchedto datafile copy
input datafile copyRECID=9 STAMP=902350338 file name=/u01/app/oracle/oradata/clonedb/example01.dbf
datafile 6 switchedto datafile copy
input datafile copyRECID=10 STAMP=902350338 filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
 
contents of MemoryScript:
{
   set until scn  1028975;
   recover
   clone database
    delete archivelog
   ;
}
executing MemoryScript
 
executing command:SET until clause
 
Starting recover at28-JAN-16
using channelORA_AUX_DISK_1
 
starting mediarecovery
 
archived log forthread 1 with sequence 13 is already on disk as file/u01/archivelog/1_13_898373685.dbf
archived log filename=/u01/archivelog/1_13_898373685.dbf thread=1 sequence=13
media recoverycomplete, elapsed time: 00:00:00
Finished recover at28-JAN-16
 
contents of MemoryScript:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''CLONEDB'' 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 MemoryScript
 
database dismounted
Oracle instance shutdown
 
connected toauxiliary database (not started)
Oracle instancestarted
 
Total System GlobalArea     630501376 bytes
 
Fixed Size                     2215984 bytes
Variable Size                188747728 bytes
DatabaseBuffers             436207616 bytes
Redo Buffers                   3330048 bytes
 
sql statement: altersystem set  db_name =  ''CLONEDB'' comment= ''Reset to originalvalue by RMAN'' scope=spfile
 
sql statement: altersystem reset  db_unique_name scope=spfile
 
Oracle instance shutdown
 
connected toauxiliary database (not started)
Oracle instancestarted
 
Total System GlobalArea     630501376 bytes
 
Fixed Size                     2215984 bytes
Variable Size                188747728 bytes
DatabaseBuffers             436207616 bytes
Redo Buffers                   3330048 bytes
sql statement:CREATE CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP 1 ( '/u01/app/oracle/oradata/clonedb/redo01.log' ) SIZE 50 M  REUSE,
  GROUP 2 ( '/u01/app/oracle/oradata/clonedb/redo02.log' ) SIZE 50 M  REUSE,
  GROUP 3 ( '/u01/app/oracle/oradata/clonedb/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
 '/u01/app/oracle/oradata/clonedb/system01.dbf'
 CHARACTER SET ZHS16GBK
 
 
contents of MemoryScript:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/clonedb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy "/u01/app/oracle/oradata/clonedb/sysaux01.dbf",
 "/u01/app/oracle/oradata/clonedb/undotbs01.dbf",
 "/u01/app/oracle/oradata/clonedb/users01.dbf",
 "/u01/app/oracle/oradata/clonedb/example01.dbf",
 "/u01/app/oracle/oradata/clonedb/heleitbs01.dbf";
   switch clone datafile all;
}
executing MemoryScript
 
executing command:SET NEWNAME
 
renamed tempfile 1to /u01/app/oracle/oradata/clonedb/temp01.dbf in control file
 
cataloged datafilecopy
datafile copy filename=/u01/app/oracle/oradata/clonedb/sysaux01.dbf RECID=1 STAMP=902350346
cataloged datafilecopy
datafile copy filename=/u01/app/oracle/oradata/clonedb/undotbs01.dbf RECID=2 STAMP=902350346
cataloged datafilecopy
datafile copy filename=/u01/app/oracle/oradata/clonedb/users01.dbf RECID=3 STAMP=902350346
cataloged datafilecopy
datafile copy filename=/u01/app/oracle/oradata/clonedb/example01.dbf RECID=4 STAMP=902350346
cataloged datafilecopy
datafile copy filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf RECID=5 STAMP=902350346
 
datafile 2 switchedto datafile copy
input datafile copyRECID=1 STAMP=902350346 file name=/u01/app/oracle/oradata/clonedb/sysaux01.dbf
datafile 3 switchedto datafile copy
input datafile copyRECID=2 STAMP=902350346 file name=/u01/app/oracle/oradata/clonedb/undotbs01.dbf
datafile 4 switchedto datafile copy
input datafile copyRECID=3 STAMP=902350346 file name=/u01/app/oracle/oradata/clonedb/users01.dbf
datafile 5 switchedto datafile copy
input datafile copyRECID=4 STAMP=902350346 file name=/u01/app/oracle/oradata/clonedb/example01.dbf
datafile 6 switchedto datafile copy
input datafile copyRECID=5 STAMP=902350346 filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
 
contents of MemoryScript:
{
   Alter clone database open resetlogs;
}
executing MemoryScript
 
database opened
Finished DuplicateDb at 28-JAN-16

通过RMAN克隆11g数据库(基于active database)的更多相关文章

  1. 使用Oracle 11g新特性 Active Database Duplication 搭建Dataguard环境

    Duplication Database 介绍 Duplicate database可以按照用途分为2种: duplicate database(复制出一个数据库) duplicate standby ...

  2. Oracle19c 如何用rman duplicate 克隆一个数据库。(Active方式)

    Oracle19c 如何用rman duplicate 克隆一个数据库. 首先克隆有两种方法,一种是Backup-Based,一种是Active方式.官网文档链接https://docs.oracle ...

  3. RMAN 'Duplicate From Active Database' Feature in Oracle11g (Doc ID 452868.1)

    RMAN 'Duplicate From Active Database' Feature in Oracle11g (Doc ID 452868.1) APPLIES TO: Oracle Data ...

  4. Oracle 11gR2 使用RMAN Duplicate复制数据库

    Oracle 11gR2 使用RMAN Duplicate复制数据库     前言:     上周刚做完一个项目,用户要求RAC的数据库可以自己主动备份到另外一个单节点上,单节点可以正常拿起来就能用. ...

  5. 基于RMAN从活动数据库异机克隆(rman duplicate from active DB)

    Oracle 11g RMAN能够实现基于活动数据库进行异机克隆,从而省去需要先备份再ftp到辅助服务器的过程.这一切可以全部交给Oracle来搞定.在克隆期间,Oracle会读取Target DB的 ...

  6. Oracle Study之--Oracle 11gR2通过RMAN克隆数据库

    Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is usefu ...

  7. 11g 使用rman duplicate复制数据库,创建辅助实例

    一,创建所需目录 1)创建审计文件目录 PROD1@dbrac1 /dsg/oracle11$ cd $ORACLE_BASE/admin PROD1@dbrac1 /u01/app/oracle/a ...

  8. RMAN duplicate from active database

    在Oracle 11G有二种方法实现duplicate: 1.Active database duplication 2.Backup-based duplication Active databas ...

  9. Oracle19c 如何用rman duplicate 克隆一个数据库。(Backup-Based, achive log)

    Oracle19c 如何用rman duplicate 克隆一个数据库.(Backup-Based, achive log) 首先克隆有两种方法,一种是Backup-Based,一种是Active方式 ...

随机推荐

  1. apk文件分析原则

    如果在dex生成的jar文件里没有发现关键内容的话,就要注意jar里面的native函数以及loadlibrary操作,从而可以判断出加载了哪些so,调用了什么函数.就不会出现判断不出是不是加载了某s ...

  2. FZU 2122 又见LKity(KMP+返回所有匹配位置)

    基础kmp应用,找到所有匹配位置即可 #include<stdio.h> #include<string.h> #include<algorithm> #inclu ...

  3. Gulp自动构建前端开发一体化

    gulp是基于Nodejs的自动任务运行器, 她能自动化地完成 javascript/coffee/sass/less/html/image/css 等文件的的测试.检查.合并.压缩.格式化.浏览器自 ...

  4. 编译内核启用iptables及netfilter

    在Network Packet Filtering Framework(Netfilter)一节中还有两个额外的配置节——Core Netfilter Configuration(核心Netfilte ...

  5. gcd timer

    //0.创建队列 dispatch_queue_t queue = dispatch_get_global_queue(, ); NSLog(@"%s",__func__); // ...

  6. PAT (Advanced Level) 1010. Radix (25)

    撸完这题,感觉被掏空. 由于进制可能大的飞起..所以需要开longlong存,答案可以二分得到. 进制很大,导致转换成10进制的时候可能爆long long,在二分的时候,如果溢出了,那么上界=mid ...

  7. CSS文字垂直居中和font-family属性

    1.单行文字的垂直居中 单行文字垂直居中比较简单,直接让行高==盒子高度即可. 2.多行文字居中 多行文字居中,只需简单计算一下盒子的上padding即可.计算公式:padding-top=(盒子的高 ...

  8. (中等) Hiho 1232 Couple Trees(15年北京网络赛F题),主席树+树链剖分。

    "Couple Trees" are two trees, a husband tree and a wife tree. They are named because they ...

  9. awk命令详解二

    awk命令详解 简单使用: awk :对于文件中一行行的独处来执行操作 . awk -F :'{print $1,$4}'   :使用‘:’来分割这一行,把这一行的第一第四个域打印出来 . 详细介绍: ...

  10. 2、手把手教你Extjs5(二)项目中文件的加载过程

    上一节中用sencha工具自动创建了一个项目,并且可以在浏览器中查看.现在我们来看看js类加载过程.如下图所示: 1、首先:浏览器中输入 localhost:1841 ,调用 index.html; ...