If you are working on RHEL, then to use the disk in ASM diskgroup, the disks need to be labeled with ASM.
Earlier oracleasm utility was used for this purpose. But oracle developed its own ASM filter driver(AFD), which can be used for this .
SEE ALSO : Oracleasm utility in oracle
1. First check afd is enabled or not?
[root]# export ORACLE_HOME=/u01/app/19.0.0/grid
[root]# export ORACLE_BASE=/u01/app/grid
[root]# export PATH=$ORACLE_HOME/bin:$PATH
[root]# asmcmd
ASMCMD> afd_state
ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'ECAEEDBTL0123'
2. Find list of existing asm labeled disks:
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_lslbl
--------------------------------------------------------------------------------
Label Duplicate Path
================================================================================
DATA1 /dev/sde
FRA1 /dev/sdf
GIMR1 /dev/sdg
GIMR2 /dev/sdh
OCR_VOTING1 /dev/sdi
OCR_VOTING2 /dev/sdj
OCR_VOTING3 /dev/sdk
3. List down the raw disks you need to label with asm:
/dev/sds
/dev/sdr
[rootdev]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
.
.
sde oracleasm DATA1
sdf oracleasm FRA1
sdg oracleasm GIMR1
sdh oracleasm GIMR2
sdi oracleasm OCR_VOTING1
sdj oracleasm OCR_VOTING2
sdk oracleasm OCR_VOTING3
sdr
sds
4. Label the raw disks:
Note – in case of multi-node RAC, you need to label this disk only on one node.
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_label REDO1 /dev/sdr
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_label REDO2 /dev/sds
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_lslbl
--------------------------------------------------------------------------------
Label Duplicate Path
================================================================================
DATA1 /dev/sde
FRA1 /dev/sdf
GIMR1 /dev/sdg
GIMR2 /dev/sdh
OCR_VOTING1 /dev/sdi
OCR_VOTING2 /dev/sdj
OCR_VOTING3 /dev/sdk
REDO1 /dev/sdr
REDO2 /dev/sds
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label Filtering Path
================================================================================
DATA1 ENABLED /dev/sde
FRA1 ENABLED /dev/sdf
GIMR1 ENABLED /dev/sdg
GIMR2 ENABLED /dev/sdh
OCR_VOTING1 ENABLED /dev/sdi
OCR_VOTING2 ENABLED /dev/sdj
OCR_VOTING3 ENABLED /dev/sdk
REDO1 ENABLED /dev/sds
REDO2 ENABLED /dev/sdr
run the same afd_lsdsk command on other rac nodes also. In case you are unable to see the disks, then
run below command.
/u01/app/19.0.0/grid/bin/asmcmd afd_scan
5. Now you can create asm diskgroup using this disks:
SQL> CREATE DISKGROUP REDO1 EXTERNAL REDUNDANCY DISK 'AFD:REDO1', 'AFD:REDO2' attribute 'compatible.asm'='19.0.0.0.0',
'compatible.rdbms'='10.1.0.0.0','compatible.advm'='19.0.0.0.0','au_size'='4M';
How to unlabel a disk:
If you to release a disk, then you can unlabel the disk with below command.
[root]# /u01/app/19.0.0/grid/bin/asmcmd afd_unlabel REDO1