Ocr Backup Restore

Reference: Oracle® Real Application Clusters Administrator's Guide 10g Release 1 (10.1)

Administering Oracle Cluster Registry Backup Files in Real Application Clusters

One CRS instance in a cluster automatically creates OCR backups every four hours. At any one time, the last three backup copies are always retained. The CRS instance 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. However, because of the importance of the OCR information, Oracle recommends that you use the ocrconfig tool to make copies of the automatically generated backup files at least once daily. The ocrconfig tool commands are described later in this section.

Note:
You must be root user to run ocrconfig commands.

Use the ocrconfig tool as root user with the showbackup option to identify the backup files. Then copy each file to a location that is redundant to the location of the original OCR backup file. This ensures that there are at least two copies of each OCR backup file. Oracle also recommends that the OCR location reside on RAID arrays. If possible, use a backup location that is shared by all nodes in the cluster. The default target location of each OCR backup file is as follows where cluster name is the name that you assigned to the cluster when you installed CRS:

CRS Home/cdata/cluster name

You can change this location using the following syntax:

ocrconfig -backuploc directory name

Restoring the Oracle Cluster Registry from Automatically Generated OCR Backups

If an application fails, then before attempting to resolve configuration-related problems retry the application. If the problem continues, then use one of the following platform-specific procedures to restore the OCR configuration.

* Restoring the Oracle Cluster Registry on UNIX-Based Systems
* Restoring the Oracle Cluster Registry on Windows-Based Systems

Note:
You cannot restore your configuration from an automatically created OCR backup file using the -import option. You must instead use the -restore option.
* Moving the Oracle Cluster Registry on UNIX-Based Systems
* Moving the Oracle Cluster Registry on Windows-Based Systems

Restoring the Oracle Cluster Registry on UNIX-Based Systems

1. Stop the CRS software on all of the nodes in your cluster database by executing the init.crs stop command on all of the nodes.
2. Identify the recent backups using the

ocrconfig -showbackup

command.
3. Execute the restore by applying an OCR backup file identified in Step 2 with the

ocrconfig -restore

file name command.
4. Restart the CRS software on all of the nodes in your cluster by restarting each node.

Restoring the Oracle Cluster Registry on Windows-Based Systems

1. Shut down all but one node in your cluster.
2. On the remaining node, disable the following OCR clients and stop them using the Service Control Panel: OracleClusterVolumeService, OracleCSService, OracleCRService, and the OracleEVMService.
3. Identify the recent backups using the ocrconfig -showbackup command.
4. Execute the restore by applying an OCR backup file identified in Step 3 with the ocrconfig -restore file name command.
5. Start all of the services that were stopped in step 2. Restart all of the nodes and resume operations in cluster mode.

Moving the Oracle Cluster Registry on UNIX-Based Systems

1. Stop the CRS software on all of the nodes in your cluster database by executing the init.crs stop command on all of the nodes.
2. Edit the /var/opt/oracle/ocr.loc file on all of the nodes and set the ocrconfig_loc parameter to ocr_config_loc=new_location where new_location is the new location of the OCR.
3. Restore the OCR from one of the automatic physical backups using the command ocrconfig -restore.
4. Run the ocrcheck command to verify the new OCR location.
5. Restart the CRS software on all of the nodes in your cluster by restarting each node.

Moving the Oracle Cluster Registry on Windows-Based Systems

1. Disable and stop the CRS software on all of the nodes by disabling and stopping the CRS services using the Services Control Panel.
2. Identify the recent OCR backup using the

ocrconfig -showbackup

command.
3. Edit the HKEY_LOCAL_MACHINE\Software\Oracle\OCR\ocrconfig_loc Registry key on every node to show the new OCR location.
4. Restore the OCR by applying the OCR backup file that you identified in Step 2 using the ocrconfig -restore file name command.
5. Start all of the services on all of the nodes that were stopped in step 1.Administering the Oracle Cluster Registry with OCR Exports

In addition to using the automatically created OCR backup files, you should also export the OCR contents before and after making significant configuration changes. Do this by using the ocrconfig -export command. This enables you to restore the OCR if your configuration changes cause errors. For example, if you have unresolvable configuration problems, or if you are unable to restart your clusterware, restore your configuration using one of the following platform-specific procedures:

* Importing Oracle Cluster Registry Content on UNIX-Based Systems
* Importing Oracle Cluster Registry Content on Windows-Based Systems

Note:
You cannot import an exported OCR backup file using the -restore option. You must instead use the -import option.

Importing Oracle Cluster Registry Content on UNIX-Based Systems

1. Shut down all the nodes in the cluster and restart one of them in single-user mode.
2. Import an OCR export file using the ocrconfig -import command from any node.
3. Start all the nodes in the cluster in multiuser mode.

Importing Oracle Cluster Registry Content on Windows-Based Systems

1. Stop the following OCR clients using the Service Control Panel: OracleClusterVolumeService, OracleCMService, OracleEVMService, OracleCSService, and the OracleCRService.
2. Import an OCR export file using the ocrconfig -import command from one node.
3. Re-start all of the affected services on all nodes.

The ocrconfig Tool Command Syntax and Options

Execute OCR commands with administrative privileges on UNIX-based platforms or as a user with Administrator privileges on Windows-based systems. The OCR command syntax is as follows where options is one of the verbs shown in the Option column of Table 3-1:

ocrconfig -option

Table 3-1 The ocrconfig Command Options
Option Purpose
-export To export the contents of the OCR into a target file.
-import To import OCR contents from a previously exported OCR file.
-restore To restore the OCR from an automatically created OCR backup file.
-backuploc To change OCR backup file location. For this entry, use a full path that is accessible by all nodes.
-showbackup To display the location, timestamp, and the node name of origin for the last three automatically created backup files.
-upgrade To upgrade the OCR to a later version.
-downgrade To downgrade the OCR to an earlier version.
-help To display help for the ocrconfig commands.

For example, to export the OCR contents to a binary file, use the ocrconfig command with the following syntax where file_name is the file to which you want to export the OCR contents as follows:

ocrconfig -export file_name

Do not attempt to edit the export file. If OCR clients such as the clusterware are running, then Oracle reports an error.
Implementing the Oracle Hardware Assisted Resilient Data Initiative for the OCR

The Oracle Hardware Assisted Resilient Data (HARD) initiative prevents data corruptions before they occur. With HARD enabled, the OCR writes HARD-compatible blocks. To determine whether the device used by the OCR supports HARD and enable it, review the Oracle HARD white paper at:

http://otn.oracle.com/deploy/availability/htdocs/HARD.html

Upgrading and Downgrading the OCR Configuration in Real Application Clusters

When you install CRS, Oracle automatically executes the

ocrconfig -upgrade

command. To downgrade, follow the downgrade instructions for each component and also downgrade the OCR using the

ocrconfig -downgrade command.

HARD-Compatible OCR Blocks in Oracle9i

In Oracle9i, the OCR did not write HARD-compatible blocks. If the device used by OCR is enabled for HARD, then use the method described in the HARD white paper to disable HARD for the OCR device before downgrading your OCR. If you do not disable HARD, then the downgrade operation fails.
Importing and Exporting Cluster Database Configuration Information with SRVCONFIG

Use SRVCONFIG to import and export SRVM cluster database configuration information to and from the OCR. For example, the following syntax exports the configuration information to a text file:

srvconfig -exp file_name.txt

The following syntax imports the configuration information from a text file into the OCR:

srvconfig -imp file_name.txt