creating oracle10g data guard using rman(physical db)

1,对主库进行一个全库备份(利用rman)
    backup as copy incremental level 0 database format '/oracle/rmanbak/%Ubak' tag 'test rman standby db';
2,根据主库生成备库pfile(且根据备库实际情况修正相关参数)
    adding db_unique_name
   create pfile='/oracle/rmanbak/initrman.ora' from spfile;
3,启动主库到mount,利用rman生成备库控制文件,且之后进行归档操作
   startup force mount
   backup current controlfile format '/oracle/rmanbak/%D_u_rmancontrolbak';
   sql 'alter database open';
   sql 'alter system archive log curent';
   sql 'alter system switch logfile';
   backup archivelog all format '/oracle/rmanbak/%d_%u_archivebak';
4,把以上诸步生成的rman备份,利用scp传到备库对应目录(为了简易,我主备库目录结构完全一致,请根据pfile,依次构建dump及db_recovery_dest,存储rman的目录.
5,在备库上,利用rman进行生成备库
    注:先用以上生成的pfile,把备库启到nomount
       startup nomount pfile
    然后
       rman target sys/system@centos auxiliary sys/system
       
    最后贴上我真正开工的脚本,供后记
-bash-3.1$ rman target sys/system@centos auxiliary  sys/system

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jan 30 23:51:31 2010

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

connected to target database: CENTOS (DBID=3005679176)
connected to auxiliary database: CENTOS (not mounted)

RMAN> duplicate target database for standby nofilenamecheck;

Starting Duplicate Db at 30-JAN-10
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.:
{
   restore clone standby controlfile;
   sql clone 'alter database mount standby database';
}
executing Memory Script

Starting restore at 30-JAN-10
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 /oracle/rmanbak/CENTOS_standbyctl.bak
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rmanbak/CENTOS_standbyctl.bak tag=TAG20100201T124043
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/oracle/oradata/centos/centos/control01.ctl
output filename=/oracle/oradata/centos/centos/control02.ctl
output filename=/oracle/oradata/centos/centos/control03.ctl
Finished restore at 30-JAN-10

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

contents of Memory Script.:
{
   set newname for datafile  1 to
 "/oracle/oradata/centos/centos/system01.dbf";
   set newname for datafile  2 to
 "/oracle/oradata/centos/centos/undotbs01.dbf";
   set newname for datafile  3 to
 "/oracle/oradata/centos/centos/sysaux01.dbf";
   set newname for datafile  4 to
 "/oracle/oradata/centos/centos/users01.dbf";
   set newname for datafile  9 to
 "/oracle/oradata/centos/centos/another1.dbf";
   restore
   check readonly
   clone database
   ;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-JAN-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

channel ORA_AUX_DISK_1: restoring datafile 00001
input datafile copy recid=1 stamp=709821048 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-SYSTEM_FNO-1_0hl4u0j2bak
destination for restore of datafile 00001: /oracle/oradata/centos/centos/system01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00001
output filename=/oracle/oradata/centos/centos/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002
input datafile copy recid=3 stamp=709821083 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-UNDOTBS1_FNO-2_0jl4u0kkbak
destination for restore of datafile 00002: /oracle/oradata/centos/centos/undotbs01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00002
output filename=/oracle/oradata/centos/centos/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003
input datafile copy recid=2 stamp=709821064 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-SYSAUX_FNO-3_0il4u0jrbak
destination for restore of datafile 00003: /oracle/oradata/centos/centos/sysaux01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00003
output filename=/oracle/oradata/centos/centos/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004
input datafile copy recid=4 stamp=709821089 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-USERS_FNO-4_0kl4u0l0bak
destination for restore of datafile 00004: /oracle/oradata/centos/centos/users01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00004
output filename=/oracle/oradata/centos/centos/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00009
input datafile copy recid=5 stamp=709821090 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-ANOTHER_FNO-9_0ll4u0l2bak
destination for restore of datafile 00009: /oracle/oradata/centos/centos/another1.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00009
output filename=/oracle/oradata/centos/centos/another1.dbf
Finished restore at 30-JAN-10

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

datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=709689206 filename=/oracle/oradata/centos/centos/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=709689206 filename=/oracle/oradata/centos/centos/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=709689206 filename=/oracle/oradata/centos/centos/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=709689206 filename=/oracle/oradata/centos/centos/users01.dbf
datafile 9 switched to datafile copy
input datafile copy recid=10 stamp=709689206 filename=/oracle/oradata/centos/centos/another1.dbf
Finished Duplicate Db at 30-JAN-10

RMAN>



6,在新生成的备库上,变更standby_file_management=auto,从主库进行相关dml,查看备库是否正常,其它操作同以前,不再多述



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-626535/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9240380/viewspace-626535/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值