Friday, 27 July 2012

Useful ASM commands

ASM COMMANDS -
------------
We can create the asm diskgroup using an xml file, example as below -


vi <file_name>.xml


<dg name="FRA" redundancy="external">
<dsk> <dsk string="ORCL:ASMDISK09"/>
<dsk> <dsk string="ORCL:ASMDISK10"/>
<dsk> <dsk string="ORCL:ASMDISK11"/>
<a name="compatible.asm" value="11.2"/>
<a name="compatible.rdbms" value="11.2"/>
<a name="compatible.advm" value="11.2"/>
</dg>


asmcmd mkdg /home/oracle/labs/less_02/<file_name>.xml  ---> to invoke the xml file to create diskgroup


$ asmcmd
ASMCMD> lsdg   ---> to diskplay the diskgroups
ASMCMD> lsdsk -G <dg_name>   ---> to list the disk of the specified diskgroups
ASMCMD> mount <dg_nam> ---> to mount a diskgroup



To list the attributes of a ASM diskgroup -
-----------------------------------------


SELECT G.NAME DISK_GROUP, A.NAME ATTRIBUTE, A.VALUE
 FROM V$ASM_ATTRIBUTE A, V$ASM_DISKGROUP G
 WHERE A.GROUP_NUMBER = G.GROUP_NUMBER
 AND G.NAME = 'DATA';


ASMCMD> lsattr -lm -G <diskgroup_name>


To find current space utilization of Disk Groups-
-------------------------------------------------


SELECT NAME, TYPE, TOTAL_MB, FREE_MB,
 REQUIRED_MIRROR_FREE_MB RMFM, USABLE_FILE_MB
 FROM V$ASM_DISKGROUP;


ASMCMD> lsdg




To retrieve disks information in a disk group -
---------------------------------------------


SELECT G.NAME DISK_GROUP, D.NAME, D.STATE, D.TOTAL_MB,
 D.FREE_MB
 FROM V$ASM_DISK D, V$ASM_DISKGROUP G
 WHERE D.GROUP_NUMBER = G.GROUP_NUMBER
 AND G.NAME = 'DATA';


ASMCMD> lsdsk -k


To drop disk from diskgroup -
---------------------------


ALTER DISKGROUP <DiskGroup_Name> DROP DISK <DISK1>, <DISK2>;




SELECT * FROM V$ASM_OPERATION;


ASMCMD> lsop




To view the connected Clients -
-----------------------------


SELECT G.NAME DISK_GROUP, C.*
 FROM V$ASM_CLIENT C, V$ASM_DISKGROUP G
 WHERE C.GROUP_NUMBER = G.GROUP_NUMBER
 AND G.NAME = 'DATA';


ASMCMD> lsct

No comments:

Post a Comment