Demonstrate OCR backup and recovery techniques

In Oracle® Clusterware Administration and Deployment Guide 11g Release 2 (11.2), the section, Backing Up Oracle Cluster Registry, says that:

This section describes how to back up OCR content and use it for recovery. The first method uses automatically generated OCR copies and the second method enables you to issue a backup command manually:

    • Automatic backups: Oracle Clusterware automatically creates OCR backups every four hours. At any one time, Oracle Database always retains the last three backup copies of 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 Database retains.

    • Manual backups: Run the ocrconfig -manualbackup command on a node where the Oracle Clusterware stack is up and running to force Oracle Clusterware to perform a backup of OCR at any time, rather than wait for the automatic backup. You must run the command as a user with administrative privileges. The -manualbackup option is especially useful when you want to obtain a binary backup on demand, such as before you make changes to the OCR. The OLR only supports manual backups.

When the clusterware stack is down on all nodes in the cluster, the backups that are listed by the command ocrconfig -showbackup may differ from node to node. After you install or upgrade Oracle Clusterware on a node, or add a node to the cluster, when the root.sh script finishes, it backs up the OLR.

In Oracle® Clusterware Administration and Deployment Guide 11g Release 2 (11.2), the section, Restoring Oracle Cluster Registry, says that:

If a resource fails, then before attempting to restore OCR, restart the resource. As a definitive verification that OCR failed, run 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 the OCR restoration procedure for your platform.

Notes:

Restoring the Oracle Cluster Registry on Linux or UNIX Systems

If you are storing the OCR on an Oracle ASM disk group, and that disk group is corrupt, then you must restore the Oracle ASM disk group using Oracle ASM utilities, and then mount the disk group again before recovering the OCR. Recover the OCR by running the command ocrconfig -restore.

Use the following procedure to restore OCR on Linux or UNIX systems:

    1. List the nodes in your cluster by running the following command on one node:

$ olsnodes

    1. Stop Oracle Clusterware by running the following command as root on all of the nodes:

# crsctl stop crs

    1. If the preceding command returns any error due to OCR corruption, stop Oracle Clusterware by running the following command as root on all of the nodes:

# crsctl stop crs -f

    1. If you are restoring OCR to a cluster file system or network file system, then run the following command as root to restore OCR with an OCR backup that you can identify in "Listing Backup Files":

# ocrconfig -restore file_name

    1. After you complete this step, skip to step 8.

    2. Start the Oracle Clusterware stack on one node in exclusive mode by running the following command as root:

# crsctl start crs -excl

    1. Ignore any errors that display.

    2. Check whether crsd is running. If it is, stop it by running the following command as root:

# crsctl stop resource ora.crsd -init

    1. Caution:

    2. Do not use the -init flag with any other command.

    3. Restore OCR with an OCR backup that you can identify in "Listing Backup Files" by running the following command as root:

# ocrconfig -restore file_name

    1. Notes:

        • If the original OCR location does not exist, then you must create an empty (0 byte) OCR location before you run the ocrconfig -restore command.

        • Ensure that the OCR devices that you specify in the OCR configuration exist and that these OCR devices are valid.

        • If you configured OCR in an Oracle ASM disk group, then ensure that the Oracle ASM disk group exists and is mounted.

    2. Verify the integrity of OCR:

# ocrcheck

    1. Stop Oracle Clusterware on the node where it is running in exclusive mode:

# crsctl stop crs -f

    1. Begin to start Oracle Clusterware by running the following command as root on all of the nodes:

# crsctl start crs

    1. Verify the OCR integrity of all of the cluster nodes that are configured as part of your cluster by running the following CVU command:

$ cluvfy comp ocr -n all -verbose