【Oracle】RAC控制文件多路复用

1.—关闭数据库,各个节点都要关闭:

[oracle@rac1 ~]$ srvctl stop database -d racdb -o immediate

2.—启动任一节点到nomount状态:

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 29 14:32:06 2016

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

Connected to an idle instance.

SYS@RACDB1> startup nomount
ORACLE instance started. Total System Global Area 730714112 bytes
Fixed Size 2256832 bytes
Variable Size 322961472 bytes
Database Buffers 402653184 bytes
Redo Buffers 2842624 bytes
SYS@RACDB1> create pfile='/home/oracle/initracdb.ora' from spfile; File created. SYS@RACDB1> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

3.—使用rman备份控制文件:

[oracle@rac1 ~]$ rman target/

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Dec 29 14:33:59 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (not mounted)

4.—因为OMF机制,此处备份出来的文件可以指定准确路径,也可以如下指定:

RMAN> restore controlfile to '+DATA' from '+DATA/racdb/controlfile/current.260.931717363';

Starting restore at 29-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 instance=RACDB1 device type=DISK channel ORA_DISK_1: copied control file copy
Finished restore at 29-DEC-16 RMAN> restore controlfile to '+DATA' from '+DATA/racdb/controlfile/current.260.931717363'; Starting restore at 29-DEC-16
using channel ORA_DISK_1 channel ORA_DISK_1: copied control file copy
Finished restore at 29-DEC-16 RMAN> exit Recovery Manager complete.

5.—在grid用户下登录asmcmd查看备份的控制文件:

[oracle@rac1 ~]$ su - grid
Password:
[grid@rac1 ~]$ asmcmd
ASMCMD> cd data/racdb/controlfile
ASMCMD> pwd
+data/racdb/controlfile
ASMCMD> ls
Current.260.931717363
current.286.931876547
current.287.931876517
ASMCMD> exit

6.—修改数据库的参数文件,把备份出来的控制文件添加到参数文件中:

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 29 14:38:45 2016

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options SYS@RACDB1> select inst_id,host_name,status from gv$instance; INST_ID HOST_NAME STATUS
---------- ---------------------------------------------------------------- ------------
1 rac1 STARTED SYS@RACDB1> alter system set control_files=
2 '+data/racdb/controlfile/Current.260.931717363',
3 '+data/racdb/controlfile/current.286.931876547',
4 '+data/racdb/controlfile/current.287.931876517'
5 scope=spfile; System altered.

7.—修改完参数文件后,关闭数据库:

SYS@RACDB1> shutdown abort;
ORACLE instance shut down. SYS@RACDB1> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

8.—同时打开所有节点,查看控制文件的设置情况:

[oracle@rac1 ~]$ srvctl start database -d racdb -o open

SYS@RACDB1> select inst_id,name from gv$controlfile;
INST_ID NAME
---------- --------------------------------------------------
1 +DATA/racdb/controlfile/current.260.931717363
1 +DATA/racdb/controlfile/current.286.931876547
1 +DATA/racdb/controlfile/current.287.931876517
2 +DATA/racdb/controlfile/current.260.931717363
2 +DATA/racdb/controlfile/current.286.931876547
2 +DATA/racdb/controlfile/current.287.931876517 6 rows selected.

至此控制文件的多路复用得以实现!

**总结:
控制文件多路复用的关键点是:
①rman复制控制文件之前要同时关闭所有节点;
②参数文件要在记得修改;
③同时打开所有节点。**

上一篇:听 Fabien Potencier 谈Symfony2 之 《What is Symfony2 ?》


下一篇:Oracle中从控制文件读取的视图