Backup and Recovery of OCR (Oracle Cluster Registry) in RAC

Backup and Recovery of OCR (Oracle Cluster Registry) in RAC

Tips and technical articles of Oracle RAC DBA
OCR calls Oracle Cluster Registry. It stores cluster configuration information. It is also shared disk component. It must be accessed by all nodes in cluster environment.It also keeps information of Which database instance run on which nodes and which service runs on which database.The process daemon OCSSd manages the configuration info in OCR and maintains the changes to cluster in the registry.

Automatic Backup of OCR

Automatic backup of OCR is done by CRSD process and every 3 hours. Default location is CRS_home/cdata/cluster_name. But we can change default location of this backup of OCR. We can check default location using following command.

$ocrconfig -showbackup
We can change this default location of physical OCR copies using following command.

$ocrconfig -backuploc

How to take PHYSICAL Backup of OCR?

First check exact location of automatic OCR backup location using "ocrconfig -showbackup" command. Because this automatic backup of OCR is physical copies of Oracle Cluster Registry. There is no need to bring down Cluster to take this physical backup of OCR. Use simple operating system's copy command to copy this physical OCR copy to backup destination as give below.

$cp -p -R /u01/app/crs/cdata /u02/crs_backup/ocrbackup/RACNODE1

How to take MANUAL EXPORT Backup of OCR?

We can take export backup of OCR (Oracle Cluster Registry) also in online. There is no need to bring down Cluster to take export backup of OCR. Manual backup can be taken using "ocrconfig -export" command as follows.

$ocrconfig -export /u04/crs_backup/ocrbackup/exports/OCRFile_expBackup.dmp

$ocrconfig -export /u04/crs_backup/ocrbackup/exports/OCRFile_expBackup.dmp

How to Recover OCR from PHYSICAL Backup?

For recovering OCR from physical automated backup needs all cluster, RAC instances and RAC database bring down before performing recovery of OCR. Here you can find out command reference for Recovery of OCR from 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)

How to Recover OCR from EXPORT Backup?

We can import metadata of OCR from export dump. Before importing Stop Oracle RAC database, RAC instances and Cluster. Reboot Cluster and remove OCR partition as well as OCR mirror partition. Recreate using 'dd' command both partitions. Import metadata of OCR from export dump file of backup. Example commands as following

$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)

Remember following important things:

1. Oracle takes physical backup of OCR automatically.
2. No Cluster downtime or RAC database down time requires for taking PHYSICAL backup of OCR. It can be done online.
3. No Cluster downtime or RAC database down time requires for taking MANUAL export backup of OCR.
4. For recovery of OCR from any of above backup it should need to down Cluster,RAC database,Instances.
5. All procedure requires ROOT login.

Comments

Popular posts from this blog

ORA-01565: error in identifying file '?/dbs/spfile@.ora'

Reboot Exadata Machine

How to combine Oracle .ova files