使用rman中的duplicate复制数据库
[oracle@hxl01 dbs]$orapwd file=orapworaclbak password=oracle entries=10 force=y
mkdir -p /u01/app/oracle/admin/oracl/bdump
mkdir -p /u01/app/oracle/admin/oracl/cdump
mkdir -p /u01/app/oracle/admin/oracl/dpdump
mkdir -p /u01/app/oracle/admin/oracl/pfile
mkdir -p /u01/app/oracle/admin/oracl/udump
mkdir -p /u01/app/oracle/oradata/oracl
mkdir -p /u01/app/oracle/flash_recovery_area
将在target上创建的pfile(initoracl.ora,具体创建步骤参考3.1)拷贝到Duplicate,修改参数(*.db_name='oraclbak'),其他跟目标库保持一致,然后创建spfile.
Sql>create spfile from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initoracl.ora';
Sql>startup nomount;
[oracle@hxl01 dbs]$netca
[oracle@hxl01 dbs]$netmgr
Sql>shutdown immediate;
Sql>startup mount;
Sql>alter database archivelog;
sql>alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/duplicate' scope=both;
sql>alter database open;
Rman>run{
set maxcorrupt for datafile 5 to 20;
allocate channel dup type disk;
backup format '/u01/app/oracle/duplicate/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/u01/app/oracle/duplicate/al_t%t_s%s_p%p' archivelog all delete input;
release channel dup;
}
4.复制数据库
duplicate target database to oraclbak nofilenamecheck
logfile group 1 ('/u01/app/oracle/oradata/oracl/redo1_1.log','/u01/app/oracle/oradata/oracl/redo1_2.log') size 512M,
group 2 ('/u01/app/oracle/oradata/oracl/redo2_1.log','/u01/app/oracle/oradata/oracl/redo2_2.log') size 512M,
group 3 ('/u01/app/oracle/oradata/oracl/redo3_1.log','/u01/app/oracle/oradata/oracl/redo3_2.log') size 512M;
}
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
contents of Memory Script:
{
set until scn 1556049;
set newname for datafile 1 to
"/u01/app/oracle/oradata/oracl/system01.dbf";
set newname for datafile 2 to
"/u01/app/oracle/oradata/oracl/undotbs01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/oracl/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/oracl/users01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/oracl/hxl01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 13-FEB-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/oracl/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/oracl/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/oracl/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/oracl/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/oracl/hxl01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/duplicate/df_t775114282_s89_p1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/duplicate/df_t775114282_s89_p1 tag=TAG20120213T053120
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:47
Finished restore at 13-FEB-12
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/oracl/redo1_1.log', '/u01/app/oracle/oradata/oracl/redo1_2.log' ) SIZE 512 M ,
GROUP 2 ( '/u01/app/oracle/oradata/oracl/redo2_1.log', '/u01/app/oracle/oradata/oracl/redo2_2.log' ) SIZE 512 M ,
GROUP 3 ( '/u01/app/oracle/oradata/oracl/redo3_1.log', '/u01/app/oracle/oradata/oracl/redo3_2.log' ) SIZE 512 M
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=775102986 filename=/u01/app/oracle/oradata/oracl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=775102987 filename=/u01/app/oracle/oradata/oracl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=775102987 filename=/u01/app/oracle/oradata/oracl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=775102987 filename=/u01/app/oracle/oradata/oracl/hxl01.dbf
contents of Memory Script:
{
set until scn 1556049;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 13-FEB-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
starting media recovery
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=47
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=48
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/duplicate/al_t775114352_s91_p1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/duplicate/al_t775114352_s91_p1 tag=TAG20120213T053230
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
archive log filename=/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_02_13/o1_mf_1_47_7mj0wydg_.arc thread=1 sequence=47
channel clone_default: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_02_13/o1_mf_1_47_7mj0wydg_.arc recid=2 stamp=775103016
archive log filename=/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_02_13/o1_mf_1_48_7mj0x0qm_.arc thread=1 sequence=48
channel clone_default: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_02_13/o1_mf_1_48_7mj0x0qm_.arc recid=1 stamp=775103009
media recovery complete, elapsed time: 00:00:09
Finished recover at 13-FEB-12
contents of Memory Script:
{
shutdown clone;
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 524288000 bytes
Fixed Size 1220360 bytes
Variable Size 138412280 bytes
Database Buffers 381681664 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u01/app/oracle/oradata/oracl/redo1_1.log', '/u01/app/oracle/oradata/oracl/redo1_2.log' ) SIZE 512 M ,
GROUP 2 ( '/u01/app/oracle/oradata/oracl/redo2_1.log', '/u01/app/oracle/oradata/oracl/redo2_2.log' ) SIZE 512 M ,
GROUP 3 ( '/u01/app/oracle/oradata/oracl/redo3_1.log', '/u01/app/oracle/oradata/oracl/redo3_2.log' ) SIZE 512 M
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/oracl/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/oracl/undotbs01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/oracl/sysaux01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/oracl/users01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/oracl/hxl01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /u01/app/oracle/oradata/oracl/temp01.dbf in control file
cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/oracl/undotbs01.dbf recid=1 stamp=775103080
cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/oracl/sysaux01.dbf recid=2 stamp=775103081
cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/oracl/users01.dbf recid=3 stamp=775103083
cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/oracl/hxl01.dbf recid=4 stamp=775103084
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=775103080 filename=/u01/app/oracle/oradata/oracl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=775103081 filename=/u01/app/oracle/oradata/oracl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=775103083 filename=/u01/app/oracle/oradata/oracl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=775103084 filename=/u01/app/oracle/oradata/oracl/hxl01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 13-FEB-12
数据库打开后使用sysdba登陆提示ORA-01031: insufficient privileges,找了半天原因是密码文件命名问题, 之前创建密码文件名为orapwdoraclbak,将其修改为orapworaclbak,问题解决,注意在linux下密码文件的命名格式为orapw+sid.
SQL> connect sys/oracle@dup_oracl as sysdba
ERROR:
ORA-01031: insufficient privileges
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 02/14/2012 01:01:41
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 53 lowscn 1597845 found to restore
SET until sequence 52;
duplicate target database to oraclbak nofilenamecheck
logfile group 1 ('/u01/app/oracle/oradata/oracl/redo1_1.log','/u01/app/oracle/oradata/oracl/redo1_2.log') size 512M,
group 2 ('/u01/app/oracle/oradata/oracl/redo2_1.log','/u01/app/oracle/oradata/oracl/redo2_2.log') size 512M,
group 3 ('/u01/app/oracle/oradata/oracl/redo3_1.log','/u01/app/oracle/oradata/oracl/redo3_2.log') size 512M;
}
使用rman中的duplicate复制数据库的更多相关文章
- 11g 使用rman duplicate复制数据库,创建辅助实例
一,创建所需目录 1)创建审计文件目录 PROD1@dbrac1 /dsg/oracle11$ cd $ORACLE_BASE/admin PROD1@dbrac1 /u01/app/oracle/a ...
- Oracle 11gR2使用RMAN duplicate复制数据库
11g的RMAN duplicate 个人感觉比10g的先进了很多,10g需在rman备份的基础上进行复制,使用RMAN duplicate创建一个数据完全相同但DBID不同的数据库.而11g的RMA ...
- Oracle 11gR2 使用RMAN Duplicate复制数据库
Oracle 11gR2 使用RMAN Duplicate复制数据库 前言: 上周刚做完一个项目,用户要求RAC的数据库可以自己主动备份到另外一个单节点上,单节点可以正常拿起来就能用. ...
- Duplicate复制数据库并创建物理StandBy(spfile+不同实例名+不同路径)
过程和Duplicate复制数据库并创建物理StandBy类似,只是不需要重启数据库. 目的:创建standby,不重启源数据库 1设定环境如下: Primary数据库 IP 172.17.22.16 ...
- Duplicate复制数据库并创建物理StandBy(spfile+不同实例名)
过程和Duplicate复制数据库并创建物理StandBy类似,只是不需要重启数据库. 目的:创建standby,不重启源数据库 1设定环境如下: Primary数据库 IP 172.17.22.16 ...
- Duplicate复制数据库并创建物理StandBy(spfile版本)
过程和Duplicate复制数据库并创建物理StandBy类似,只是不需要重启数据库. 目的:创建standby,不重启源数据库 1设定环境如下: Primary数据库 IP 172.17.22.16 ...
- Duplicate 复制数据库 搭建Dataguard
1 操作系统环境 此处隐藏具体信息 System IP-address db_name db_version Comment Target DB Auxiliary D ...
- RMAN_学习实验2_RMAN Duplicate复制数据库过程(案例)
待整理 对于基于生产环境下的数据库的版本升级或者测试新的应用程序的性能及其影响,备份恢复等等,我们可以采取从生产环境以克隆的方式将其克隆到本地而不影响生产数据库的正常使用.实现这个功能我们可以借助rm ...
- RMAN中建立Catalog 用数据库的例子
RMAN中可以备份metadata到control文件,也可以备份metadata到数据库中,此数据库称为catalog database. 本文参考网上文章,建立一个例子: 使用机器: 机器1:ta ...
随机推荐
- dllimport路径问题
今天做了个试验,是针对dllimport("XXX.DLL");这样写的时候,系统是如何寻找该dll的. 首先系统会搜寻主应用程序根目录. 其次搜寻操作系统安装目录,一般情况是C: ...
- META标签的NAME变量
META标签的NAME变量语法格式是: <META NAME=xxx CONTENT=xxxxxxxxxxxxxxxxxx> 其中xxx主要有下面几种参数: 1. Keywords(关键字 ...
- (spring-第11回【IoC基础篇】)BeanWrapper--实例化Bean的第四大利器
重复是理解和记忆的最好方法.在讲实例化Bean的每个步骤之前,我都会先复习一下Bean实例化的整个过程: 结合图片我们回顾一下具体的过程: ResourceLoader加载配置信息, 由BeanDef ...
- (spring-第1回【IoC基础篇】)Spring容器中Bean的生命周期
日出日落,春去秋来,花随流水,北雁南飞,世间万物皆有生死轮回.从调用XML中的Bean配置信息,到应用到具体实例中,再到销毁,Bean也有属于它的生命周期. 人类大脑对图像的认知能力永远高于文字,因此 ...
- vi中的批量替换
举个例子啊: 将文件tihuan(假设此文本中字符a)中的所有字符a换成字符w,其命令为: 1.vi tihuan 2.按esc键 3.按shift+: 4.在:后输入 %s/a/w/g 就ok ...
- PHP图像处理之画图
PHP图像处理 画图 验证码,统计图 安装GD库-----LAMP 安装后在D:\APMServ5.2.6\PHP\ext文件中有php_gd2.dll文件 ...
- CRM客户关系管理系统(十三)
---客户资料添加 1.事件流程:
- 服务器的Arch Linux,CentOS的,Debian的,Fedora的,Gentoo的,openSUSE的,Slackware的,和Ubuntu哪个好
我能够建议的就是:如果你自己是开发者,如果你自己买了一台 VPS 自己搭服务器用.选 Ubuntu/Debian 挺好.当然如果你觉得自己闲工夫实在多得没处花,可以隔三差五的就到服务器上做升级更新,用 ...
- 第三个Sprint冲刺第二天 最终篇
一.例会人员:李泳江,邵家文,周伟雄,谢洪跃 日期:6月21号 例会内容: 1.完成表格任务 编号 名称 时间 已用时间 是否完成 1 画出算法流程图 4小时 4小时 完成 2 界面设计 5小时 ...
- LeetCode Combination Sum II (DFS)
题意: 在集合candidates中选出任意多个元素,使得他们的和为target,返回所有的组合,以升序排列. 思路: 难点在于如何去重,比如集合{1,1,2},target=3,那么只有一个组合就是 ...