Skip to content
Home » Oracle » How to Backup OCR and Voting Disk

How to Backup OCR and Voting Disk

In this post, I will introduce some ways to backup Oracle Cluster Registry (OCR) data and voting disk in case of losing all configuration.

Backup OCR Data

1. OCR Dumps

Oracle provides an utility ocrconfig to export OCR data to a dump file like this:

[root@primary01 ~]# . /home/oracle/.bash_profile
[root@primary01 ~]# cd /backup/
[root@primary01 backup]# ocrconfig -export ocr_backup_`date +%Y%m%d`.dmp

The document says that OCR exporting should be done when CRS stopped in order to get a consistent snapshot. However, I see no difference so far. For 11g or later, you have a better choice to backup OCR.

2. OCR Backups

Since 11g (11.1), the clusterware backs up OCR automatically every 4 hours by Cluster Ready Services Daemon (CRSD). Of course, we can also backup OCR manually.

[root@primary01 ~]# ocrconfig -manualbackup

primary01     2019/06/12 19:12:05     /u01/app/12.1.0/grid/cdata/primary-cluster/backup_20190612_191205.ocr     0
[root@primary01 ~]# ocrconfig -showbackup
...
primary01     2019/06/12 19:12:05     /u01/app/12.1.0/grid/cdata/primary-cluster/backup_20190612_191205.ocr     0

Please note that, OCR backups are not compatible with OCR dumps, you have to use ocrconfig -restore to restore OCR.

Backup Voting Disk

1. Use dd Command

You have to be very cautious about the following dd action, if you misplaced the source and the target, or using dd in the wrong way, you might destroy the voting disk. Please check the command line at least twice before hitting Enter.

[root@primary01 ~]# crsctl query css votedisk
 0.     0    /dev/raw/raw2

located 1 votedisk(s).
[root@primary01 backup]# dd if=/dev/raw/raw2 of=vod_backup_`date +%Y%m%d`.dmp bs=1k count=500k
512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 313.379 seconds, 1.7 MB/s

Please note that, using dd to backup voting disk is no longer supported since 12c according to documentation. (In fact, it's from 11.2, you should be aware of that.)

Let's see the result.

[root@primary01 backup]# ll
total 512596
-rw-r--r-- 1 root root     89348 Jun 12 14:46 ocr_backup_20190612.dmp
-rw-r--r-- 1 root root 524288000 Jun 12 14:52 vod_backup_20190612.dmp

2. Rely on OCR Backups

Since 11g (11.2), the voting disk data is automatically backed up in OCR as part of any configuration change and is automatically restored to any voting disk added. That is to say, as long as you have the latest OCR backup, you automatically have voting disk backup too.

In other words, for 12c RAC database, you should only backup OCR instead of backing up voting disk. If you doubt about it, you should take a look at how to restore 12c clusterware including ocr and voting disk.

Next, let's see how we use the backups to restore 10g clusterware or restore 12c clusterware.

Leave a Reply

Your email address will not be published. Required fields are marked *