RAC – Oracle Cluster Registry (OCR)

Well!! we have decided on what shared storage(SAN, NAS, JBOD) to use and also decided on how to setup the disks (ASM). Now let’s come to Clusterware.

Oracle Clusterware has 2 components –

* Oracle Cluster Registry (OCR)

* Voting Disk

OCR – Oracle Cluster Registry– used to store cluster and database configuration information for RAC and CRS (node list, instance to node mapping etc.,). 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. It is a shared disk component and should be available to all the nodes.

Because of its importance, it is necessary to take backup of the OCR information from time to time. CRSD process performs an automatic backup of OCR for every 3 hours and stores the copies in a default location. If we want we can change the default location to any other location using ocrconfig command.

         $ocrconfig -showbackup

         $ocrconfig -backuploc [mention backup location]

Manual Backup of OCR
Can be done in 2 ways

1.) Direct copy using os level copy command

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

2.) Using Export

$ocrconfig – export /uo4/../exports/OCRFile_expBackup.dmp

In both the cases, there is no need to bring down the cluster for backup.

Recovering OCR
Ofcourse in 2 ways –

a.) using Physical backup copy –

$srvctl -stop database -d RACDB (Shutdown all instances and 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 /u01/oradata/racdb/OCRFile

#chmod 640 /u01/oradata/racdb/OCRFile

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

$crsctl start crs (start cluster)

$crs_stat -t (To check the status of the cluster.)

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

b.) Using Export bakcup copy

$srvctl -stop database -d RACDB (Shutdown all instances & 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/../exports/OCRFile_exp_Backup.dmp

$crsctl start crs (start cluster )

$crs_stat -t (To check status of cluster)

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

Note 1 – whatever the procedure followed for recovery, it is necessary to bring down all cluster, RAC instances and RAC database.

Note 2 – If you create more than one database on the cluster, they all share the same Oracle cluster registry(OCR)

This entry was posted in Oracle - RAC. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s