Adding a disk to an ASM diskgroup is really simple, just an alter command. But when if you are doing this in a production database, then before adding we have to make sure that the disk is healthy.
We will follow below steps to confirm that the disk is healthy.
1.First, create the disk using ASMLIB
# /etc/init.d/oracleasm createdisk DATA02 /dev/mapper/mpathagp1 Marking disk "DATA02" as an ASM disk: [ OK ] -- Do Scandisk on the all the nodes (if RAC) /etc/init.d/oracleasm scandisks -- check whether the disk DATA02 has been created. /etc/init.d/oracleasm listdisk
NOTE – If this is Solaris or HP, then the 1st step is not required, as it doesn’t need ASMLIB.
2. Check the visibility of the disks at OS level🙁 as grid owner from all the nodes)
dd if=/dev/oracleasm/disks/DATA02 of=/dev/null count=100 bs=8192
3. Use kfed to read the disks:(as grid owner from all the nodes)
kfed read /dev/oracleasm/disks/DATA02
If you are getting an error like kfbh.type: 0 ; 0x002: KFBTYP_INVALID, then you can ignore it safely.
4. Now create a diskgroup for testing purpose:
CREATE DISKGROUP TESTDG EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/DATA02';
5. Create a tablespace on this diskgroup:
SQL>Create tablespace TEST_TS datafile '+TESTDG' size 5G; Tablespace created
As tablespace created, we can confirm that the disk is healthy. We can clean the diskgroup.
6.Let’s drop the tablespace and the diskgroup:
DROP TABLESPACE TEST_TS; ALTER DISKGROUP TESTDG DISMOUNT; --(from all the ASM instances, except from one). DROP DISKGROUP TESTDG; --(from the ASM instance, which the diskgroup is still mounted).
Note:- If you try to drop the diskgroup, without dismounting the diskgroup from all instance, except one, then you will hit the error.
ORA-15073: diskgroup TESTDG is mounted by another ASM instance
Now we have cleaned up diskgroup, after confirming that disk is perfectly healthy. So let’s proceed and add that disk to your required existing diskgroup.
7.Add the disk to existing diskgroup:
SQL> ALTER DISKGROUP PROD_DG ADD DISK '/dev/oracleasm/disks/DATA02';