3 Ways To Recover Oracle Cluster Registry

3 Ways To Recover Oracle Cluster Registry

Does your Oracle Cluster Registry got corrupted or goes missing? Looking for some easy ways to restore Oracle Cluster Registry?

Well, you are on the right destination as our today’s topic is specifically about how to recover Oracle Cluster Registry. Besides that, I will also share different ways to backup OCR.

About Oracle Cluster Registry And Its Corruption:

The OCR keeps the database configuration information for the RAC and Cluster Ready Services (CRS) like cluster node list, cluster database instances to node mapping, and CRS application resource profiles, etc.  So, OCR is the shared file that gets saved within the cluster file system.

A corrupt/damaged Oracle cluster registry (OCR) may affect your entire Oracle database, if you don’t have an updated backup file of your database then this situation becomes worst. This situation generally not happens very often. But once it occurs then irritate the user by displaying lots of error messages on the screen.

We know that CRSD process is dependable for making backup copies of the OCR form the master node in the master node in the CRS_home/cdata directory. Through these backups, one can recover the OCR form damaged OCR files by using ocrconfig-restore command line. Let us see an example, you add a node to the cluster and before CRSD takes a backup (before 4 hours) you see that the OCR gets corrupted. You may also forget to create a logical export of the OCR before adding the new node. In this example, you have a damaged OCR without the latest backup.

One safest way to reconstruct the OCR is to reinstall the Oracle Clusterware software. In order to do this task without any error, a whole outage is necessary for the complete cluster all through the period of the re-install. It is also necessary to remove the Oracle Clusterware software fully, the OCR and voting disks reformatted, all virtual IP addresses (VIPs) re-installed, and a total reinstall of the Oracle Clusterware software will need to be executed.

How To Back Up Oracle Cluster Registry?

Well, this section is mainly for those readers who don’t know how to backup the Oracle cluster registry. It’s important to know as it ultimately helps you to recover Oracle Cluster Registry is corrupt or missing situations.

To learn some easy ways to backup your OCR content and later on use it for recovery. In the first method, you will learn backing up the OCR using automatically generated OCR copies. Whereas, in the second method we will use the backup command for backing up the OCR data.

Automatic Backups:

Oracle Clusterware automatically generates the OCR backup after every 3 to 4 hours. At any point in time, the Oracle database keeps the last 3 copies of OCR.

The CRSD process which makes the backup also generates and keeps the OCR backup for a complete day or after every week.

You can’t make any customization in the number of files that the Oracle database contains or in the backup frequencies.

The task of making the automatic backup of OCR is mainly done by CRSD process and after every 3 hours.

 The default location used to save this is: CRS_home/cdata/cluster_name.

You can also change this OCR backup‘s default location. To know it’s default location use the following command.

$ocrconfig -showbackup

You can also change the default path of physical OCR copies. For this just use the following command.

$ocrconfig -backuploc

Manual Backups:

For maintaining up the manual backup, use the ocrconfig –manualbackup command. You have to use this command on the node where the Oracle Clusterware stack is present and forcing this Oracle Clusterware to make a backup of OCR anytime. Or else you can wait for your automatic backup.  Run your command like a user having administrative privileges.

Well, this -manual backup option is quite helpful if you want to obtain the binary backup.

Like just before making changes in the OCR. As the OLR only supports manual backups.

When this clusterware stack gets down in all nodes within the cluster then automatically the differences in the backup ocrconfig -showbackup command differ from one to another.

When the Clusterware stack is down on all nodes in the cluster, then the backups that are listed by the ocrconfig -showbackup command may differ from node to node.

Note:

After installing or upgrading the Oracle Clusterware on the node, or when you add the node in the cluster it finishes up the root.sh script after then it backup the OLR.

How To Recover Oracle Cluster Registry?

Method 1# Recover OCR From Physical Backup

To recover OCR from the physical automated backup all you need is a cluster, RAC database, and RAC instances drop-down before executing the OCR recovery.

Try the following command references for OCR recovery from the physical backup copy.

$ocrconfig -showbackup

$srvctl -stop database -d RACDB (Shutdown all RAC instances and RAC database)

$crsctl stop crs (Shutdown Cluster)

#rm -f /u01/oradata/racdb/OCRFile

#cp /dev/null /u01/oradata/racdb/OCRFile

#chown root /u01/oradata/racdb/OCRFile

#chgrp oinstall /u02/oradata/racdb/OCRFile

#chmod 640 /u01/oradata/racdb/OCRFile

#ocrconfig -restore /u02/apps/crs/cdata/crs/backup00.ocr

$crsctl start crs (After issuing start cluster check status of cluster using ‘crs_stat -t’)

$srvctl start database -d RACDB (Start Oracle RAC database and RAC instances)

Method 2#  Recover OCR From EXPORT Backup

You can also import OCR metadata from the export dump.  Right before importing up the cluster, RAC instances and Stop Oracle RAC database just reboot the cluster and remove the OCR minor partition.

Recreate both the OCR partitions using the ‘dd’ command. Import OCR’s metadata using the export dump file of backup.

Try the following command to import metadata of OCR from export backup’s dump file.

$srvctl -stop database -d RACDB (Shutdown all RAC instances and RAC database)

$crsctl stop crs (Shutdown Cluster)

#rm -f /u01/oradata/racdb/OCRFile

#dd if=/dev/zero of=/u01/oradata/racdb/OCRFile bs=4096 count=65587

#chown root /u01/oradata/racdb/OCRFile

#chgrp oinstall /u01/oradata/racdb/OCRFile

#chmod 640 /u01/oradata/racdb/OCRFile

SAME process should need to repeat for OCR mirror also.

ocrconfig -import /u04/crs_backup/ocrbackup/exports/OCRFile_exp_Backup.dmp (Import metadata of OCR using command)

$crsctl start crs (After issuing start cluster check status of cluster using ‘crs_stat -t’)

$srvctl start database -d RACDB (Start Oracle RAC database and RAC instances

Method 3# Alternative Option For The OCR Recovery

This option is good for novice users or those users that don’t have a backup of their database. Use a third-party Oracle Repair Tool and repair the Oracle database. This is a very easy and efficient method to repair any database because in this method you don’t have to supply an updated backup file nor you need to type any command to run it.

By using this software one can also recover damaged, corrupt or inaccessible files from the database. It helps in restoring data if it gets corrupted due to viruses, abrupt system shutdown, network connection, etc and keep your files and data safe and secure.


Simple download Oracle Repair Tool and follow the below-given steps to repair your database.               

Steps To Use Oracle Repair Tool:

Step 1: Search the Initial screen of Oracle Repair Tool with a pop-up window showing options to select or search corrupt Oracle databases on your computer.

1

Step 2: Click Scan File to initiate the scan process after selecting the Oracle database. The recoverable database objects get listed in the left-side pane.

2

Step 3: Click an object to see its preview.

3

Step 4: : Click Start Repair in the icon bar to start the repair process. A pop-up window is displayed which show the steps needed to perform further. Click next and continue.

4

Step 5: Give the user name, password and path of the blank database where you want to save the repaired database objects.
5
Step 6: Repairing and restoring various database objects after establishing a connection with blank oracle database.
6

Wrap Up:

Always keep monitoring the OCR backup because it is a very essential portion of Oracle RAC. Meanwhile the remote database services and monitoring, you need to take good care of OCR backup for the Oracle RAC database administration.