1. 在RAC节点1上建立一个/u01/backup目录用于存储primary db的rman备份 集。 !|3e"mP"f!
[oracle@chicago_host1 stage]$ rman target /
pFX6[#o628922RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/backup/%U' DATABASE PLUS ARCHIVELOG;
b+B5g!}3Z3`628922RMAN> BACKUP DEVICE TYPE DISK FORMAT '/u01/backup/%U' CURRENT CONTROLFILE FOR STANDBY;
2. 安装Standby的RAC系统,包括cluster, db software, dbca建库,取同样的db名称,
h.mU cs-L%L628922在 Standby RAC节点1 上将数据库shutdown 然后置为ITPUB个人空间5_S Z+c#IK
SQL> startup nomount
3. 在RAC Standby 节点1上建立 /u01/backup 同样的目录,拷贝primary db上的rman备份集到
7[-X }Q5eD)g'k*H628922Standby节点1的这个目录。
4. 在Standby节点1上tnsnames.ora 中加入连接primary db节点1的别名比如orcl_pri .
5. 准备开始恢复RMAN备份集到Standby 节点1上。
7uN0mmt+|628922rac01sty$cd backup/
rac01sty$ls
01l277gl_1_1 03l277i0_1_1 05l277jq_1_1 listener.oraITPUB个人空间1@*~[k0~p ]
02l277h6_1_1 04l277i9_1_1 initORCL.ora tnsnames.ora
ITPUB个人空间 m.z j8`-aROm
rac01sty$rman target sys/oracle@orcl_pri auxiliary /
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Dec 30 05:50:35 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1234616916)
T%cu:`.]628922connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby nofilenamecheck;
ITPUB个人空间C6^m-uKW;F2U:
Starting Duplicate Db at 30-DEC-09ITPUB个人空间n4}W,o4V]aG@
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
"p)|+K3H`8`/w628922channel ORA_AUX_DISK_1: sid=149 instance=orcl1 devtype=DISK
contents of Memory Script.:
A{-|$OM4wPd628922{ITPUB个人空间1e)BMg&J!{-oh Hb5u/U
restore clone standby controlfile;ITPUB个人空间NnVC+q8B,J Zhb
sql clone 'alter database mount standby database';
I/W2G+yWZElC628922}
)aa5B9y!yl628922executing Memory Script
Starting restore at 30-DEC-09
C!rI2JM gP7x628922using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
)Z2{d6{V{?Z6t628922channel ORA_AUX_DISK_1: restoring control fileITPUB个人空间Ol0D?*?
channel ORA_AUX_DISK_1: reading from backup piece /u01/backup/05l277jq_1_1ITPUB个人空间I+aD'kCvTF[J
channel ORA_AUX_DISK_1: restored backup piece 1
b sR+^_;ho#a628922piece handle=/u01/backup/05l277jq_1_1 tag=TAG20091230T143642
.Ry5k`~W4M,N/{o)v628922channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
3`Rr{2QH;a628922output filename=/ocfs_data/orcl/control01.ctl
-\BK*H$s5s]?)m K628922output filename=/ocfs_data/orcl/control02.ctlITPUB个人空间#{)I{P%T!Z{R;a
output filename=/ocfs_data/orcl/control03.ctl
PE:VYe#R628922Finished restore at 30-DEC-09
sql statement: alter database mount standby database
………………………………………………
Finished Duplicate Db at 30-DEC-09
如遇到无法找到备份集文件,则可执行如下命令来设置:
j/d:A1k](l R628922RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/ opt/oracle/stage /%U';
.ZEZ|.cn3N_628922(一般在target备份时已经设置过一般不需要了,只要确保路径一致就OK)
6. 我们可以在执行dupliate db 的standby 节点1上查看到数据库V$database的open_mode 是mounted standby状态, 查看它的alerg log:
………………………………………………………
Switch of datafile 3 complete to datafile copyITPUB个人空间 ^N1@1u:[3xd5}b)F5H
checkpoint is 728032ITPUB个人空间 ic#F m{5V
Switch of datafile 4 complete to datafile copyITPUB个人空间N[3@Z2~3b/}"@-j?Q
checkpoint is 728032
A7]$w2`]}628922Switch of datafile 5 complete to datafile copyITPUB个人空间}ZjTHp7J@
checkpoint is 728032jE:O;a,Ad}A k1?628922
7. ok, 现在已经在RAC Standby 节点1上实现了physical standby, 可以类似单机standby一样操作。
SQL> alter database open read only;
Database altered.
SQL> shutdown immediateITPUB个人空间"be:]N0x Mg,Ty!O
..
SQL> startup nomountITPUB个人空间Gj obr%_4e.M
..
SQL> alter database mount standby database
..
8. 如果需要激活, 可能需要修改一些spfile中的参数,加入或修改 redo, undo 等。
9. 当RAC Standby重启后,crs默认会自动将database开启open read only模式,这时issue recover命令会报错无法close database,因此,对于物理standby来说,最好使用以下命令将crs开启设置为自动mount状态:
srvctl modify database -d orcl -r PHYSICAL_STANDBY-s mount
10. 激活Physical Standby.
注意: 激活physical standby之前,需要关闭两个standby RAC实例,然后在rac1上激活数据库并开启。
SQL> startup nomountITPUB个人空间Gj obr%_4e.M
SQL> alter database mount standby database
SQL> alter database activate standby database;
;U#D1{ Jt~v w628922SQL> alter database mount;ITPUB个人空间%|S+[1w?Tv%X
SQL> alter database open ; ITPUB个人空间I#q%H)Nf;_(R ZA
SQL> shutdown immediate ;ITPUB个人空间&Tg6];ZSmfSk.N+e
SQL> startup
确认spfile没有问题后,在第二个Standby RAC节点执行
SQL> startup
如果没有使用Data Guard broker,CRS就无法知道primary和standby的角色转换,可能就需要手工修改OCR的状态信息。 命令如下:
$ srvctl modify database -d wmb2bprd -r PRIMARY -s open
(standby节点1执行即可, RAC以后开启都会自动open)
ITPUB个人空间-Z z
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/628922/viewspace-664561/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/628922/viewspace-664561/