Managing OCR and Voting Disk
OCR:
Oracle Cluster registry (OCR) store the cluster configuration information and database configuration information like cluster node list, cluster database instance to node mapping and CRS application resource profile.
OCR location is specified during CRS installation. OCR.loc file indicate the OCR device location.
OCR.loc file located in /etc/oracle on linux system and /var/opt/oracle on Solaris system.
We create OCR in shared disk storage that must be accessible to all cluster nodes.
The daemon OCSSd manages the configuration info in OCR and maintains the changes to cluster in the registry.
How to check health of OCR? We just use “ocrcheck” utility.
How to take Backup of OCR? There are two methods of backup. The first method uses automatically and the second method uses manually created logical OCR export files.
Automatically:
· Oracle automatically takes a backup of OCR to default location on every four hours.
· Oracle always retains the last three backup copies of the OCR.
· Default location is $CRS_HOME/cdata/cluster_name where cluster_name is the name of your cluster.
· We can change backup default location of OCR by using ocrconfig command. (Example: $ ocrconfig – backuploc
· The CRSD process that also creates and retains an OCR backup for each full day and at the end of each week.
· We cannot customize the backup frequencies or the number of files that Oracle retains.
Manually:
We can take export backup of OCR after making changes by using oraconfig command. (Example: ocrconfig –export
How to Recovering the OCR?
In event of a failure, before you attempt to restore the OCR, ensure that the OCR is unavailable.
Run the following command to check the status of the OCR: ocrcheck
If this command does not display the message ‘Device/File integrity check succeeded’ for at least one copy of the OCR, then both the primary OCR and the OCR mirror have failed. You must restore the OCR from a backup.
Restoring the OCR from Automatically Generated OCR Backups:
Step 1 Identify the available OCR backups using the ocrconfig command:
# ocrconfig -showbackup
Step 2 Review the contents of the backup using the following ocrdump command, where file_name is the name of the OCR backup file:
$ ocrdump -backupfile file_name
Step 3 As the root user, stop Oracle Clusterware on all the nodes in your Oracle RAC cluster by executing the following command:
# crsctl stop crs
Step 4 Repeat this command on each node in your Oracle RAC cluster.
Step 5 As the root user, restore the OCR by applying an OCR backup file.
# ocrconfig -restore file_name
Step 6 As the root user, restart Oracle Clusterware on all the nodes in your cluster by restarting each node, or by running the following command:
# crsctl start crs
Repeat this command on each node in your Oracle RAC cluster.
Step 7 Use the Cluster Verify Utility (CVU) to verify the OCR integrity. Run the following command, where the -n all argument retrieves a list of all the cluster nodes that are configured as part of your cluster:
$ cluvfy comp ocr -n all [-verbose]
Recovering the OCR from an OCR Export File:
We use the ocrconfig -import command to restore the OCR
Step 1 Log in as a Root User. Stop oracle Clusterware on all nodes.
Step 2 Restore the OCR data by importing the contents of the OCR export file using the following command, where:
ocrconfig -import
Step 3 Start oracle Clusterware on all nodes.
crsctl start crs
Step 4 Use the CVU to verify the OCR integrity.
cluvfy comp ocr -n all [-verbose]
How to Adding an OCR Location
You can add an OCR location after an upgrade or after completing the Oracle RAC installation. If you already mirror the OCR, then you do not need to add an OCR location; Oracle Clusterware automatically manages two OCRs when you configure normal redundancy for the OCR. Oracle RAC environments do not support more than two OCRs, a primary OCR and a secondary OCR.
Run the following command to add an OCR location:
ocrconfig -replace ocr
Run the following command to add an OCR mirror location:
ocrconfig -replace ocrmirror
How to Replacing an OCR
If you need to change the location of an existing OCR, or change the location of a failed OCR to the location of a working one, you can use the following procedure as long as one OCR file remains online.
Step 1 Use the OCRCHECK utility to verify that a copy of the OCR other than the one you are going to replace is online using the following command:
ocrcheck
Step 2 Verify that Oracle Clusterware is running on the node on which the you are going to perform the replace operation using the following command:
crsctl check crs
Step 3 Run the following command to replace the OCR:
ocrconfig -replace ocr
Run the following command to replace an OCR mirror location:
ocrconfig -replace ocrmirror destination_file
How to Repairing an Oracle Cluster Registry Configuration on a Local Node
You may need to repair an OCR configuration on a particular node if your OCR configuration changes while that node is stopped. For example, you may need to repair the OCR on a node that was shut down while you were adding, replacing, or removing an OCR. To repair an OCR configuration, run the following command on the node on which you have stopped the Oracle Clusterware daemon:
ocrconfig –repair ocrmirror device_name
How to Removing an Oracle Cluster Registry
To remove an OCR location, at least one OCR must be online. You can remove an OCR location to reduce OCR-related overhead or to stop mirroring your OCR because you moved your the OCR to a redundant storage system, such as a redundant array of independent disks (RAID).
To remove an OCR location from your Oracle RAC environment:
Step 1 Use the OCRCHECK utility to ensure that at least one OCR other than the OCR that you are removing is online.
ocrcheck
Step 2 Run the following command on any node in the cluster to remove one copy of the OCR:
ocrconfig -replace ocr
Step 3 This command updates the OCR configuration on all the nodes on which Oracle Clusterware is running.
Voting Disks
The voting disk records node membership information.
A node must be able to access more than half of the voting disks at any time.
Backing up Voting Disks
The node membership information does not usually change; you do not need to back up the voting disk every day. However, back up the voting disks at the following times:
After installation
After adding nodes to or deleting nodes from the cluster
After performing voting disk add or delete operations
How to take backup?
dd if=/dev/rdsk/c0d1s1 of=/tmp/voting.dmp
When you use the dd command for making backups of the voting disk, the backup can be performed while the Cluster Ready Services (CRS) process is active; you do not need to stop the crsd.bin process before taking a backup of the voting disk.
Recovering Voting Disks
If a voting disk is damaged, and no longer usable by Oracle Clusterware, you can recover the voting disk if you have a backup file. Run the following command to recover a voting disk where backup_file_name is the name of the voting disk backup file and voting_disk_name is the name of the active voting disk:
dd if=backup_file_name of=voting_disk_name
Adding and Removing Voting Disks
You can dynamically add and remove voting disks after installing Oracle RAC. Do this using the following commands where path is the fully qualified path for the additional voting disk. Run the following command as the root user to add a voting disk:
crsctl add css votedisk path
Run the following command as the root user to remove a voting disk:
crsctl delete css votedisk path
crsctl query css votedisk
Responses