使用duplicate target database ... from active database复制数据库
使用duplicate target database ... from active database复制数据库
source db:ora11
auxiliary db:dupdb
1.修改监听文件,静态注册监听
SID_LIST_ORA11 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora11)
(ORACLE_HOME = /u11/app/oracle/product/11.2./dbhome_1)
(SID_NAME =ora11)
)
(SID_DESC =
(GLOBAL_DBNAME = dupdb)
(ORACLE_HOME = /u11/app/oracle/product/11.2./dbhome_1)
(SID_NAME =dupdb)
)
)
2.修改tnsnames.ora文件
ORA11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mytest)(PORT = ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora11)
)
) DUPDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mytest)(PORT = ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dupdb)
)
)
3.为duplicate 数据库创建参数文件initdupdb.ora
db_name=dupdb
4.创建口令文件
$ orapwd password=<sys_pwd> file=orapwtest1 entries=
5.启动auxiliary 库
$ sqlplus /nolog SQL*Plus: Release 11.2.0.1. Production on Fri Jun :: Copyright (c) , , Oracle. All rights reserved. SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/u11/app/oracle/product/11.2.0/dbhome_1/dbs/initdupdb.ora';
ORACLE instance started. Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
SQL>
6.启动rman
$ rman Recovery Manager: Release 11.2.0.1. - Production on Fri Jun :: Copyright (c) , , Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/oracle@ora11 connected to target database: ORA11 (DBID=) RMAN> connect auxiliary / connected to auxiliary database: DUPDB (not mounted) RMAN>
7.执行duplicate target database ... from active database 命令开始duplicate操作
RMAN> duplicate target database to dupdb from active database
> spfile
> parameter_value_convert='/u11/app/oracle/oradata/ora11','/u11/app/oracle/oradata/dupdb'
> set
> log_file_name_convert='/u11/app/oracle/oradata/ora11','/u11/app/oracle/oradata/dupdb'
> db_file_name_convert='/u11/app/oracle/oradata/ora11','/u11/app/oracle/oradata/dupdb'; Starting Duplicate Db at -JUN- ::
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID= device type=DISK contents of Memory Script:
{
backup as copy reuse
targetfile '/u11/app/oracle/product/11.2.0/dbhome_1/dbs/spfileora11.ora' auxiliary format
'/u11/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledupdb.ora' ;
sql clone "alter system set spfile= ''/u11/app/oracle/product/11.2.0/dbhome_1/dbs/spfiledupdb.ora''";
}
executing Memory Script Starting backup at -JUN- ::
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID= device type=DISK
Finished backup at -JUN- :: sql statement: alter system set spfile= ''/u11/app/oracle/product/11.2./dbhome_1/dbs/spfiledupdb.ora'' contents of Memory Script:
{
sql clone "alter system set db_name =
''DUPDB'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set control_files =
''/u11/app/oracle/oradata/dupdb/control01.ctl'', ''/u11/app/oracle/oradata/dupdb/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''/u11/app/oracle/oradata/ora11'', ''/u11/app/oracle/oradata/dupdb'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script sql statement: alter system set db_name = ''DUPDB'' comment= ''duplicate'' scope=spfile sql statement: alter system set control_files = ''/u11/app/oracle/oradata/dupdb/control01.ctl'', ''/u11/app/oracle/oradata/dupdb/control02.ctl'' comment= '''' scope=spfile sql statement: alter system set log_file_name_convert = ''/u11/app/oracle/oradata/ora11'', ''/u11/app/oracle/oradata/dupdb'' comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started)
Oracle instance started Total System Global Area bytes Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes contents of Memory Script:
{
sql clone "alter system set db_name =
''ORA11'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''DUPDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/u11/app/oracle/oradata/dupdb/control01.ctl';
restore clone controlfile to '/u11/app/oracle/oradata/dupdb/control02.ctl' from
'/u11/app/oracle/oradata/dupdb/control01.ctl';
alter clone database mount;
}
executing Memory Script sql statement: alter system set db_name = ''ORA11'' comment= ''Modified by RMAN duplicate'' scope=spfile sql statement: alter system set db_unique_name = ''DUPDB'' comment= ''Modified by RMAN duplicate'' scope=spfile Oracle instance shut down Oracle instance started Total System Global Area bytes Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes Starting backup at -JUN- ::
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u11/app/oracle/product/11.2./dbhome_1/dbs/snapcf_ora11.f tag=TAG20150626T141645 RECID= STAMP=
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
Finished backup at -JUN- :: Starting restore at -JUN- ::
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID= device type=DISK channel ORA_AUX_DISK_1: copied control file copy
Finished restore at -JUN- :: database mounted contents of Memory Script:
{
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/system01.dbf";
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/sysaux01.dbf";
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/yb01.dbf";
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/users01.dbf";
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/example01.dbf";
set newname for datafile to
"/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf";
backup as copy reuse
datafile auxiliary format
"/u11/app/oracle/oradata/dupdb/system01.dbf" datafile
auxiliary format
"/u11/app/oracle/oradata/dupdb/sysaux01.dbf" datafile
auxiliary format
"/u11/app/oracle/oradata/dupdb/yb01.dbf" datafile
auxiliary format
"/u11/app/oracle/oradata/dupdb/users01.dbf" datafile
auxiliary format
"/u11/app/oracle/oradata/dupdb/example01.dbf" datafile
auxiliary format
"/u11/app/oracle/oradata/dupdb/UNDOTBS02.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 executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at -JUN- ::
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/system01.dbf
output file name=/u11/app/oracle/oradata/dupdb/system01.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/sysaux01.dbf
output file name=/u11/app/oracle/oradata/dupdb/sysaux01.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/example01.dbf
output file name=/u11/app/oracle/oradata/dupdb/example01.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/UNDOTBS02.dbf
output file name=/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/yb01.dbf
output file name=/u11/app/oracle/oradata/dupdb/yb01.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
channel ORA_DISK_1: starting datafile copy
input datafile file number= name=/u11/app/oracle/oradata/ora11/users01.dbf
output file name=/u11/app/oracle/oradata/dupdb/users01.dbf tag=TAG20150626T141655
channel ORA_DISK_1: datafile copy complete, elapsed time: ::
Finished backup at -JUN- :: sql statement: alter system archive log current contents of Memory Script:
{
backup as copy reuse
archivelog like "/u11/app/oracle/fra/ORA11/archivelog/2015_06_26/o1_mf_1_98_brsvojfz_.arc" auxiliary format
"/u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_%u_.arc" ;
catalog clone recovery area;
switch clone datafile all;
}
executing Memory Script Starting backup at -JUN- ::
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread= sequence= RECID= STAMP=
output file name=/u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_4mqafc9h_.arc RECID= STAMP=
channel ORA_DISK_1: archived log copy complete, elapsed time: ::
Finished backup at -JUN- :: searching for all files in the recovery area List of Files Unknown to the Database
=====================================
File Name: /u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_4mqafc9h_.arc
cataloging files...
cataloging done List of Cataloged Files
=======================
File Name: /u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_4mqafc9h_.arc datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/system01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/sysaux01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/yb01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/users01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/example01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf contents of Memory Script:
{
set until scn ;
recover
clone database
delete archivelog
;
}
executing Memory Script executing command: SET until clause Starting recover at -JUN- ::
using channel ORA_AUX_DISK_1 starting media recovery archived log for thread with sequence is already on disk as file /u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_4mqafc9h_.arc
archived log file name=/u11/app/oracle/fra/DUPDB/archivelog/2015_06_26/o1_mf_1_98_4mqafc9h_.arc thread= sequence=
media recovery complete, elapsed time: ::
Finished recover at -JUN- :: contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set db_name =
''DUPDB'' 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 database dismounted
Oracle instance shut down connected to auxiliary database (not started)
Oracle instance started Total System Global Area bytes Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes sql statement: alter system set db_name = ''DUPDB'' 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 bytes Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
MAXLOGFILES
MAXLOGMEMBERS
MAXDATAFILES
MAXINSTANCES
MAXLOGHISTORY
LOGFILE
GROUP ( '/u11/app/oracle/oradata/dupdb/redo01.log', '/u11/app/oracle/oradata/dupdb/redo01b.log' ) SIZE M REUSE,
GROUP ( '/u11/app/oracle/oradata/dupdb/redo02b.log', '/u11/app/oracle/oradata/dupdb/redo02.log' ) SIZE M REUSE,
GROUP ( '/u11/app/oracle/oradata/dupdb/redo03b.log', '/u11/app/oracle/oradata/dupdb/redo03.log' ) SIZE M REUSE
DATAFILE
'/u11/app/oracle/oradata/dupdb/system01.dbf'
CHARACTER SET AL32UTF8 contents of Memory Script:
{
set newname for tempfile to
"/u11/app/oracle/oradata/dupdb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u11/app/oracle/oradata/dupdb/sysaux01.dbf",
"/u11/app/oracle/oradata/dupdb/yb01.dbf",
"/u11/app/oracle/oradata/dupdb/users01.dbf",
"/u11/app/oracle/oradata/dupdb/example01.dbf",
"/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf";
switch clone datafile all;
}
executing Memory Script executing command: SET NEWNAME renamed tempfile to /u11/app/oracle/oradata/dupdb/temp01.dbf in control file cataloged datafile copy
datafile copy file name=/u11/app/oracle/oradata/dupdb/sysaux01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u11/app/oracle/oradata/dupdb/yb01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u11/app/oracle/oradata/dupdb/users01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u11/app/oracle/oradata/dupdb/example01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf RECID= STAMP= datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/sysaux01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/yb01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/users01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/example01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u11/app/oracle/oradata/dupdb/UNDOTBS02.dbf contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script database opened
Finished Duplicate Db at -JUN- :: RMAN>
完成!
"active database duplication"过程完成的操作:
·数据文件从source库被copy到duplicate库
·重建控制文件;如果是standby库,控制文件会从source库拷贝到standby
·根据参数db_create_file_dest设置,重建temp文件
·重建online redo log
·根据需要,拷贝归档日志文件
·如果只是指定了spfile,会拷贝spfile文件
·standby库需要拷贝口令文件;如果只是duplicate库,看duplicate database命令是否指定
·快速闪回区不会被copy,闪回日志文件、口令文件和块改变跟踪文件不会被创建
使用duplicate target database ... from active database复制数据库的更多相关文章
- Oracle Database 12c Using duplicate standby database from active database Created Active DataGuard
primary database db_name=zwc, db_unique_name=zwc standby database db_name=zwc, db_unique_name=standb ...
- RMAN duplicate from active database
在Oracle 11G有二种方法实现duplicate: 1.Active database duplication 2.Backup-based duplication Active databas ...
- 使用RMAN DUPLICATE...FROM ACTIVE DATABASE创建物理standby database
Applies to: Oracle Server - Enterprise Edition - Version 11.1.0.6 to 11.2.0.4 [Release 11.1 to 11.2] ...
- Duplicate 复制数据库 搭建Dataguard
1 操作系统环境 此处隐藏具体信息 System IP-address db_name db_version Comment Target DB Auxiliary D ...
- Oracle 11gR2 使用RMAN Duplicate复制数据库
Oracle 11gR2 使用RMAN Duplicate复制数据库 前言: 上周刚做完一个项目,用户要求RAC的数据库可以自己主动备份到另外一个单节点上,单节点可以正常拿起来就能用. ...
- Oracle DB 复制数据库
• 列出创建副本数据库的目的 • 选择用于复制数据库的方法 • 使用RMAN 复制数据库 • 使用RMAN 备份复制数据库 • 基于正在运行的实例复制数据库 使用副本数据库 • 使用副本数据库可执行以 ...
- oracle RMAN复制数据库
列出创建副本数据库的目的 • 选择用于复制数据库的方法 • 使用RMAN 复制数据库 • 使用RMAN 备份复制数据库 • 基于正在运行的实例复制数据库 使用副本数据库 • 使用副本数据库可执行以 ...
- Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE执行结果
> run { > allocate channel prmy1 type disk; > allocate channel prmy2 type disk; > alloca ...
- 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 ...
随机推荐
- Linux 计划任务 Crontab 笔记与总结(4)crontab 的日志
/var/log/cron 文件保存 cron 的任务执行记录 cd /var/log/ ls -l cron* 会发现每天都会有 cron 日志的变化 使用 tail -f cron 能够查看今天的 ...
- Yii源码阅读笔记(十三)
Model类,集中整个应用的数据和业务逻辑: namespace yii\base; use Yii; use ArrayAccess; use ArrayObject; use ArrayItera ...
- sqrt函数实现
感谢杨工,让我更加认识到自己技术薄弱,这道题源自于和杨工的非正式面试,当时根本没思路,甚至没和查找有丝毫的联系,看来做自己想做的还是要付出努力的.sqrt()即开平方运算,y=x*x,已知Y的情况下求 ...
- oracle 多表查询
1.注意点 在查询过程中,不确定数据库表中的数据量,先查询数据量,数据量较大,则不能直接查询(select * from emp),如果数据量较大,直接查询容易造成死机或者数据读取较慢,如果较小可以查 ...
- Maximum Likelihood
https://en.wikipedia.org/wiki/Maximum_likelihood_estimation http://mathworld.wolfram.com/MaximumLike ...
- ②springMVC入门
1 1.1 需求 以案例作为驱动. springmvc和mybaits使用一个案例(商品订单管理). 功能需求:商品列表查询 1.2 环境准备 数据库环境:mysql5.1
- 将所有程序设置XML集中到一个单独XML配置文件的方法:使用appSettings元素的configSource元素
在.NET程序中,程序的配置文件默认都会放在程序根目录下的web.config(网站程序)或App.config(控制台等程序),在该配置文件中可以定义若干程序配置信息. 在此以网站程序为例,首先将下 ...
- Delphi XE5 Android 程序退出功能
Uses FMX.Platform.Android; ... begin {退出程序} MainActivity.finish; end;
- 图形显示之RGB
记得初中学数学几何时,有这样一句话:点运动成线,线运动成面,面运动成体. 其它方面也有相似的原理. 例如常见的gif动态图,就是由一帧一帧的图片快速切换得到的.那么,图片又是怎么显示的呢? 一副图片是 ...
- python中的类,对象,方法,属性等介绍
注:这篇文章写得很好.加底纹的是我自己的理解 python中一切皆为对象,所谓对象:我自己就是一个对象,我玩的电脑就是对象,坐着的椅子就是对象,家里养的小狗也是一个对象...... 我们通过描述属性( ...