Friday, July 14, 2006

OCR backups

In Oracle 10G Release 1 there is no provision to mirror the Oracle cluster registry (OCR) at the software level. In 10G R2 you can specify a mirror location.

Oracle automatically backs up the OCR every 4 hours. If your Oracle Home is not sitting on a shared mountpoint the backups go to
$ORA_CRS_HOME/cdata on the master node. This presents a single point of failure.

Oracle recommends that the CRS backups are put on shared storage. This can be done using the ocrconfig tool.

The syntax for the same is
ocrconfig -backuploc "dir"

Please note that the above command has to be run as root. If you run the command as the oracle user it does not take effect although the command returns successfully and you will see the following error in the ocrconfig.log file

ocrconfig starts...
Warning!! cluster checking is disabled
Failure in creating key [SYSTEM.OCR.BACKUP.LOC] OCR error [PROC-5: User does not have permission to perform a cluster registry operation on this key.]

Use the ocrconfig -showbackup command to check if the destination has changed

You can also take a logical backup using the export option in the ocrconfig command.
The command needs to be run as root

# ocrconfig -export ocr.tmp -s online

As you can see from the below output there is a difference in size between a backup taken by the export option and the OCR backup which is automatically taken every 4 hours.

/tmp> ls -ltr
-rw-r----- 1 root root 26951680 Aug 26 09:08 backup00.ocr
-rw-r--r-- 1 root other 690062 Aug 26 09:27 ocr.tmp

This is because the export is a logical backup and is to be restored using the import option. The OCR backups which happen every 4 hours are binary block by block
copies of the OCR.

As with all backups the only way to test their integrity is to restore them.

But you can use the following command to check the CRS stack and OCR integrity

bart:TEST1:/tmp/bin> ./cluvfy stage -post crsinst -n all -verbose

Performing post-checks for cluster services setup

Checking node reachability...

Check: Node reachability from node "bart"
Destination Node Reachable?
------------------------------------ ------------------------
homer yes
bart yes
Result: Node reachability check passed from node "bart".


Checking user equivalence...

Check: User equivalence for user "oracle"
Node Name Comment
------------------------------------ ------------------------
homer passed
bart passed
Result: User equivalence check passed for user "oracle".

Checking Cluster manager integrity...


Checking CSS daemon...
Node Name Status
------------------------------------ ------------------------
homer running
bart running
Result: Daemon status check passed for "CSS daemon".

Cluster manager integrity check passed.

Checking cluster integrity...

Node Name
------------------------------------
bart
homer

Cluster integrity check passed

Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.


Checking the version of OCR...
OCR of correct Version "2" exists.

Checking data integrity of OCR...
Data integrity check for OCR passed.

OCR integrity check passed.

Checking CRS integrity...

Checking daemon liveness...

Check: Liveness for "CRS daemon"
Node Name Running
------------------------------------ ------------------------
homer yes
bart yes
Result: Liveness check passed for "CRS daemon".

Checking daemon liveness...

Check: Liveness for "CSS daemon"
Node Name Running
------------------------------------ ------------------------
homer yes
bart yes
Result: Liveness check passed for "CSS daemon".

Checking daemon liveness...

Check: Liveness for "EVM daemon"
Node Name Running
------------------------------------ ------------------------
homer yes
bart yes
Result: Liveness check passed for "EVM daemon".

Liveness of all the daemons
Node Name CRS daemon CSS daemon EVM daemon
------------ ------------------------ ------------------------ ----------
homer yes yes yes
bart yes yes yes

Checking CRS health...

Check: Health of CRS
Node Name CRS OK?
------------------------------------ ------------------------
homer yes
bart yes
Result: CRS health check passed.

CRS integrity check passed.

Post-check for cluster services setup was successful.

bart:TEST1:/tmp/bin> ./cluvfy comp ocr -n all -verbose

Verifying OCR integrity

Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.


Checking the version of OCR...
OCR of correct Version "2" exists.

Checking data integrity of OCR...
Data integrity check for OCR passed.

OCR integrity check passed.

Verification of OCR integrity was successful.

bart:TEST1:/tmp/bin> ocrcheck

Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262144
Used space (kbytes) : 16256
Available space (kbytes) : 245888

Cluster registry integrity check succeeded

You can also compare the properties of different nodes in the cluster
using cluvfy comp peer -n all