Managing Oracle clusterware (OCR)
Oracle Clusterware places the configuration information of the entire cluster on shared storage. The information includes the list of cluster nodes, the ing between cluster database instances and nodes, and the CRS Application resource information. The storage location is on the OCR Disk. in the entire cluster, only one Node can perform read and write operations on the OCR Disk. This Node is called the Master Node and all nodes will keep an OCR copy in the memory, at the same time, an OCR Process reads content from this memory. When the OCR content changes, the OCR Process of the Master Node is responsible for synchronizing the OCR Process to other nodes.
If you already mirror the OCR, then you do not need to add an OCR location; Oracle automatically manages two OCRs when it mirrors the OCR. Oracle RAC environments do not support moreTwo OCRs, a primary OCR and a second OCR.
[SQL]
- -- Ocrconfig syntax
- [Root @ rac1 ~] # Ocrconfig-help
- Name:
- Ocrconfig-Configuration toolForOracle Cluster Registry.
-
- Synopsis:
- Ocrconfig [Option]
- Option:
- -Export <filename> [-s online]
- -Export cluster register contentsToA file
- -Import <filename>-Import cluster registry contentsFromA file
- -Upgrade [<User> [<Group>]
- -Upgrade cluster registryFromPrevious version
- -Downgrade [-version <version string>]
- -Downgrade cluster registryToThe specified version
- -Backuploc <dirname>-Configure periodic backup location
- -Showbackup-Show backup information
- -Restore <filename>-RestoreFromPhysical backup
- -ReplaceOcr | ocrmirror [<filename>]-Add/Replace/Remove a OCR device/file
- -Overwrite-Overwrite OCR configurationOnDisk
- -Repair ocr | ocrmirror <filename>-RepairLocalOCR configuration
- -Help-PrintOutThis help information
-
- Note:
- A log file will be createdIn
- $ ORACLE_HOME/log/
- You have file creationPrivileges InThe above directory before
- Running this tool.
Automatic OCR backup
-Every 4 hours: CRS retains the last 3 copies.
-At the end of each day: CRS retains the last two copies.
-At the end of each week: CRS retains the last two copies.
Automatic Backup is completed by the Master Node CRSD process. The default backup location is under the $ CRS_HOME/crs/cdata/<cluster_name> directory, you can use the ocrconfig-backuploc <directory_name> command to modify the directory.
Example:
[SQL]
- -- Display backup information
- [Root @ rac1 ~] # Ocrconfig-showbackup
-
- Rac1 20:45:32/u01/crs1020/cdata/crs
-
- Rac1 16:45:47/u01/crs1020/cdata/crs
-
- Rac1 22:18:40/u01/crs1020/cdata/crs
-
- Rac1 16:45:47/u01/crs1020/cdata/crs
-
- Rac1 16:45:47/u01/crs1020/cdata/crs
- [Root @ rac1 ~] # Ll/u01/crs1020/cdata/crs/
- Total 28296
- -Rw-r-- R -- 1 root 4816896 Feb 20 20:45 backup00.ocr
- -Rw-r-- R -- 1 root 4816896 Feb 19 16:45 backup01.ocr
- -Rw-r-- R -- 1 root 4816896 Feb 18 22:18 backup02.ocr
- -Rw-r-- R -- 1 root 4816896 Feb 20 20:45 day _. ocr
- -Rw-r-- R -- 1 root 4816896 Feb 19 16:45 day. ocr
- -Rw-r-- R -- 1 root 4816896 Feb 19 16:45 week. ocr
-
- -- Change the backup location
- [Root @ rac1 ~] # Ocrconfig-backuploc/oracle/backup/ocr
Use physical backup to restore OCR
1. Find the physical backup:
$ Ocrconfig-showbackup
2. Check its content:
# Ocrdump file_name-backupfile
3. Stop Oracle Clusterware on all nodes:
# Crsctl stop crs
4. Restore OCR physical backup:
# Ocrconfig-restore <crs home>/cdata/jfv_clus/day. ocr
5. Restart Oracle Clusterware on all nodes:
# Crsctl start crs
6. Check OCR integrity:
$ Cluvfy comp ocr-n all
Example:
[SQL]
- -- Find physical backup:
- [Root @ rac1 ~] # Ocrconfig-showbackup
-
- -- Check its content. dump fails:
- [Root @ rac1 crs] # ocrdump-backupfileDay. Ocr
- PROT-302: FailedToInitialize ocrdump
-
- -- Stop Oracle Clusterware on all nodes:
- [Root @ rac2 ~] # Crsctl stop crs
- [Root @ rac1 ~] # Crsctl stop crs
-
- -- Restore OCR physical backup:
- [Root @ rac1 ~] # Ocrconfig-restore/u01/crs1020/cdata/crs/backup00.ocr
- -- Restart Oracle Clusterware on all nodes:
- [Root @ rac2 ~] # Crsctl start crs
- [Root @ rac1 ~] # Crsctl start crs
-
- -- Check OCR integrity:
- RACDB1 @ rac1/home/oracle $ cluvfy comp ocr-nAll
Manual backup OCR
The optical character recognition (OCR) should be automatically backed up to other storage devices every day:
-Use the preferred backup tool.
Logical backup of OCR should be performed before and after major changes:
# Ocrconfig-export file name
Make sure that the OCR backup that matches the current system configuration is restored.