Adminstering OCR in RAC

On February 5, 2007, in ORACLE 10GR2 RAC, by admin

Adding, Replacing, Repairing, and Removing the OCR

Oracle strongly recommends that you use mirrored OCRs if the underlying storage is not RAID. This prevents the OCR from
becoming a single point of failure.

The operations in this section affect the OCR cluster-wide: they change the OCR configuration information in the ocr.loc file

You must be root user to run ocrconfig commands.

Run the following command to add an OCR location using either destination_file or disk to designate the target location of the additional OCR:

ocrconfig -replace ocr destination_file or disk

Run the following command to add an OCR mirror location using either destination_file or disk to designate the target location of the additional OCR:

ocrconfig -replace ocrmirror destination_file or disk

Replacing an Oracle Cluster Registry

You can replace a mirrored OCR using the following procedure as long as one OCR-designated file remains online:

1. Verify that the OCR that you are not going to replace is online.
2. Verify that Oracle Clusterware is running on the node on which the you are going to perform the replace operation.

The OCR that you are replacing can be either online or offline. In addition, if your OCR resides on a cluster file system file or if the OCR is on an network file system, then create the target OCR file before continuing with this procedure.

Run the following command to replace the OCR using either destination_file or disk to indicate the target OCR:

ocrconfig -replace ocr destination_file or disk

Run the following command to replace an OCR mirror location using either destination_file or disk to indicate the target OCR:

ocrconfig -replace ocrmirror destination_file or disk

If any node that is part of your current RAC environment is shut down, then run the command ocrconfig -repair on any node that is stopped to enable that node to rejoin the cluster after you restart the stopped node.

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 not up 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

This operation only changes the OCR configuration on the node from which you run this command. For example, if the OCR mirror device name is /dev/raw1, then use the command syntax ocrconfig -repair ocrmirror /dev/raw1 on this node to repair its OCR configuration.

Removing an Oracle Cluster Registry

To remove an OCR location, at least one other 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 redundant storage such as RAID. Perform the
following procedure to remove an OCR location from your RAC environment:

Ensure that at least one OCR other than the OCR that you are removing is online.

Run the following command on any node in the cluster to remove the OCR:

ocrconfig -replace ocr

Run the following command on any node in the cluster to remove the mirrored OCR:

ocrconfig -replace ocrmirror

These commands update the OCR configuration on all of the nodes on which Oracle Clusterware is running.

Managing Backups and Recovering the OCR Using OCR Backup Files

This section describes two methods for copying OCR content and using it for recovery. The first method uses automatically generated OCR file copies and the second method uses manually created OCR export files.

The Oracle Clusterware automatically creates OCR backups every four hours. At any one time, Oracle always retains the last three backup copies of the OCR. The CRSD process that creates the backups also creates and retains an OCR backup for each full day and at the end of each week.

You cannot customize the backup frequencies or the number of files that Oracle retains. You can use any backup software to copy the automatically generated backup files at least once daily to a different device from where the primary OCR resides. The default location for generating backups on UNIX-based systems is CRS_home/cdata/cluster_name where cluster_name is the name of your cluster.

Restoring the Oracle Cluster Registry from Automatically Generated OCR Backups

If an application fails, then before attempting to restore the OCR, restart the application. As a definitive verification that the OCR failed, run an ocrcheck and if the command returns a failure message, then both the primary OCR and the OCR
mirror have failed. Attempt to correct the problem using one of the following platform-specific OCR restoration procedures.

Restoring the Oracle Cluster Registry on UNIX-Based Systems Use the following procedure to restore the OCR on UNIX-based systems:

1. Identify the OCR backups using the ocrconfig -showbackup command. Review the contents of the backup using ocrdump -backupfile file_name where file_name is the name of the backup file.

2. Stop Oracle Clusterware on all of the nodes in your RAC database by executing the init.crs stop command on all of the nodes.

3. Perform the restore by applying an OCR backup file that you identified in Step 1 using the following command where file_name is the name of the OCR that you want to restore. Make sure that the OCR devices that you specify in the OCR
configuration exist and that these OCR devices are valid before running this command.

ocrconfig -restore file_name

4. Restart Oracle Clusterware on all of the nodes in your cluster by restarting each node or by running the init.crs start command.

5. Run the following command to verify the OCR integrity where the -n all argument retrieves a listing of all of the cluster nodes that are configured as part of your cluster:

cluvfy comp ocr -n all [-verbose]

 

Leave a Reply