在相同的主机上创建一个duplicate数据库
在相同的主机上创建一个duplicate数据库
source db:dbtest
auxiliary db:dupdb
duplicate database会自动分配一个新的DBID
要确保auxiliary channel能访问到所需的备份以及归档日志
1.备份source db
$ rman target /
RMAN> backup database format ='/home/oracle/arch/dbbak_%U' plus archivelog;
2.修改监听文件,静态注册监听
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = testdb)
(ORACLE_HOME = /u01/app/oracle/product/11.2./dbhome_1/)
(SID_NAME =testdb)
)
(SID_DESC =
(GLOBAL_DBNAME = dupdb)
(ORACLE_HOME = /u01/app/oracle/product/11.2./dbhome_1/)
(SID_NAME =dupdb)
)
)
3.修改tnsnames.ora文件
DBTEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbtest)
)
) DUPDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dupdb)
)
)
4.为duplicate 数据库创建参数文件initdupdb.ora
db_name=dupdb
db_block_size=
compatible=11.2.0.4.
remote_login_passwordfile=exclusive
control_files=('/u01/app/oracle/oradata/dupdb/control01.ctl','/u01/app/oracle/oradata/dupdb/control02.ctl')
db_file_name_convert=('/u01/app/oracle/oradata/dbtest','/u01/app/oracle/oradata/dupdb')
log_file_name_covert=('/u01/app/oracle/oradata/dbtest','/u01/app/oracle/oradata/dupdb')
#其他参数是可选的
5.启动auxiliary database(duplicate database)
$ export ORACLE_SID=dupdb
$ sqlplus /nolog
SQL> connect /as sysdba
SQL> startup nomount pfile='/u01/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
$ export ORACLE_SID=dupdb
$ rman Recovery Manager: Release 11.2.0.4. - Production on Thu Jun :: Copyright (c) , , Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/system1@dbtest connected to target database: DBTEST (DBID=) RMAN> connect auxiliary / connected to auxiliary database: DUPDB (not mounted) RMAN>
7.启动duplicate database操作
RMAN> duplicate target database to dupdb;
以下为duplicate命令的执行结果:
RMAN> duplicate target database to 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:
{
sql clone "create spfile from memory";
}
executing Memory Script sql statement: create spfile from memory contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script 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 =
''DBTEST'' 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
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script sql statement: alter system set db_name = ''DBTEST'' 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 restore at -JUN- ::
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID= device type=DISK channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBTEST/autobackup/2015_06_25/o1_mf_s_883287663_brp8zhvt_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBTEST/autobackup/2015_06_25/o1_mf_s_883287663_brp8zhvt_.bkp tag=TAG20150625T054103
channel ORA_AUX_DISK_1: restored backup piece
channel ORA_AUX_DISK_1: restore complete, elapsed time: ::
output file name=/u01/app/oracle/oradata/dupdb/control01.ctl
output file name=/u01/app/oracle/oradata/dupdb/control02.ctl
Finished restore at -JUN- :: database mounted contents of Memory Script:
{
set until scn ;
sql clone 'alter database flashback off';
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/system01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/sysaux01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/undotbs01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/users01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/example01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_data01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_data02.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_data03.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_index01.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_index02.dbf";
set newname for datafile to
"/u01/app/oracle/oradata/dupdb/nnc_index03.dbf";
restore
clone database
;
}
executing Memory Script executing command: SET until clause sql statement: alter database flashback off executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME 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 restore at -JUN- ::
using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/example01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_data01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_data02.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_data03.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_index01.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_index02.dbf
channel ORA_AUX_DISK_1: restoring datafile to /u01/app/oracle/oradata/dupdb/nnc_index03.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/arch/dbbak_0tqabpiv_1_1
channel ORA_AUX_DISK_1: piece handle=/home/oracle/arch/dbbak_0tqabpiv_1_1 tag=TAG20150625T054047
channel ORA_AUX_DISK_1: restored backup piece
channel ORA_AUX_DISK_1: restore complete, elapsed time: ::
Finished restore at -JUN- :: contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/system01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/sysaux01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/undotbs01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/users01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/example01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data02.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data03.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index02.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index03.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 /home/oracle/arch/1_10_883118265.dbf
archived log for thread with sequence is already on disk as file /home/oracle/arch/1_11_883118265.dbf
archived log file name=/home/oracle/arch/1_10_883118265.dbf thread= sequence=
archived log file name=/home/oracle/arch/1_11_883118265.dbf thread= sequence=
media recovery complete, elapsed time: ::
Finished recover at -JUN- ::
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 =
''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 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 ( '/u01/app/oracle/oradata/dupdb/redo01.log' ) SIZE M REUSE,
GROUP ( '/u01/app/oracle/oradata/dupdb/redo02.log' ) SIZE M REUSE,
GROUP ( '/u01/app/oracle/oradata/dupdb/redo03.log' ) SIZE M REUSE
DATAFILE
'/u01/app/oracle/oradata/dupdb/system01.dbf'
CHARACTER SET ZHS16GBK contents of Memory Script:
{
set newname for tempfile to
"/u01/app/oracle/oradata/dupdb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/dupdb/sysaux01.dbf",
"/u01/app/oracle/oradata/dupdb/undotbs01.dbf",
"/u01/app/oracle/oradata/dupdb/users01.dbf",
"/u01/app/oracle/oradata/dupdb/example01.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_data01.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_data02.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_data03.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_index01.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_index02.dbf",
"/u01/app/oracle/oradata/dupdb/nnc_index03.dbf";
switch clone datafile all;
}
executing Memory Script executing command: SET NEWNAME renamed tempfile to /u01/app/oracle/oradata/dupdb/temp01.dbf in control file cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/sysaux01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/undotbs01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/users01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/example01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_data01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_data02.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_data03.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_index01.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_index02.dbf RECID= STAMP=
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/dupdb/nnc_index03.dbf RECID= STAMP= datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/sysaux01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/undotbs01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/users01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/example01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data02.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_data03.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index01.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index02.dbf
datafile switched to datafile copy
input datafile copy RECID= STAMP= file name=/u01/app/oracle/oradata/dupdb/nnc_index03.dbf contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script database opened
Finished Duplicate Db at -JUN- :: RMAN>
在相同的主机上创建一个duplicate数据库的更多相关文章
- 记一次oracle创建一个新数据库,并导入正式环境数据库备份的dmp包过程
背景:正式环境oracle数据库定时用exp备份一个dmp包,现在打算在一台机器上创建一个新数据库,并导入这个dmp包. 1.创建数据库 开始 -> 所有程序 -> Oracle -> ...
- git 从分支上创建一个分支
相关连接: 创建于合并分支:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00 ...
- 用ssh-key-gen 在本地主机上创建公钥和密钥
用ssh-key-gen 在本地主机上创建公钥和密钥 ligh@local-host$ ssh-keygen -t rsa
- 创建一个 SQLite 数据库
首先,我们学习如何创建一个SQLite 数据库.如果想要在data/example.sqlite 这个路径中创建一个示例数据库,就必须确保该路径存在.如果该路径不存在,就必须先创建路径:if (!di ...
- 如何创建一个 PostgreSQL 数据库?
PostgreSQL 官网截图 PostgreSQL 是什么? PostgreSQL 是一个功能非常强大的,历史悠久,开源的关系数据库.PostgreSQL支持大部分的SQL标准并且提供了很多其他现代 ...
- [ASP.NET MVC2 系列] ASP.Net MVC教程之《在15分钟内用ASP.Net MVC创建一个电影数据库应用程序》
[ASP.NET MVC2 系列] [ASP.NET MVC2 系列] ASP.Net MVC教程之<在15分钟内用ASP.Net MVC创建一个电影数据库应用程序> ...
- 在一个空ASP.NET Web项目上创建一个ASP.NET Web API 2.0应用
由于ASP.NET Web API具有与ASP.NET MVC类似的编程方式,再加上目前市面上专门介绍ASP.NET Web API 的书籍少之又少(我们看到的相关内容往往是某本介绍ASP.NET M ...
- 如何在github上创建一个Repository (Windows)
一种方式是利用Github for windows工具 来操作github,这个是我推荐的方式 1 请先下载一个工具Github for windows,下载地址为:https://windows.g ...
- 当网卡收到的包的目的地址是主机上另一个网卡的地址.arp总结
2019/01/13 今天测试发现结果不符合预期呀,发现设置了arp_filter之后,仍然是能ping通主机上的另外一张网卡.但是现在的问题是 -------------------- 内核中是如何 ...
随机推荐
- PHP 错误与异常 笔记与总结(11 )register_shutdown_function() 函数的使用
通过 register_shutdown_function 方法,可以让我们设置一个当执行关闭时可以被调用的另一个函数. 也就是说,当我们的脚本执行完成或者意外死掉导致 php 执行即将关闭时,我们的 ...
- PHP iconv()函数转字符编码的问题(转)
PHP iconv()函数转字符编码的问题(转) 载自:http://www.nowamagic.net/php/php_FunctionIconv.php 在php函数库有一个函数:iconv(), ...
- mysql控制台命令
* mysql 链接服务器 mysql -h localhost -u root -p show processlist; update mysql.user set authentication_ ...
- Strong AI Versus Weak AI
Computer Science An Overview _J. Glenn Brookshear _11th Edition The conjecture that machines can be ...
- Structured Streaming Programming Guide
https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html http://www.slidesha ...
- JAVA 调用matlab 出错总结
1.Java:Unsupported major.minor version 51.0 (unable to load class 出现该错误是由于class编译器的JDK版本高于运行期的JDK版本. ...
- php mysql 事务处理
MYSQL 的事务处理主要有两种方法. 1 .用 begin,rollback,commit 来实现 begin 开始一个事务 rollback 事务回滚 commit 事务确认 2 .直接用 ...
- php读取memcahed java session
PHP 共享 JAVA 保存的session信息 情景: 1:现在有两个系统,一个是Java做的系统,一个是PHP的系统,现在要把两个系统弄成一个单点登录. 2:两个系统两个库,两个库的表结构完全不同 ...
- Merge用法
Merge用来从一个表中选择一些数据更新或者插入到另一个表中.而最终是用更新还是用插入的方式取决于该语句中的条件. 下面我们简单的举一个例子: SQL> create table merge ...
- FTS抓包看蓝牙的SDP整个过程
1.概述 SDP是蓝牙的Service Discovery Protocol,用来发现远程设备能够提供的Service.它只负责发现对方支持的Service,不负责Service的具体实现. ...