使用導出導入進行OCR的備份和恢復:
在對集群做調整前,如:增刪節點等操作前,應該對OCR進行一次備份,可以使用export備份到指定文件。
實驗環境:
OS:OEL5.6
RAC:10.2.0.1.0
(1)關閉所有節點的CRS
節點1:
[root@rac1 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
節點2:
[root@rac2 ~]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
(2)導出OCR的內容。
[root@rac1 crsd]# cd
[root@rac1 ~]# ocrconfig -export ocrexp.exp
(3)啟動CRS
節點一:
[root@rac1 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
節點二:
[root@rac2 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@rac2 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
(4)破壞OCR中的內容
[root@rac2 ~]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400
102400+0 records in
102400+0 records out
104857600 bytes (105 MB) copied, 41.7897 seconds, 2.5 MB/s
(5)檢查集群狀態,OCR一致性:
[root@rac2 ~]# crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
[root@rac2 ~]# ocrcheck
PROT-601: Failed to initialize ocrcheck
集群已經掛掉,一致性無法檢查。
(6)使用Clusterware安裝包中的clufy工具檢查一致性
[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Unable to retrieve nodelist from Oracle clusterware.
Verification cannot proceed.
檢查失敗。
(7)使用import恢復ocr內容。
[root@rac1 ~]# ocrconfig -import ocrexp.exp
(8)再次檢查OCR
[root@rac1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 104344
Used space (kbytes) : 3820
Available space (kbytes) : 100524
ID : 1731255225
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
(9)cluvfy工具檢查
[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all
Verifying OCR integrity
Checking OCR integrity...
Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.
Uniqueness check for OCR device passed.
Checking the version of OCR...
OCR of correct Version "2" exists.
Checking data integrity of OCR...
Data integrity check for OCR passed.
OCR integrity check passed.
Verification of OCR integrity was successful.
檢查也沒問題。
(10)關閉CRS
OCR被破壞後CRS已經異常停止,但有些進程依然存活,如果不先關閉下CRS,直接啟動CRS會無法啟動。
節點一:
[root@rac1 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
節點二:
[root@rac2 crsd]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
(10)啟動CRS
節點一:
[root@rac1 cluvfy]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
節點二:
[root@rac2 ~]# crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@rac2 crsd]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac2 crsd]# crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy