Oracle RAC 遷移替換 OCR 盤

wpgy發表於2019-10-06

案例背景:因安裝叢集時候使用的 OCR 磁碟組儲存有問題,需要遷移到新的磁碟組。

涉及 檔案有:
1)OCR 檔案
2)VOTING 檔案
3)ASM 例項的 spfile 檔案


舊 OCR 磁碟組名稱:+OCR
新 OCR 磁碟組名稱:+GRID

1、遷移 OCR 檔案
grid@pgylinux01-or@+ASM1> ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3604
         Available space (kbytes) :     258516
         ID                       : 1076986448
         Device/File Name         :       +ocr
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user
此時 OCR 檔案在 OCR 磁碟組中

遷移 OCR 檔案有兩種方式:
方法一:新增一個新位置,刪除舊位置
[root@pgylinux01-or bin]# /oracle/grid/11.2.0.4/bin/ocrconfig -add +grid

# 檢視OCR 盤路徑
grid@pgylinux01-or@+ASM1>ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3600
         Available space (kbytes) :     258520
         ID                       : 1076986448
         Device/File Name         :       +ocr
                                    Device/File integrity check succeeded
         Device/File Name         :      +grid
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

也可以透過檢視/etc/oracle/ocr.loc 檔案來確認 OCR 檔案路徑
oracle@pgylinux01-or@+ASM1> cat /etc/oracle/ocr.loc
#Device/file  getting replaced by device +grid
ocrconfig_loc=+ocr
ocrmirrorconfig_loc=+grid

這時候 OCR 檔案在 +OCR 和 +GRID 磁碟組各存了一份,可以刪除 +OCR 盤裡面的那一份
[root@pgylinux01-or bin]# /oracle/grid/11.2.0.4/bin/ocrconfig -delete +ocr

方法二:使用 replace 方式直接替換
[root@pgylinux01-or bin]# /oracle/grid/11.2.0.4/bin/ocrconfig -replace +ocr -replacement +grid
PROT-28: Cannot delete or replace the only configured Oracle Cluster Registry location

提示說 當前只有一份 OCR 檔案,不能做刪除和替換操作,需要先新增一份OCR檔案,再做替換,新增到哪個盤都可以,這裡直接使用 +GRID 盤。
[root@pgylinux01-or bin]# /oracle/grid/11.2.0.4/bin/ocrconfig -add +grid

[root@pgylinux01-or bin]# /oracle/grid/11.2.0.4/bin/ocrconfig -replace +ocr -replacement +grid
PROT-29: The Oracle Cluster Registry location is already configured

替換完成,OCR 檔案已經轉移到 +GRID 磁碟組中。

2、遷移 VOTING 檔案
# 檢視當前 VOTING 檔案路徑
grid@pgylinux01-or@+ASM1> crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   0de070fb41ae4f30bfd17c9dc7668f01 (ORCL:DATA_01) [OCR]
Located 1 voting disk(s).

# 替換 VOTING 檔案到 +GRID 磁碟組
grid@pgylinux01-or@+ASM1> crsctl replace votedisk +grid
Successful addition of voting disk 53e1a6d5ebf84f41bf22d54601a9028f.
Successful deletion of voting disk 0de070fb41ae4f30bfd17c9dc7668f01.
Successfully replaced voting disk group with +grid.
CRS-4266: Voting file(s) successfully replaced

grid@pgylinux01-or@+ASM1>crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   53e1a6d5ebf84f41bf22d54601a9028f (ORCL:DATA_03) [GRID]
Located 1 voting disk(s).

替換完成,VOTING 檔案已經轉移到 +GRID 磁碟組中。

3、重建 ASM 例項的 spfile 檔案
SQL> CREATE PFILE='/home/grid/asm_pfile.ora' from spfile;

File created.

SQL> CREATE SPFILE='+GRID' FROM PFILE='/home/grid/asm_pfile.ora';

File created.

所有檔案遷移完成,重啟叢集完成遷移。舊的 OCR 磁碟組不再需要,可以刪除。

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

相關文章