Oracle 10G RAC ASM - 控制文件多路存储

时间:2022-01-21 17:27:05

10G RAC中将controlfile进行多元存放(非OMF格式)
1,确定control_files参数
SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/jtods/control01.ctl, +DA
                                                 TA/jtods/control02.ctl, +DATA/
                                                 jtods/control03.ctl
2,更新spfile中的control_files参数
SQL>ALTER SYSTEM SETcontrol_files='+DATA/JTODS/control01.ctl','+DATA/JTODS/control02.ctl','+DATA/JTODS/control03.ctl','+RECOVERY/JTODS/controlfile/control04.ctl';
注意control_files的格式,不同的目录使用引号和逗号隔开.

3,关闭2个节点的实例
srvctl stop database -d JTODS
4,启动节点1,JTODS1至NOMOUNT状态
SQL>STARTUP NOMOUNT;
SQL>show parameter control_file
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/jtods/control01.ctl, +DA
                                                 TA/jtods/control02.ctl, +DATA/
                                                 jtods/control03.ctl,+RECOVERY
                                                 /jtods/controlfile/control04.c
                                                 tl
说明参数已经生效.
5,RMAN从当前的控制文件恢至新的目录
[oracle@vmrac2 ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 5 11:25:13 2012

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

connected to target database: JTODS (not mounted)

RMAN> restore controlfile from '+DATA/JTODS/control01.ctl';

Starting restore at 05-JAN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=148 instance=JTODS2 devtype=DISK

channel ORA_DISK_1: copied control file copy
output filename=+DATA/jtods/control01.ctl
output filename=+DATA/jtods/control02.ctl
output filename=+DATA/jtods/control03.ctl
output filename=+RECOVERY/jtods/controlfile/control04.ctl
Finished restore at 05-JAN-12

6,关闭当前这个实例,重新启动两个节点的实例.
SQL>shutdown immediate
srvctl start database -d JTODS

7,确认修改已经生效.

服务已经正常启动,却控制文件已经存放在了定义的所有目录.

Oracle 10g ASM中控制文件多路(OMF格式)

1,当前控制文件

SQL> show parameter control   

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATADG/prod/controlfile/curre
                                                 nt.263.817172021, +FRADG/prod/
                                                 controlfile/current.256.817172
                                                 021, +DATADG/prod/controlfile/
                                                 current.261.819294085

2,关闭数据库实例(2个实例都关闭)

srvctl stop database -d PROD -o immediate

3,RMAN恢复控制文件(在一个节点执行即可)

RMAN> restore controlfile to '+FRADG' from '+DATADG/prod/controlfile/current.263.817172021';

Starting restore at 2013-07-02 09:04:43
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=144 instance=prod1 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 2013-07-02 09:04:46

4,ASMCMD中找到新恢复的控制文件

ASMCMD> pwd
+FRADG/PROD/CONTROLFILE

ASMCMD> ls -l
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  UNPROT  FINE     JUL 02 08:00:00  Y    current.256.817172021
CONTROLFILE  UNPROT  FINE     JUL 02 09:00:00  Y    current.420.819709485

确定current.420.819709485为增加的控制文件。

5,SQLPLUS中将其与原控制文件一起更新至spfile的control_file参数。

SQL> alter system set control_files='+FRADG/PROD/CONTROLFILE/current.420.819709485','+DATADG/prod/controlfile/current.263.817172021','+FRADG/prod/controlfile/current.256.817172021','+DATADG/prod/controlfile/current.261.819294085' scope=spfile;

System altered.

6,关闭数据库,重启。(1个节点上执行)

SQL>shutdown immediate

srvctl start database -d PROD