Bajwa Consulting Need senior Oracle DBA help? Performance tuning, Cloud migrations, GoldenGate, backup and DR. Plus 70+ free DBA scripts.
Visit bajwaconsulting.com →

Wednesday, January 21, 2015

Move voting disk, OCR to new Diskgroup

Originally posted in 2015 (Grid Infrastructure 11.2). Updated November 2026 for Grid Infrastructure 19c and 21c.

This post moves the Oracle Cluster Registry (OCR), the voting files and the ASM spfile from an old disk group (+OCR_VOTE) to a new NORMAL redundancy disk group (+VOTE_OCR). I did this on a 4-node RAC cluster. The steps are the same in 19c and 21c, and all of it can be done online; the databases do not need to be shut down. Still, do it in a maintenance window and take an OCR backup first.

Plan the new disk group

  • Redundancy decides how many disks you need. Voting files need 3 failure groups in a NORMAL redundancy disk group and 5 in a HIGH redundancy one. Use 3 (or 5) small LUNs of the same size, ideally from different storage paths.
  • Keep it small and separate. A dedicated disk group for OCR, voting files and the ASM spfile is easy to protect and move. Add a second OCR copy in another disk group, such as +DATA.
  • 19c and 21c only need about 1 GB per disk for these files, unless you also keep the Grid Infrastructure Management Repository (GIMR) there. GIMR is optional from 19c and often not installed.

1. Prepare the disks

Present the LUNs to every node. If you partition them, start the partition at 1 MB (sector 2048) so it is aligned with the storage. With multipath, partition the multipath device, not the individual paths:

# As root, on one node
parted /dev/mapper/mpath45 --script mklabel gpt mkpart primary 1MiB 100%
parted /dev/mapper/mpath46 --script mklabel gpt mkpart primary 1MiB 100%
parted /dev/mapper/mpath47 --script mklabel gpt mkpart primary 1MiB 100%

# Make the new partitions visible on every node
partprobe /dev/mapper/mpath45      # or: kpartx -a /dev/mapper/mpath45

In 2015, only a reboot made the new partitions show up cleanly on all four nodes. On current kernels, partprobe or kpartx is usually enough, but reboot the nodes one at a time if a disk still does not appear.

2. Label the disks for ASM

Use the same method as the rest of your cluster. In 19c and 21c the options are ASM Filter Driver (AFD), udev rules, or ASMLib:

# ASM Filter Driver (as the grid owner, Grid home in PATH)
asmcmd afd_label VOTE_OCR01 /dev/mapper/mpath45p1
asmcmd afd_label VOTE_OCR02 /dev/mapper/mpath46p1
asmcmd afd_label VOTE_OCR03 /dev/mapper/mpath47p1
asmcmd afd_lsdsk

# Or ASMLib (as root)
oracleasm createdisk VOTE_OCR01 /dev/mapper/mpath45p1
oracleasm createdisk VOTE_OCR02 /dev/mapper/mpath46p1
oracleasm createdisk VOTE_OCR03 /dev/mapper/mpath47p1
oracleasm listdisks
# then on every other node:
oracleasm scandisks

3. Create the disk group

Use asmca (NORMAL redundancy, one failure group per disk), or SQL*Plus connected to the ASM instance as SYSASM:

CREATE DISKGROUP VOTE_OCR NORMAL REDUNDANCY
  FAILGROUP fg1 DISK 'AFD:VOTE_OCR01'      -- 'ORCL:VOTE_OCR01' with ASMLib
  FAILGROUP fg2 DISK 'AFD:VOTE_OCR02'
  FAILGROUP fg3 DISK 'AFD:VOTE_OCR03'
  ATTRIBUTE 'compatible.asm' = '19.0.0.0.0';

Then mount it on the other nodes: srvctl start diskgroup -diskgroup VOTE_OCR.

4. Check what is where, and back up the OCR

# As root, with the Grid home's bin directory in PATH
which crsctl              # must be the Grid home, e.g. /u01/app/19.0.0/grid/bin/crsctl
ocrcheck -config          # OCR locations
crsctl query css votedisk # voting files
asmcmd spget              # ASM spfile location (as the grid owner)

ocrconfig -manualbackup   # take a backup before changing anything
ocrconfig -showbackup

5. Move the OCR

You can have up to 5 OCR locations, one per disk group. Add the new locations first, then remove the old one:

ocrconfig -add +VOTE_OCR
ocrconfig -add +DATA          # a second copy in another disk group
ocrcheck

ocrconfig -delete +OCR_VOTE
ocrcheck

Every listed location should show "Device/File integrity check succeeded", followed by "Cluster registry integrity check succeeded" and "Logical corruption check succeeded".

6. Move the voting files

crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   865f20aae69f4fb1bf5fea01bccb68d0 (ORCL:OCR_VOTE01) [OCR_VOTE]
Located 1 voting disk(s).

crsctl replace votedisk +VOTE_OCR
Successful addition of voting disk 7013dd89496e4f81bf97ffc588dad3bc.
Successful addition of voting disk 9062abc1f8e24f04bf90049e84da1a70.
Successful addition of voting disk 818ea7b5d5ee4fc1bf919ffeed602bea.
Successful deletion of voting disk 865f20aae69f4fb1bf5fea01bccb68d0.
Successfully replaced voting disk group with +VOTE_OCR.
CRS-4266: Voting file(s) successfully replaced

crsctl query css votedisk
 1. ONLINE   7013dd89496e4f81bf97ffc588dad3bc (ORCL:VOTE_OCR01) [VOTE_OCR]
 2. ONLINE   9062abc1f8e24f04bf90049e84da1a70 (ORCL:VOTE_OCR02) [VOTE_OCR]
 3. ONLINE   818ea7b5d5ee4fc1bf919ffeed602bea (ORCL:VOTE_OCR03) [VOTE_OCR]
Located 3 voting disk(s).

A NORMAL redundancy disk group with 3 failure groups gives you 3 voting files, so the cluster survives the loss of any one disk.

7. Move the ASM spfile and password file

# As the grid owner
asmcmd spget
asmcmd spmove +OCR_VOTE/rac-cluster/ASMPARAMETERFILE/registry.253.734782115 +VOTE_OCR/spfileASM.ora
asmcmd spget

# 12c and later keep the ASM password file in a disk group too
asmcmd pwget --asm
asmcmd pwmove --asm +OCR_VOTE/orapwasm +VOTE_OCR/orapwasm

If spmove reports that the file is in use, copy it with asmcmd spcopy -u instead; the new spfile is used from the next ASM restart.

8. Verify with a restart

Restart the stack one node at a time (rolling), so the cluster stays up:

crsctl stop crs      # as root, on one node
crsctl start crs
crsctl check cluster -all
crsctl query css votedisk
ocrcheck
cluvfy comp ocr -n all -verbose

When everything reports healthy on all nodes, and nothing is left in +OCR_VOTE (check with asmcmd ls -l +OCR_VOTE), you can drop the old disk group and release its LUNs.

Lessons from the original move

  • Always confirm crsctl and ocrconfig come from the Grid home, not a database home.
  • Take a manual OCR backup first. In 12.2 and later you can keep OCR backups in a disk group with ocrconfig -backuploc +DATA.
  • Test the whole procedure on a test cluster, including a rolling restart, before production.

More current DBA scripts are in my GitHub repository: github.com/sbajwa55/dba-scripts. For help with RAC, Grid Infrastructure or migrations to AWS, visit Bajwa Consulting Services.

No comments:

Post a Comment