oracle 11g rac在建库的时候使用了ASM存储,然而rac在建库时默认只在asm上面创建了一个控制文件,如果想多加几个控制文件,
就需要通过手工来添加了,很多人可能会忽略这个细节,但是我们还是希望多建几个control file来增加
数据库的稳定性。
下面是具体步骤:
1、在操作前要保留一份控制文件和参数文件,以备搞不成恢复用。
注:只在一个
数据库实例上进行修改。
sql> create pfile='/home/oracle/pfile0531.ora' from spfile;
File created.
SQL> alter database backup controlfile to '/home/oracle/cntrl_20180531.ctl';
Database altered.
SQL> col name for a50
SQL> select * from gv$controlfile;
INST_ID STATUS NAME IS_ BLOCK_SIZE FILE_SIZE_BLKS
---------- ------- -------------------------------------------------- --- ---------- --------------
2 +DATA/crmdb/controlfile/current.282.873504505 NO 16384 1152
1 +DATA/crmdb/controlfile/current.282.873504505 NO 16384 1152
2、修改spfile中的控制文件参数
SQL> alter system set control_files='+DATA/crmdb/controlfile/current.256.977420629','+DATA','+DATA' scope=spfile sid='*';
System altered.
3、关闭数据库实例
crmdb1:/home/oracle@db> srvctl stop database -d crmdb
4、创建control file 副本
crmdb1:/home/oracle@db> rman target/
Recovery Manager: Release 11.2.0.4.0 - Product
ion on 星期五 2月 6 15:50:12 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 68412682240 bytes
Fixed Size 2263488 bytes
Variable Size 31675385408 bytes
Database Buffers 36507222016 bytes
Redo Buffers 227811328 bytes
RMAN> restore controlfile from '+DATA/crmdb/controlfile/current.256.977420629';
Starting restore at 06-2月 -15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4086 instance=crmdb device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA/crmdb/controlfile/current.256.870194351
output file name=+DATA/crmdb/controlfile/current.426.870969063
output file name=+DATA/crmdb/controlfile/current.427.870969063
Finished restore at 06-2月 -15
RMAN> sql ' alter database mount';
sql statement: alter database mount
released channel: ORA_DISK_1
RMAN> sql ' alter database open';
sql statement: alter database open
5、登录数据库验证
SQL> select name from gv$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/crmdb/controlfile/current.256.977420629
+DATA/crmdb/controlfile/current.276.977568423
+DATA/crmdb/controlfile/current.277.977568423
6、修改spfile中的新添加的控制文件参数
SQL> alter system set control_files='+DATA/crmdb/controlfile/current.256.977420629','+DATA/crmdb/controlfile/current.276.977568423','+DATA/crmdb/controlfile/current.277.977568423' scope=spfile sid='*';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
7、打开数据库最终验证
crmdb1:/home/oracle@db> srvctl start database -d crmdb
SQL> select * from gv$controlfile;
INST_ID STATUS NAME IS_ BLOCK_SIZE FILE_SIZE_BLKS
---------- ------- -------------------------------------------------- --- ---------- --------------
1 +DATA/crmdb/controlfile/current.256.977420629 NO 16384 1512
1 +DATA/crmdb/controlfile/current.276.977568423 NO 16384 1512
1 +DATA/crmdb/controlfile/current.277.977568423 NO 16384 1512
2 +DATA/crmdb/controlfile/current.256.977420629 NO 16384 1512
2 +DATA/crmdb/controlfile/current.276.977568423 NO 16384 1512
2 +DATA/crmdb/controlfile/current.277.977568423 NO 16384 1512
6 rows selected.
0