This article contains the list of useful asmcmd commands which will come handy in your day to day operations.

1. List all diskgroups:


ASMCMD> lsdg


-- Include dismounted diskgroups:

ASMCMD> lsdg --discovery

-- List diskgroups across all nodes of cluster:

ASMCMD> lsdg -g --discovery


2. List asm disks:

-- List all asm disks

ASMCMD> lsdsk -k 

-- List disks of a diskgroup(CDATA) with free and total MB
ASMCMD> lsdsk -k -G CDATA

-- List disks of a diskgroup(CDATA) with group and disk number
ASMCMD> lsdsk -p -G CDATA

-- List disks with disk creation date 
ASMCMD> lsdsk -t -G CDATA

-- List candidiate disks only

ASMCMD>  lsdsk --candidate -k

-- List member disks only
ASMCMD>  lsdsk --candidate -p

3. Get attributes of ASM diskgroups:



-- List attribute of all diskgroups:

ASMCMD> lsattr -lm 

-- List attribute of specific diskgroup(DMARCH)

ASMCMD> lsattr -lm -G  DMARCH
Group_Name  Name                     Value       RO  Sys
DMARCH      access_control.enabled   FALSE       N   Y
DMARCH      access_control.umask     066         N   Y
DMARCH      au_size                  1048576     Y   Y
DMARCH      cell.smart_scan_capable  FALSE       N   N


-- List attributes with specific pattern

ASMCMD> lsattr -lm %au_size%
Group_Name  Name     Value    RO  Sys
CDATA       au_size  1048576  Y   Y
BDM         au_size  1048576  Y   Y
CRMG        au_size  1048576  Y   Y
PMARCH      au_size  1048576  Y   Y
BCMS        au_size  1048576  Y   Y


4. unmount diskgroup:

unmount command works only on the local node. So if you want to unmount the diskgroup from all nodes of cluster, then run this command from all the nodes.



-- unmount all diskgroups
ASMCMD> umount -a

--- unmount specific diskgroup(ARCH)
ASMCMD> umount ARCH

4. Mount diskgroup:

Mount command works only on the local node. So if you want to Mount the diskgroup from all nodes of cluster, then run this command from all the nodes.



-- mount all diskgroups on local node
ASMCMD> mount -a

--- mount a specific diskgroup on local node
ASMCMD> mount ARCH

5. Rebalance a diskgroup:




-- here asm_power_limit is 8 and diskgroup is ARCH

ASMCMD> rebal --power 8 ARCH
Rebal on progress.

-- Monitor progress

ASMCMD> lsop
Group_Name  Pass       State  Power  EST_WORK  EST_RATE  EST_TIME
ARCH        COMPACT    RUN    8      0         16831     0
ARCH        REBALANCE  DONE   8      0         0         0


6. Get password file of database



ASMCMD> pwget --dbuniquename DBACLASS
+CDATA/DBACLASS/PASSWORD/pwddbaclass.256.899912377

8 .Get password file of asm :


ASMCMD> pwget --asm
+MGMT/orapwASM

9. Get asm template info of a diskgroup:




ASMCMD> lstmpl -l -G ARCH
Group_Name  Group_Num  Name                       Stripe  Sys  Redund  PriReg  MirrReg
ARCH        1          ARCHIVELOG                 COARSE  Y    UNPROT  COLD    COLD
ARCH        1          ASMPARAMETERFILE           COARSE  Y    UNPROT  COLD    COLD
ARCH        1          AUDIT_SPILLFILES           COARSE  Y    UNPROT  COLD    COLD
ARCH        1          AUTOBACKUP                 COARSE  Y    UNPROT  COLD    COLD
ARCH        1          AUTOLOGIN_KEY_STORE        COARSE  Y    UNPROT  COLD    COLD
ARCH        1          BACKUPSET                  COARSE  Y    UNPROT  COLD    COLD


10. Check whether flex asm is enabled or not



ASMCMD> showclustermode
ASM cluster : Flex mode disabled


11.Check cluster state:


ASMCMD> showclusterstate
Normal

12. View asm version:



ASMCMD> showversion
ASM version         : 12.1.0.2.0

13. Get asm spfile location:


ASMCMD> spget
+MGMT/DBACLASS-cluster/ASMPARAMETERFILE/registry.253.899644763

14. Take backup of asm spfile:

-- copy backup of spfile to a specific location

ASMCMD> spbackup +MGMT/DBACLASS-cluster/ASMPARAMETERFILE/registry.253.899644763 /home/oracle/asmspfile.ora

15. Find clients connected to a diskgroup:

ASMCMD> lsct DMARCH
DB_Name  Status     Software_Version  Compatible_version  Instance_Name  Disk_Group
DBACLASS  CONNECTED        12.1.0.2.0          12.1.0.2.0  DBACLASS1       DMARCH

16. Get asm diskstring

ASMCMD> dsget
parameter:ORCL:*
profile:ORCL:*

17. List asm users with password:

ASMCMD> lspwusr
Username sysdba sysoper sysasm
     SYS   TRUE    TRUE   TRUE
 ASMSNMP   TRUE   FALSE  FALSE

18. List open files of a diskgroup:

— Open files of a diskgroup ( ARCH)

ASMCMD>lsof -G ARCH

19 . List open files related to a database

-- Open files of a database( DBACLASS)
ASMCMD>lsof --dbname DBACLASS

20. Check filter driver is enabled or not:

ASMCMD> afd_state
ASMCMD-9526: The AFD state is 'NOT INSTALLED' and filtering is 'DEFAULT' on host 'b20e4bay01'

filter driver disks:

21. List filter driver disks(if enabled)

ASMCMD> afd_lsdsk

22. Get filter driver asm diskstring

ASMCMD> afd_dsget
AFD discovery string:

 

Do let us know if you have any useful asmcmd commands in mind. I will include them in the list.

SEE ALSO: