In this article, we are going to learn how to create an ASM diskgroup, so here I’m going to show you the complete steps to creating ASM devices and then the ASM disk group.
To creating ASM diskgroups you can use asmca (Oracle ASM Configuration Assistant) which is providing a GUI interface. But in this tutorial, we are going to use the manual method. So here we are going to create a diskgroup with EXTERNAL REDUNDANCY.
If you are using a VMware environment then you need to add a new disk and create a partition in this disk using the fdisk command, create an ASM disk using the below command as the root user.
oracleasm createdisk VOL1 /dev/sdb1
Check existing disk and diskgroup information
How to check ASM disk and diskgroup information.
SQL> select name from v$asm_disk; NAME ------------------------------ VOL2 VOL3
SQL> select name from v$asm_diskgroup; NAME ------------------------------ FRA DATA
How to create ASM Disk group?
Using below command we can create diskgroup ASM with external redundancy.
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:VOL1'; OR CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK 'ORCL:VOL1', 'ORCL:VOL2';
The above command will create an ASM diskgroup called DATA that contains the disks marked VOL1 and VOL2 by ASMlib.
How to Mount and Dismount ASM Diskgroup
If the diskgroup not in use you can dismount and mount the diskgroup using below commands.
SQL> alter diskgroup DISK_GROUP_NAME dismount force; Diskgroup altered.
SQL> alter diskgroup DISK_GROUP_NAME mount; Diskgroup altered.
If you want to drop a diskgroup, then you can use the below command.
SQL> drop diskgroup DISK_GROUP_NAME including contents; Diskgroup dropped.