Latest Blogs

Wednesday, January 26, 2022

OCR and VOTE disks moving to newly added DISK - 19c


Rem: Move existing OCR, Votedisk, Spfile, Password file to New ASM Diskgroup


Rem: This is performed on a test setup. On production without proper testing don't perform. 

Rem: The authors claim no responsibility that the steps will work as it is in your environment

Rem: It is only for knowledge sharing

Rem: Author: Hayat Mohammad Khan


(1)

Create new Physical disk from storage and make it visible at OS level

-New physical /dev/sdf1 disk created 

oracleasm createdisk ASMDISK_OCR2 /dev/sdf1


(2)

--New ASM Diskgroup creation

SQL> 

CREATE DISKGROUP OCR2 EXTERNAL REDUNDANCY  

DISK '/dev/oracleasm/disks/ASMDISK_OCR2' SIZE 1023M

ATTRIBUTE 'compatible.asm'='19.0.0.0','au_size'='4M' 

 

(3)

--Verify existing diskgroup and asm disks 

select name, state, type from v$asm_diskgroup;

select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;


set lines 999;

col diskgroup for a15

col diskname for a15

col path for a35

select a.name DiskGroup,b.name DiskName, b.total_mb, (b.total_mb-b.free_mb) Used_MB, b.free_mb,b.path,b.header_status

from v$asm_disk b, v$asm_diskgroup a

where a.group_number (+) =b.group_number

order by b.group_number,b.name;

 

(4)

------------------OCR new disk addition

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :        +GI

                                    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


---Configure additional disk for ocr

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrconfig -add +OCR2

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :        +GI

                                    Device/File integrity check succeeded

Device/File Name         :      +OCR2

                                    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


---delete old ocr disk

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrconfig -delete +GI

[root@dbwr1 ~]# 


---------------verification

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :      +OCR2

                                    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


(5)

----------Vote Disk

