集群数据库添加控制文件

以下是简要介绍给集群数据库添加控制文件的过程。
----添加控制文件:
---查看当前的控制文件:
SQL> show parameter control_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/prod/controlfile/current
                                                 .264.927167493, +OCR_VOTE/prod
                                                 /controlfile/current.256.92716
                                                 7497
#可以看到有两个日志文件:

---关闭数据库并将一个节点启动到nomount状态:
[oracle@node1 ~]$ srvctl stop database -d prod -o immediate
PRCC-1016 : prod was already stopped
[oracle@node1 ~]$ srvctl status database -d prodInstance prod1 is not running on node node1
Instance prod2 is not running on node node2
[oracle@node1 ~]$ 
#已经关闭数据库:
                                            
--开启到nomount状态:
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 6 14:35:22 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             620760656 bytes
Database Buffers          222298112 bytes
Redo Buffers                5132288 bytes
SQL> 

---备份参数文件:
SQL> create pfile='/home/oracle/initprod.ora' from spfile;
File created.

SQL> 

---利用RMAN 创建控制文件:
[oracle@node1 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Nov 6 14:44:33 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: PROD (not mounted)
RMAN> 
RMAN> restore controlfile to '+DATA' from '+DATA/prod/controlfile/Current.264.927167493'; 

Starting restore at 06-NOV-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 instance=prod1 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 06-NOV-16
RMAN> exit

Recovery Manager complete.
[oracle@node1 ~]$      
                           -
---在Grid用户使用ASM 查看控制文件:
cd DATA/prod/CONTROLFILE
[grid@node2 ~]$ 
[grid@node2 ~]$ asmcmd
ASMCMD> 
ASMCMD> cd DATA/prod/CONTROLFILE
ASMCMD> pwd
+DATA/prod/CONTROLFILE
ASMCMD> ls
Current.264.927167493
current.269.927211623
ASMCMD>                   
#已经新增一个。

---修改参数文件,使其新增控制文件:
SQL> col HOST_NAME for a20
SQL> select INST_ID,HOST_NAME,STATUS from gv$instance;
   INST_ID HOST_NAME            STATUS
---------- -------------------- ------------
         1 node1                STARTED

SQL> 
--修改参数文件的控制文件参数
SQL> 
SQL> alter system set control_files=
  2  '+DATA/prod/controlfile/Current.264.927167493',
  3  '+DATA/RACDB/controlfile/current.269.927211623',
  4  '+OCR_VOTE/prod/controlfile/current.256.927167497'
  5  scope=spfile;
System altered.
SQL> 

--退出:
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@node1 ~]$ 
[oracle@node1 ~]$ 

---启动数据库:
[oracle@node1 ~]$ srvctl start database -d prod
PRCC-1014 : prod was already running
[oracle@node1 ~]$ 

---查看新的控制文件:
--节点1:
SQL> show parameter control_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/prod/controlfile/current
                                                 .264.927167493, +DATA/racdb/co
                                                 ntrolfile/current.269.92721162
                                                 3, +OCR_VOTE/prod/controlfile/
                                                 current.256.927167497
SQL> 

--节点2:
[oracle@node2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 6 15:10:26 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> 

SQL> show parameter control_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/prod/controlfile/current
                                                 .264.927167493, +DATA/racdb/co
                                                 ntrolfile/current.269.92721162
                                                 3, +OCR_VOTE/prod/controlfile/
                                                 current.256.927167497
SQL> 
#控制文件添加完成。

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

转载于:http://blog.itpub.net/31392094/viewspace-2127889/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值