通过RMAN克隆11g数据库(基于active database)
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)的更多相关文章
- 使用Oracle 11g新特性 Active Database Duplication 搭建Dataguard环境
Duplication Database 介绍 Duplicate database可以按照用途分为2种: duplicate database(复制出一个数据库) duplicate standby ...
- Oracle19c 如何用rman duplicate 克隆一个数据库。(Active方式)
Oracle19c 如何用rman duplicate 克隆一个数据库. 首先克隆有两种方法,一种是Backup-Based,一种是Active方式.官网文档链接https://docs.oracle ...
- 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 ...
- Oracle 11gR2 使用RMAN Duplicate复制数据库
Oracle 11gR2 使用RMAN Duplicate复制数据库 前言: 上周刚做完一个项目,用户要求RAC的数据库可以自己主动备份到另外一个单节点上,单节点可以正常拿起来就能用. ...
- 基于RMAN从活动数据库异机克隆(rman duplicate from active DB)
Oracle 11g RMAN能够实现基于活动数据库进行异机克隆,从而省去需要先备份再ftp到辅助服务器的过程.这一切可以全部交给Oracle来搞定.在克隆期间,Oracle会读取Target DB的 ...
- Oracle Study之--Oracle 11gR2通过RMAN克隆数据库
Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is usefu ...
- 11g 使用rman duplicate复制数据库,创建辅助实例
一,创建所需目录 1)创建审计文件目录 PROD1@dbrac1 /dsg/oracle11$ cd $ORACLE_BASE/admin PROD1@dbrac1 /u01/app/oracle/a ...
- RMAN duplicate from active database
在Oracle 11G有二种方法实现duplicate: 1.Active database duplication 2.Backup-based duplication Active databas ...
- Oracle19c 如何用rman duplicate 克隆一个数据库。(Backup-Based, achive log)
Oracle19c 如何用rman duplicate 克隆一个数据库.(Backup-Based, achive log) 首先克隆有两种方法,一种是Backup-Based,一种是Active方式 ...
随机推荐
- aapt: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64
前阵子在ubuntu上搭载安卓的开发环境(Eclipse+Sdk+Adt),搭载是完成了,但是却出现了该问题: aapt: error while loading shared libraries: ...
- linux下OpenOffice与SwfTools环境安装
一.安装所需要的库与组件 yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel 二.安装open ...
- Jquery和Javascript对象之间的转换
jQuery 对象是通过 jQuery 包装DOM 对象后产生的对象.jQuery 对象是 jQuery 独有的,其可以使用 jQuery 里的方法,但是不能使用 DOM 的方法:例如: $(&quo ...
- 基于心跳的socket长连接
http://coach.iteye.com/blog/2024444 基于心跳的socket长连接 博客分类: http socket 案例: 心跳: socket模拟网页的报文连接某个网站,创建t ...
- openjdk
apt-get install mercurial hg clone http://hg.openjdk.java.net/jdk8u/jdk8u20/ jdk8u20 ./get_source.sh
- iOS 程序间跳转传参(支付和地图)
两个APP之间的跳转是通过[[UIApplication sharedApplication] openURL:url]这种方式来实现的. 1.首先设置第一个APP的url地址 2.接着设置第二个AP ...
- php script 的生命周期
原文地址:https://support.cloud.engineyard.com/hc/en-us/articles/205411888-PHP-Performance-I-Everything-Y ...
- Python+Selenium WebDriver API:浏览器及元素的常用函数及变量整理总结
由于网页自动化要操作浏览器以及浏览器页面元素,这里笔者就将浏览器及页面元素常用的函数及变量整理总结一下,以供读者在编写网页自动化测试时查阅. from selenium import webdrive ...
- CodeForces 662D International Olympiad
写出前几个找规律,然后直接输出. #include<cstdio> #include<cstring> #include<cmath> #include<al ...
- PHP 判断几秒前,几分钟,几小时前
PHP 对于时间的过了多久的判断,几秒前,几分钟前,几小时前,$time = strtotime("2017-01-15 14:42:00"); $time = strtotime ...