I must thank my fellow DBA Franky Weber Faust for his publication in his blog.
Introduction: – This article is about creating disk-group via asm cmd. Being an Oracle DBA we have knowledge of ASM. Automatic Storage Management (ASM) is Oracle’s logical volume manager, it uses OMF (Oracle Managed Files) to name and locate the database files. It can use raw disks, file systems or files which can be made to look like disks as long as the device is raw. ASM uses its own database instance to manage the disks, it has its own processes and pfile or spfile, it uses ASM disk groups to manage disks as one logical unit
The benefits of ASM are mention below:-
- Provides automatic load balancing over all the available disks, thus reducing hot spots in the file system
- Prevents fragmentation of disks, so you don’t need to manually relocate data to tune I/O performance
- Adding disks is straight forward – ASM automatically performs online disk reorganization when you add or remove storage
- Uses redundancy features available in intelligent storage arrays
- The storage system can store all types of database files
- Using disk group makes configuration easier, as files are placed into disk groups
- ASM provides stripping and mirroring (fine and coarse gain – see below)
- ASM and non-ASM Oracle files can coexist
- ASM is free!!!!!!!!!!!!!
ASMCMD> lsdsk --candidate -p Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path 0 0 0 CLOSED FORMER ONLINE NORMAL AFD:DATA01
The status of the disk “AFD: DATA01” is “FORMER” since I had already used it on another disk-group previously and as this risk group was deleted the disk appears with this status.
To create a disk-group using asmcmd it is necessary to generate an XML file and inform some tags.
Let’s see an example:
<dg name="DATA" redundancy="external"> <dsk string="AFD:DATA01"/> <a name="compatible.asm" value="12.2.0.1.0" /> <a name="compatible.rdbms" value="12.2.0.1.0" /> <a name="compatible.advm" value="12.2.0.1.0" /> </dg>
Include this content in a file using “vi”:
[oracle@london2 ~]$ vi dg_data.xml
Access the asmcmd utility and create the diskgroup:
[oracle@london2 ~]$ asmcmd ASMCMD> mkdg dg_data.xml
If there are no errors in the above procedure the diskgroup will be created successfully.
Let’s check:
ASMCMD> lsdg State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name MOUNTED EXTERN N 512 512 4096 4194304 40960 6900 0 6900 0 Y CONFIG/ MOUNTED EXTERN N 512 512 4096 1048576 12288 12234 0 12234 0 N DATA/
As we can see the diskgroup DATA was created successfully.
Note below that it is only mounted on instance 2:
ASMCMD> lsdg -g Inst_ID State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name 1 MOUNTED EXTERN N 512 512 4096 4194304 40960 6900 0 6900 0 Y CONFIG/ 2 MOUNTED EXTERN N 512 512 4096 4194304 40960 6900 0 6900 0 Y CONFIG/ 2 MOUNTED EXTERN N 512 512 4096 1048576 12288 12234 0 12234 0 N DATA/ ASMCMD> lsdsk -gp Inst_ID Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path 1 1 1 4042311022 CACHED MEMBER ONLINE NORMAL AFD:CONFIG01 2 1 1 4042305785 CACHED MEMBER ONLINE NORMAL AFD:CONFIG01 1 1 0 4042311023 CACHED MEMBER ONLINE NORMAL AFD:CONFIG02 2 1 0 4042305786 CACHED MEMBER ONLINE NORMAL AFD:CONFIG02 1 1 3 4042311024 CACHED MEMBER ONLINE NORMAL AFD:CONFIG03 2 1 3 4042305787 CACHED MEMBER ONLINE NORMAL AFD:CONFIG03 1 1 2 4042311025 CACHED MEMBER ONLINE NORMAL AFD:CONFIG04 2 1 2 4042305788 CACHED MEMBER ONLINE NORMAL AFD:CONFIG04 2 2 0 4042305796 CACHED MEMBER ONLINE NORMAL AFD:DATA01
Let’s then mount it remotely in instance 1:
[oracle@london2 ~]$ srvctl start diskgroup -diskgroup DATA -n london1
ASMCMD> lsdg -g Inst_ID State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name 1 MOUNTED EXTERN N 512 512 4096 4194304 40960 6900 0 6900 0 Y CONFIG/ 2 MOUNTED EXTERN N 512 512 4096 4194304 40960 6900 0 6900 0 Y CONFIG/ 1 MOUNTED EXTERN N 512 512 4096 1048576 12288 12190 0 12190 0 N DATA/ 2 MOUNTED EXTERN N 512 512 4096 1048576 12288 12190 0 12190 0 N DATA/ ASMCMD> lsdsk -pg Inst_ID Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path 2 1 1 4042305785 CACHED MEMBER ONLINE NORMAL AFD:CONFIG01 1 1 1 4042311022 CACHED MEMBER ONLINE NORMAL AFD:CONFIG01 2 1 0 4042305786 CACHED MEMBER ONLINE NORMAL AFD:CONFIG02 1 1 0 4042311023 CACHED MEMBER ONLINE NORMAL AFD:CONFIG02 2 1 3 4042305787 CACHED MEMBER ONLINE NORMAL AFD:CONFIG03 1 1 3 4042311024 CACHED MEMBER ONLINE NORMAL AFD:CONFIG03 2 1 2 4042305788 CACHED MEMBER ONLINE NORMAL AFD:CONFIG04 1 1 2 4042311025 CACHED MEMBER ONLINE NORMAL AFD:CONFIG04 2 2 0 4042305796 CACHED MEMBER ONLINE NORMAL AFD:DATA01 1 2 0 4042311035 CACHED MEMBER ONLINE NORMAL AFD:DATA01
Hi Skant, This feature comes 11gR2 onwords.
HI Vinay, I am using ASMFD which is available in Oracle 12cR2