Monday, February 8, 2010

Oracle Database, and RAC: How to delete, add, remove OCR and Voting Disk

This post is directed for DBAs who need to modify, or move OCR and voting disk locations. Some times a DBA wants to move to new storage area location. Typically, one would simply copy or dd the files once the new storage has been presented to the hosts. But when moveing OCR and/or voting disk its a little bit different.


ADD/REMOVE/REPLACE OCR Device
You must be logged in as the root user, because root own the OCR files.

Make sure there is a recent copy of the OCR file before making any changes:
ocrconfig –showbackup

If there is not a recent backup copy of the OCR file, an export can be taken for the current OCR file. Use the following command to generate an export of the online OCR file:
ocrconfig –export -s online

To recover using the export file use the following command:
ocrconfig import


1. Add an OCR device:

Provide the full path including file name.
ocrconfig -replace ocr

To add an OCR mirror device, full path including file name.
ocrconfig -replace ocrmirror

2. Remove an OCR device:

ocrconfig -replace ocr

To remove OCR mirror device
ocrconfig -replace ocrmirror

3. Replace or move the location of an OCR device:

To replace the OCR device, provide the full path including file name.
ocrconfig -replace ocr

To replace the OCR mirror device, provide the full path including file name.
ocrconfig -replace ocrmirror


Example moving OCR file from OCFS to raw devices
The OCR disk must be owned by root, must be in the oinstall group, and must have permissions set to 640. and at least 100 MB disk space for the OCR.

In this example the OCR file are located in the ocfs2 file system:
/ocfs2/ocr0
/ocfs2/ocr1

Create raw device files of at least 100 MB. In this example the new OCR file will be on the following devices:
/dev/raw/raw0
/dev/raw/raw1

Once the raw devices are created, use the dd command to zero out the device and make sure no data is written to the raw devices:
dd if=/dev/zero of=/dev/raw/raw0
dd if=/dev/zero of=/dev/raw/raw1

Now you are ready to move/replace the OCR file to the new storage location.

Move/Replace the OCR device
ocrconfig -replace ocr /dev/raw/raw0

Add /dev/raw/raw2 as OCR mirror device
ocrconfig -replace ocr /dev/raw/raw1

Example of adding an OCR device file

In this example a second OCR device file is added:
Add /dev/raw/raw2 as OCR mirror device

ocrconfig -replace ocr /dev/raw/raw2




ADD/DELETE/MOVE Voting Disk
Before doing any changes to voting disk you must shutdown the Oracle Clusterware (crsctl stop crs as root) on all nodes .

Determine the current voting disk location using:
crsctl query css votedisk

Take a backup of all voting disk:
dd if=voting_disk_name of=backup_file_name

The following can be used to restore the voting disk from the backup file created.
dd if=backup_file_name of=voting_disk_name

1. To add a Voting Disk, provide the full path including file name.:
crsctl add votedisk css -force

2. To delete a Voting Disk, provide the full path including file name.:
crsctl delete votedisk css -force

3. To move a Voting Disk, provide the full path including file name.:
crsctl delete votedisk css –force
crsctl add votedisk css –force


After modifying the voting disk, start the Oracle Clusterware stack on all nodes
crsctl start crs

Verify the voting disk location using
crsctl query css votedisk



Example moving Voting Disk from OCFS to raw devices
The voting disk is a partition that Oracle Clusterware uses to verify cluster node membership and status.

The voting disk must be owned by the oracle user, must be in the dbagroup, and must have permissions set to 644. Provide at least 20 MB disk space for the voting disk.

In this example the Voting Disks are located in the ocfs2 file system:
/ocfs2/voting1
/ocfs2/voting2
/ocfs2/voting3

Create raw device files of at least 20 MB. In this example the new voting disks will be on the following devices:
/dev/raw/raw3
/dev/raw/raw4
/dev/raw/raw5

Once the raw devices are created, use the dd command to zero out the device and make sure no data is written to the raw devices:
dd if=/dev/zero of=/dev/raw/raw3
dd if=/dev/zero of=/dev/raw/raw4
dd if=/dev/zero of=/dev/raw/raw5

Now you are ready to move/replace the voting disks to the new storage location.

To move a Voting Disk to new storage location:
crsctl delete votedisk css /ocfs2/voting1 –force
crsctl add votedisk css /dev/raw/raw3 –force
crsctl delete votedisk css /ocfs2/voting2 –force
crsctl add votedisk css /dev/raw/raw4 –force
crsctl delete votedisk css /ocfs2/voting3 –force
crsctl add votedisk css /dev/raw/raw5 –force



Example of adding Voting Disks
In this example two additional Voting Disks are added:
crsctl add votedisk css /dev/raw/raw4 –force
crsctl add votedisk css /dev/raw/raw5 –force


After modifying the voting disk, start the Oracle Clusterware stack on all nodes
crsctl start crs

Verify the voting disk location using
crsctl query css votedisk

No comments:

Post a Comment