View the OCR storage location
[[email protected] ~]$ ocrcheckStatus of Oracle Cluster Registry is as follows : Version : 2 Total space (kbytes) : 262120 Used space (kbytes) : 5432 Available space (kbytes) : 256688 ID : 982267297 Device/File Name : /oradata/crs_data/ocr.dat Device/File integrity check succeeded Device/File not configured Cluster registry integrity check succeeded
OCR is automatically backed up every 4 hours. My automatic backup location is/Oracle/APP/Oracle/product/10.2.0/CRS/CDATA/CRS. You can run the command ocrconfig to view the backup.
[[email protected] ~]$ ocrconfig -showbackuprac2 2014/08/25 14:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/25 10:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/22 17:46:32 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/25 10:31:15 /oracle/app/oracle/product/10.2.0/crs/cdata/crsrac2 2014/08/22 17:46:32 /oracle/app/oracle/product/10.2.0/crs/cdata/crs
There are currently five groups of automatic backup, Oracle will retain up to five groups, backup00.ocr is the last backup, day _. OCR is a backup within one day, week _. OCR is a backup within one week. It is best to use the latest group
Simulate OCR corruption, delete OCR, and use backup to restore
[[email protected] ~]$ cd /oradata/crs_data[[email protected] crs_data]$ lsocr.dat vote.dat[[email protected] crs_data]$ rm -f ocr*
Check the service again and find that the CRS service is still normal. This is because the CRS cache is currently used.
[[email protected] crs_data]$ crs_stat -tName Type Target State Host ------------------------------------------------------------ora....b1.inst application ONLINE ONLINE rac1 ora....b2.inst application ONLINE ONLINE rac2 ora.asmdb.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 ora.rawdb.db application ONLINE ONLINE rac1 ora....b1.inst application ONLINE ONLINE rac1 ora....b2.inst application ONLINE ONLINE rac2 ora.test.db application ONLINE ONLINE rac1 ora....t1.inst application ONLINE ONLINE rac1 ora....t2.inst application ONLINE ONLINE rac2
Restart the CRS service. If OCR is lost, the service cannot be disabled by running the command.
[[email protected] oracle]# crsctl stop crsOCR initialization failed accessing OCR device: PROC-26: Error while accessing the physical storage Operating System error [No such file or directory]
Restart the server
[[email protected] ~]# rebootBroadcast message from root (pts/0) (Tue Aug 26 15:13:44 2014):The system is going down for reboot NOW![[email protected] ~]# rebootBroadcast message from root (pts/0) (Tue Aug 26 15:14:20 2014):The system is going down for reboot NOW!
Start CRS, although the prompt will start, but never get up, at this time we need to suspect that OCR is damaged
[[email protected] oracle]# crsctl start crsAttempting to start CRS stack The CRS stack will be started shortly
Run the ocrcheck command to check OCR. The OCR cannot be found.
[[email protected] oracle]# ocrcheckPROT-602: Failed to retrieve data from the cluster registry
Use the find command to find the OCR of the current backup. If the OCR automatic backup path is not changed, the default path is under $ crs_home/CDATA/CRS/on the master node.
[[email protected] ~]$ find /oracle -name *.ocr*/oracle/app/oracle/product/10.2.0/crs/cdata/crs/backup00.ocr/oracle/app/oracle/product/10.2.0/crs/cdata/crs/day_.ocr
Use the backup OCR for recovery. OCR can be restored online.
For RAC of ocfs, you must first create an OCR file with the same name as the previous one, and then restore the file.
If the OCR file is not created, try to restore it:
[[email protected] crs]# ocrconfig -restore backup00.ocrPROT-16: Internal Error
The OCR file name is different from the previous one:
[[email protected] crs]# ocrconfig -restore backup00.ocrPROT-16: Internal Error
Create an OCR file with the same name as before and restore it:
[[email protected] crs]# ocrconfig -restore backup00.ocr
Start CRS and view Resource Status
[[email protected] crs]# crs_stat -tName Type Target State Host ------------------------------------------------------------ora....b1.inst application ONLINE ONLINE rac1 ora....b2.inst application ONLINE ONLINE rac2 ora.asmdb.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 ora.rawdb.db application ONLINE ONLINE rac2 ora....b1.inst application ONLINE ONLINE rac1 ora....b2.inst application ONLINE ONLINE rac2 ora.test.db application ONLINE ONLINE rac2 ora....t1.inst application ONLINE ONLINE rac1 ora....t2.inst application ONLINE ONLINE rac2
Import and export of OCR
Manual export OCR, OCR can be used Online Export
[[email protected] crs_data]# ocrconfig -export /oradata/crs_data/ocr.dat.bak -s online
Export OCR backup files must be imported for recovery. Similarly, ocfs RAC needs to create files first.
$ ocrconfig -import /oradata/crs_data/ocr.dat.bak
OCR backup and recovery