oracle之 RAC 11G ASM下控制檔案多路複用

張衝andy發表於2017-09-29

如果資料庫僅有一組control file檔案,需要新增一組或者多組,保證一組檔案損壞或者丟失導致資料庫當機。


-- 環境說明
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

SQL> show parameter cluster;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string

0、記錄現有控制檔案路徑

SQL>select name from v$controlfile;SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/devdb/controlfile/current.260.936769367
+FLASH/devdb/controlfile/current.256.936769367

1、關閉兩個節點

$ srvctl stop database -d devdb

2、在其中一個節點上啟動rman

[oracle@node1 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Tue Dec 27 16:59:10 2016

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

connected to target database (not started)

3、將資料庫啟動到nomount狀態下

RMAN> startup nomount;

Oracle instance started

Total System Global Area 4275781632 bytes

Fixed Size 2260088 bytes
Variable Size 989856648 bytes
Database Buffers 3271557120 bytes
Redo Buffers 12107776 bytes

4、採用restore複製一份controlfile到新路徑

RMAN> restore controlfile to '+FLASH/devdb/controlfile/current.256.936769368' from '+DATA/devdb/controlfile/current.260.936769367';

Starting restore at 27-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=50 instance=orcl1 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 27-DEC-16

說明:’+FLASH/devdb/controlfile/current.256.936769368’是複製的新的控制檔案,
如果asm自動管理的,可能名字不會按照你的命名,需要確定下新的檔名字。

ASMCMD> pwd
+FLASH/devdb/controlfile/
ASMCMD> ls
current.303.956019293 > 跟你指定的不一樣

5. sqlplus 中 修改控制檔案路徑, 修改完成後,關閉資料庫
SQL> alter system set control_files='+DATA/devdb/controlfile/current.260.936769367','+FLASH/devdb/controlfile/current.256.936769367','+FLASH/devdb/controlfile/current.303.956019293' scope=spfile sid='*';

SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.

6、啟動資料庫

[grid@node1 oracle]$ srvctl start database -d devdb

7、驗證

SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/devdb/controlfile/current.260.936769367
+FLASH/devdb/controlfile/current.256.936769367
+FLASH/devdb/controlfile/current.303.956019293

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2145617/,如需轉載,請註明出處,否則將追究法律責任。

相關文章