[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   03efa5aa41234f82bf19e8c7a04faf04 (/dev/oracleasm/disks/OCR) [GI]

Located 1 voting disk(s).

[root@dbwr1 ~]# 

---assume new votedisk disk +OCR2

[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl replace votedisk +OCR2

Successful addition of voting disk 9354b5963a284fc4bf0ebcd1dd23968c.

Successful deletion of voting disk 03efa5aa41234f82bf19e8c7a04faf04.

Successfully replaced voting disk group with +OCR2.

CRS-4266: Voting file(s) successfully replaced


[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   9354b5963a284fc4bf0ebcd1dd23968c (/dev/oracleasm/disks/ASMDISK_OCR2) [OCR2]

Located 1 voting disk(s).

[root@dbwr1 ~]#


(6)

---Drop old diskgroup GI

------- Super important 

-------Before dropping verify that no critical file exists on it. I have forgotten about the password file, and it caused my 2nd instance ASM not to start.


DROP DISKGROUP GI INCLUDING CONTENTS;

*

ERROR at line 1:

ORA-15039: diskgroup not dropped

ORA-15027: active use of diskgroup "GI" precludes its dismount


Use below URL steps to fix it

https://aprakash.wordpress.com/2012/04/24/ora-15027-active-use-of-diskgroup-data-precludes-its-dismount/


>>> in my case SPFILE was in GI diskgroup

create pfile='/home/oracle/initASM.ora' from spfile;

create spfile='+OCR2' from pfile='/home/oracle/initASM.ora';


/u01/app/19c/grid/bin/gpnptool get


Node1:

/u01/app/19c/grid/bin/crsctl stop crs

Node2:

/u01/app/19c/grid/bin/crsctl stop crs


Node1:

/u01/app/19c/grid/bin/crsctl start crs

Node2:

/u01/app/19c/grid/bin/crsctl start crs


/u01/app/19c/grid/bin/crsctl check cluster -all


$ asmcmd ls -l +DATA/asm/asmparameterfile

Type Redund Striped Time Sys Name

ASMPARAMETERFILE UNPROT COARSE JUN 25 10:00:00 Y REGISTRY.253.722601213

$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.722601213



---Verify Password file

asmcmd pwget --asm


--if corrupted disk path

asmcmd> pwcreate --asm +OCR2/orapwASM 'Welcome_1' -f

[root@dbwr1 disks]# /u01/app/19c/grid/bin/ocrdump /tmp/ocr.dmp


vi /tmp/ocr.dmp and get hash code of CRSUSER__ASM_001

Example:

[SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001]

ORATEXT : 4946c0bced4eefeeff49dcb4749944f0:oracle

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : oracle, GROUP_NAME : oinstall}


/u01/app/19c/grid/bin/crsctl query credmaint -path ASM/Self -credtype userpass

[oracle@dbwr2 trace]$ crsctl get credmaint -path /ASM/Self/4946c0bced4eefeeff49dcb4749944f0 -credtype userpass -id 0 -attr passwd -local

pZxlhryTWaQcB25d2wCc0A00yCslI


[oracle@dbwr2 trace]$ 

asmcmd>

orapwusr --add sys

orapwusr –-add ASMSNMP

orapwusr --grant sysdba ASMSNMP

orapwusr --grant sysasm ASMSNMP

orapwusr --add CRSUSER__ASM_001

---supply this password pZxlhryTWaQcB25d2wCc0A00yCslI


orapwusr --grant sysdba CRSUSER__ASM_001

orapwusr --grant sysasm CRSUSER__ASM_001

lspwusr


crsctl start crs -wait


Credit to below websites:

https://levipereira.wordpress.com/2012/01/11/explaining-how-to-store-ocr-voting-disks-and-asm-spfile-on-asm-diskgroup-rac-or-rac-extended/

https://eclipsys.ca/oracle-rac-12c-a-recipe-to-recover-from-losing-ocr-voting-disk-or-asm-password/

https://blogs.dbcloudsvc.com/oracle/how-to-recreate-the-lost-asm-password-in-oracle-clusterware/

https://dbamarco.wordpress.com/2016/09/15/losing-the-asm-password-file/

https://www.thegeekdiary.com/how-to-move-asm-spfile-to-a-different-disk-group/



--New physical /dev/sdf1 disk created 


oracleasm createdisk ASMDISK_OCR2 /dev/sdf1


--New ASM Diskgroup creation


SQL> 

CREATE DISKGROUP OCR2 EXTERNAL REDUNDANCY  

DISK '/dev/oracleasm/disks/ASMDISK_OCR2' SIZE 1023M

ATTRIBUTE 'compatible.asm'='19.0.0.0','au_size'='4M' 

 


--Verify existing diskgroup and asm disks 

select name, state, type from v$asm_diskgroup;


select name,path,group_number,header_status,total_mb,free_mb from v$asm_disk;


set lines 999;

col diskgroup for a15

col diskname for a15

col path for a35

select a.name DiskGroup,b.name DiskName, b.total_mb, (b.total_mb-b.free_mb) Used_MB, b.free_mb,b.path,b.header_status

from v$asm_disk b, v$asm_diskgroup a

where a.group_number (+) =b.group_number

order by b.group_number,b.name;

 


------------------OCR new disk addition


[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :        +GI

                                    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


[root@dbwr1 ~]# 



---Configure additional disk for ocr

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrconfig -add +OCR2


[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :        +GI

                                    Device/File integrity check succeeded

Device/File Name         :      +OCR2

                                    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



---delete old ocr disk

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrconfig -delete +GI

[root@dbwr1 ~]# 


---------------verification

[root@dbwr1 ~]# /u01/app/19c/grid/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          4

Total space (kbytes)     :     491684

Used space (kbytes)      :      84268

Available space (kbytes) :     407416

ID                       : 1171341430

Device/File Name         :      +OCR2

                                    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



----------Vote Disk


[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   03efa5aa41234f82bf19e8c7a04faf04 (/dev/oracleasm/disks/OCR) [GI]

Located 1 voting disk(s).

[root@dbwr1 ~]# 


---assume new votedisk disk +OCR2

[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl replace votedisk +OCR2

Successful addition of voting disk 9354b5963a284fc4bf0ebcd1dd23968c.

Successful deletion of voting disk 03efa5aa41234f82bf19e8c7a04faf04.

Successfully replaced voting disk group with +OCR2.

CRS-4266: Voting file(s) successfully replaced



[root@dbwr1 ~]# /u01/app/19c/grid/bin/crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   9354b5963a284fc4bf0ebcd1dd23968c (/dev/oracleasm/disks/ASMDISK_OCR2) [OCR2]

Located 1 voting disk(s).

[root@dbwr1 ~]#



---Drop old diskgroup GI

------- Super important 

-------Before drop verify that no critical file exist on it. I have forget about password file, and it caused my 2nd instance ASM not started.


DROP DISKGROUP GI INCLUDING CONTENTS;


*

ERROR at line 1:

ORA-15039: diskgroup not dropped

ORA-15027: active use of diskgroup "GI" precludes its dismount


https://aprakash.wordpress.com/2012/04/24/ora-15027-active-use-of-diskgroup-data-precludes-its-dismount/


>>> in my case SPFILE was in GI diskgroup


create pfile='/home/oracle/initASM.ora' from spfile;

create spfile='+OCR2' from pfile='/home/oracle/initASM.ora';



/u01/app/19c/grid/bin/gpnptool get


Node1:

/u01/app/19c/grid/bin/crsctl stop crs


Node2:

/u01/app/19c/grid/bin/crsctl stop crs



Node1:

/u01/app/19c/grid/bin/crsctl start crs


Node2:

/u01/app/19c/grid/bin/crsctl start crs



/u01/app/19c/grid/bin/crsctl check cluster -all



$ asmcmd ls -l +DATA/asm/asmparameterfile

Type Redund Striped Time Sys Name

ASMPARAMETERFILE UNPROT COARSE JUN 25 10:00:00 Y REGISTRY.253.722601213

$ asmcmd rm +DATA/asm/asmparameterfile/registry.253.722601213



---Verify Password file



asmcmd pwget --asm


--if corrupted disk path


asmcmd> pwcreate --asm +OCR2/orapwASM 'Welcome_1' -f


[root@dbwr1 disks]# /u01/app/19c/grid/bin/ocrdump /tmp/ocr.dmp


vi /tmp/ocr.dmp and get hash code of CRSUSER__ASM_001


Example:

[SYSTEM.ASM.CREDENTIALS.USERS.CRSUSER__ASM_001]

ORATEXT : 4946c0bced4eefeeff49dcb4749944f0:oracle

SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_NONE, USER_NAME : oracle, GROUP_NAME : oinstall}




/u01/app/19c/grid/bin/crsctl query credmaint -path ASM/Self -credtype userpass


[oracle@dbwr2 trace]$ crsctl get credmaint -path /ASM/Self/4946c0bced4eefeeff49dcb4749944f0 -credtype userpass -id 0 -attr passwd -local

pZxlhryTWaQcB25d2wCc0A00yCslI


[oracle@dbwr2 trace]$ 



asmcmd>

orapwusr --add sys

orapwusr –-add ASMSNMP

orapwusr --grant sysdba ASMSNMP

orapwusr --grant sysasm ASMSNMP

orapwusr --add CRSUSER__ASM_001

---supply this password pZxlhryTWaQcB25d2wCc0A00yCslI


orapwusr --grant sysdba CRSUSER__ASM_001

orapwusr --grant sysasm CRSUSER__ASM_001

lspwusr


crsctl start crs -wait


Credit to below websites:

https://levipereira.wordpress.com/2012/01/11/explaining-how-to-store-ocr-voting-disks-and-asm-spfile-on-asm-diskgroup-rac-or-rac-extended/

https://eclipsys.ca/oracle-rac-12c-a-recipe-to-recover-from-losing-ocr-voting-disk-or-asm-password/

https://blogs.dbcloudsvc.com/oracle/how-to-recreate-the-lost-asm-password-in-oracle-clusterware/

https://dbamarco.wordpress.com/2016/09/15/losing-the-asm-password-file/

https://www.thegeekdiary.com/how-to-move-asm-spfile-to-a-different-disk-group/

https://eclipsys.ca/oracle-rac-12c-a-recipe-to-recover-from-losing-ocr-voting-disk-or-asm-password/


No comments: