叢集資料庫新增控制檔案

skyin_1603發表於2016-11-06
以下是簡要介紹給叢集資料庫新增控制檔案的過程。
----新增控制檔案:
---檢視當前的控制檔案:
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章