Search This Blog

Friday 29 July 2016

Migrating the OCR and Voting disk among  Disk groups


Agenda is to Migrate or Move the OCR and Voting disks from one disk group to another.  I had a chance to create 2 node 12C RAC GI and database setup in Oracle Virtual Box (OVB). As I opted for only one disk group i.e, DATA while installing the GI software both the data files and clusterware files created in the DATA disk group. Though it’s a virtual environment, felt it’s a good practice to maintain the copy of OCR and Voting disks in a separate disk group.
Added three disks of size 2G and modified it to shareable mode in both the machines.

Steps to format the newly added disks and makes visible

Format the disks with the fdisk utility and sync the disks in the second node.
fdisk /dev/sdh
fdisk /dev/sdi
fdisk /dev/sdj

Generate the UUID with scsi_id.
/sbin/scsi_id -g -u -d /dev/sdh
/sbin/scsi_id -g -u -d /dev/sdi
/sbin/scsi_id -g -u -d /dev/sdj

Add the UUID to the udev rules file as below
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBa4895aff-2eaa7462", NAME="asm-disk7", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VB1a8c4c0e-2c74713d", NAME="asm-disk8", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBf8f2ea7a-ae4d459f", NAME="asm-disk9", OWNER="oracle", GROUP="oinstall", MODE="0660"

To apply the changes and makes disk visible execute the below commands
/sbin/partprobe /dev/sdh
/sbin/partprobe /dev/sdi
/sbin/partprobe /dev/sdj

Once the above steps are completed, the disks must visible in the DB level to create the disk group. Using ASMCA I have created the new disk group  +OCR_VOTING.

Steps to move the clusterware files to the newly created diskgroup.

Prerequisites to check the location of the files

Check for the location of the existing OCR, voting disks, ASM SPfile and Password file

 [oracle@vm1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1484
         Available space (kbytes) :     408084
         ID                       :  762963091
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check bypassed due to non-privileged user

[oracle@vm1 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   a788105fb6524f4ebf146609c6e2d4d0 (/dev/asm-disk1) [DATA]
 2. ONLINE   f0778099cf4a4f22bf84ff94281178fe (/dev/asm-disk2) [DATA]
 3. ONLINE   67c70817b9404fc1bfbcb85d2e62fc7a (/dev/asm-disk3) [DATA]
Located 3 voting disk(s).

[oracle@vm1 ~]$ asmcmd spget
+DATA/scan-vm/ASMPARAMETERFILE/registry.253.918403997

[oracle@vm1 ~]$ asmcmd pwget --asm
+DATA/orapwASM

Get name of the cluster

[oracle@vm1 ~]$ olsnodes -c
scan-vm

Steps for Migrating the OCR

[root@vm1 ~]# /u01/app/12.1.0/grid/bin/ocrconfig -add +OCR_VOTING
[root@vm1 ~]# /u01/app/12.1.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1484
         Available space (kbytes) :     408084
         ID                       :  762963091
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded
         Device/File Name         : +OCR_VOTING
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded

[root@vm1 ~]# /u01/app/12.1.0/grid/bin/ocrconfig -delete +DATA
[root@vm1 ~]# /u01/app/12.1.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1484
         Available space (kbytes) :     408084
         ID                       :  762963091
         Device/File Name         : +OCR_VOTING
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded

Steps for Migrating the Voting disks

[root@vm2 ~]# /u01/app/12.1.0/grid/bin/crsctl replace votedisk +OCR_VOTING
Successful addition of voting disk 473ca034fcfe4ff2bfc4221442a9d715.
Successful addition of voting disk e4eaf4c7c76d4feabf2ceec6ffb3ebe8.
Successful addition of voting disk d223dd90dbf24fe9bf30764452d16583.
Successful deletion of voting disk a788105fb6524f4ebf146609c6e2d4d0.
Successful deletion of voting disk f0778099cf4a4f22bf84ff94281178fe.
Successful deletion of voting disk 67c70817b9404fc1bfbcb85d2e62fc7a.
Successfully replaced voting disk group with +OCR_VOTING.
CRS-4266: Voting file(s) successfully replaced
[root@vm2 ~]# /u01/app/12.1.0/grid/bin/crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   473ca034fcfe4ff2bfc4221442a9d715 (/dev/asm-disk7) [OCR_VOTING]
 2. ONLINE   e4eaf4c7c76d4feabf2ceec6ffb3ebe8 (/dev/asm-disk8) [OCR_VOTING]
 3. ONLINE   d223dd90dbf24fe9bf30764452d16583 (/dev/asm-disk9) [OCR_VOTING]
Located 3 voting disk(s).



Steps for moving the ASM SPfile and ASM Password file

[oracle@vm1 ~]$ asmcmd spmove '+DATA/scan-vm/ASMPARAMETERFILE/registry.253.918403997' '+OCR_VOTING/scan-vm/spfileASM.ora'
ORA-15032: not all alterations performed
ORA-15028: ASM file '+DATA/scan-vm/ASMPARAMETERFILE/registry.253.918403997' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute)
[oracle@vm1 ~]$ asmcmd spget
+OCR_VOTING/scan-vm/spfileASM.ora
[oracle@vm1 ~]$ asmcmd pwmove --asm +DATA/orapwASM +OCR_VOTING/scan-vm/orapwASM
moving +DATA/orapwASM -> +OCR_VOTING/scan-vm/orapwASM
[oracle@vm1 ~]$ asmcmd pwget --asm

+OCR_VOTING/scan-vm/orapwASM