Categories

[Oracle] How to remove a diskgroup from ASM

You are here:
  • Main
  • Oracle
  • [Oracle] How to remove a diskgroup from ASM
< All Topics

ENVIRONMENT:

  • Red Hat Linux 7
  • Oracle Database 12

VARIABLES:

  • MYDISKGROUP: diskgroup to remove

Hi all,

in this tutorial we are going to remove a diskgroup from ASM and free all the physical disks that were part of it. We suppose that all the disks are in a multipath configuration.

First of all, just query the ASM to find out the disks that are part of the diskgroup:

SET LINE 2222
SET PAGES 50000
COL NAME FOR A20
COL DISKGROUP FOR A20
COL DISKNAME FOR A20
COL FAILGROUP FOR A20
COL PATH FOR A30
SELECT G.NAME,D.NAME "DISKNAME",D.PATH,D.FAILGROUP,DISK_NUMBER
FROM V$ASM_DISKGROUP G , V$ASM_DISK D
WHERE D.GROUP_NUMBER = G.GROUP_NUMBER
AND G.NAME = 'MYDISKGROUP';

NAME                 DISKNAME             PATH                           FAILGROUP            DISK_NUMBER
-------------------- -------------------- ------------------------------ -------------------- -----------
MYDISKGROUP          MYDISK1_150GB        ORCL:MYDISK1_150GB                               			    1
MYDISKGROUP          MYDISK2_150GB        ORCL:MYDISK2_150GB                               			    2
MYDISKGROUP          MYDISK3_150GB        ORCL:MYDISK3_150GB                               			    3

Next, log in as the ASM administrator and dismount and drop the diskgroup:

sqlplus / as sysasm

ALTER DISKGROUP MYDISKGROUP DISMOUNT;
DROP DISKGROUP MYDISKGROUP INCLUDING CONTENTS;

After that, delete the Oracle disks and refresh the list of available disks:

/etc/init.d/oracleasm deletedisk MYDISK1_150GB
/etc/init.d/oracleasm deletedisk MYDISK2_150GB
/etc/init.d/oracleasm deletedisk MYDISK3_150GB
/etc/init.d/oracleasm scandisks

Now, remove all the disks from multipath configuration. First list all the disk aliases:

ls -l /dev/mapper/MYDISK*

/dev/mapper/MYDISK1_150GB -> ../dm-10
/dev/mapper/MYDISK1_150GBp1 -> ../dm-11
/dev/mapper/MYDISK2_150GB -> ../dm-12
/dev/mapper/MYDISK2_150GBp1 -> ../dm-13
/dev/mapper/MYDISK3_150GB -> ../dm-14
/dev/mapper/MYDISK3_150GBp1 -> ../dm-15

Next, remove all the first partitions of each disk and then the disk itself:

dmsetup remove /dev/mapper/MYDISK1_150GBp1
dmsetup remove /dev/mapper/MYDISK2_150GBp1
dmsetup remove /dev/mapper/MYDISK3_150GBp1

dmsetup remove /dev/mapper/MYDISK1_150GB
dmsetup remove /dev/mapper/MYDISK2_150GB
dmsetup remove /dev/mapper/MYDISK3_150GB

Lastly, remove all the entries of the disks from the multipath.conf file. The entries have the following format (of course the wwid can change):

multipath {
  wwid 460000970000297800508533030303744
  alias MYDISK1_150GB
}
multipath {
  wwid 460000970000297800501533030304345
  alias MYDISK2_150GB
}
multipath {
  wwid 460000970000297800501533030306678
  alias MYDISK3_150GB
}

And restart the multipath daemon:

systemctl multipathd reload

Now, you can physically remove the disks from the machine.

That’s all, see you in the next tutorial!

Table of Contents