使用RMAN的Duplicate功能创建物理DataGuard


如果主端与备端目录不同,在两端的pfile文件中要添加,当然如果相同也可以添加:

*.log_file_name_convert='/u01/oradata/orcl/','/u02/oradata/orcl/'

*.db_file_name_convert='/u01/oradata/orcl/','/u02/oradata/orcl/'


--在主端生成完全备份,包括归档日志与standby控制文件
[oracle@source bak]rman target / 

Recovery Manager: Release 10.2.0.1.0 - Production on 星期四 4月 26 23:22:58 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1309351439)

RMAN> run{
backup FORMAT '/home/oracle/bak/orcl_%U_%T'
database
include current controlfile for standby
plus archivelog 
;
} 2> 3> 4> 5> 6> 7> 

--将完全备份copy 到备机
[oracle@source bak]$ scp * 192.168.1.103://home/oracle/bak

--在备端以pfile启动到nomount状态,并创建spfile;
[oracle@target dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 4月 27 23:07:28 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>  startup pfile=initorcl.ora nomount;
ORACLE instance started.

Total System Global Area  276824064 bytes
Fixed Size		    2020160 bytes
Variable Size		   96472256 bytes
Database Buffers	  176160768 bytes
Redo Buffers		    2170880 bytes
SQL>  create spfile from pfile='initorcl.ora';

File created.

--在主端使用RMAN的Duplicate创建dg,如果数据文件与重做日志文件目录相同,要添加 nofilenamecheck ,否则不需要添加
[oracle@source bak]$ rmant an target /

Recovery Manager: Release 10.2.0.1.0 - Production on  4 27 23:08:23 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1309351439)

RMAN> connect auxiliary sys/oracle@orcl_st

connected to auxiliary database: ORCL (not mounted)

RMAN>  run{
duplicate target database
for standby nofilenamecheck dorecover;
}2> 3> 4> 

Starting Duplicate Db at 2012-04-27 23:08:45
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

contents of Memory Script:
{
   set until scn  611334;
   restore clone standby controlfile;
   sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 2012-04-27 23:08:45
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/bak/orcl_0cn9gs8i_1_1_20120427
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/bak/orcl_0cn9gs8i_1_1_20120427 tag=TAG20120427T223632
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output filename=/home/oracle/oradata/orcl/control01.ctl
output filename=/home/oracle/oradata/orcl/control02.ctl
output filename=/home/oracle/oradata/orcl/control03.ctl
Finished restore at 2012-04-27 23:08:47

sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1

contents of Memory Script:
{
   set until scn  611334;
   set newname for tempfile  1 to 
 "/home/oracle/oradata/orcl/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to 
 "/home/oracle/oradata/orcl/system01.dbf";
   set newname for datafile  2 to 
 "/home/oracle/oradata/orcl/undotbs01.dbf";
   set newname for datafile  3 to 
 "/home/oracle/oradata/orcl/sysaux01.dbf";
   set newname for datafile  4 to 
 "/home/oracle/oradata/orcl/users01.dbf";
   restore
   check readonly
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

renamed temporary file 1 to /home/oracle/oradata/orcl/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2012-04-27 23:08:53
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

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 /home/oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /home/oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /home/oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /home/oracle/oradata/orcl/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/bak/orcl_0bn9gs3g_1_1_20120427
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/bak/orcl_0bn9gs3g_1_1_20120427 tag=TAG20120427T223632
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
Finished restore at 2012-04-27 23:10:10

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=5 stamp=781744210 filename=/home/oracle/oradata/orcl/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=6 stamp=781744210 filename=/home/oracle/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=7 stamp=781744210 filename=/home/oracle/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=8 stamp=781744210 filename=/home/oracle/oradata/orcl/users01.dbf

contents of Memory Script:
{
   set until scn  611334;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 2012-04-27 23:10:10
using channel ORA_AUX_DISK_1

starting media recovery

archive log thread 1 sequence 13 is already on disk as file /home/oracle/archive/1_13_781570707.dbf
archive log filename=/home/oracle/archive/1_13_781570707.dbf thread=1 sequence=13
media recovery complete, elapsed time: 00:00:02
Finished recover at 2012-04-27 23:10:14
Finished Duplicate Db at 2012-04-27 23:10:14

完成后,备库启动到mount状态, 然后对DG进行验证。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值