ASMCMD HANDY COMMANDS

ASM has wide variety of manipulation commands to have full control using ASMCMD which is a command line tool

Type help to the list of commands used in asmcmd

ASMCMD [+] > help
asmcmd
        Starts asmcmd or executes the command

Synopsis
        asmcmd [-V] [--nocp] [-v {errors | warnings | normal | info | debug} ] [--privilege {sysasm | sysdba} ] [-p] [--inst <instance_name>] [--discover][<command>]
        chtmpl, lstmpl, mktmpl, rmtmpl

        chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
        mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr, rpusr

        volcreate, voldelete, voldisable, volenable, volinfo
        volresize, volset, volstat

Check ASMCMD version

[grid@orcl ~]$ asmcmd -V
asmcmd version 12.1.0.2.0

Check ASMCMD parent directory

[grid@orcl ~]$ asmcmd -p
ASMCMD [+] > cd DATA
ASMCMD [+DATA] >

To check all diskgroups in ASM

ASMCMD [+DATA] > lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      3067     3005                0            3005              0             N  CRS/
MOUNTED  EXTERN  N         512   4096  1048576     15311     3738                0            3738              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     15311     9674                0            9674              0             N  FRA/


#to check specific diskgroup status

ASMCMD [+DATA] > lsdg DATA
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     15311     3738                0            3738              0             N  DATA/

#to check asm discovery 
ASMCMD [+DATA] > lsdg --discovery
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      3067     3005                0            3005              0             N  CRS/
MOUNTED  EXTERN  N         512   4096  1048576     15311     3738                0            3738              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     15311     9674                0            9674              0             N  FRA/

To check the total occupied filesize in a directory

ASMCMD [+DATA/ORCL] > du
Used_MB      Mirror_used_MB
  11512               11512

To find any file reside in ASM

ASMCMD [+DATA/ORCL] > find + sp*
+DATA/ASM/PARAMETERFILE/spfileorcl.ora.271.1031777365
+DATA/ORCL/PARAMETERFILE/spfile.266.1031502791
+DATA/ORCL/spfileorcl.ora

To change directory path in ASM

#to go to next directory
ASMCMD [+DATA] > cd ASM

#to go back to previous directory
ASMCMD [+DATA/ASM] > cd ../..

To list the disks in ASM

ASMCMD [+DATA] > lsdsk -k
Total_MB  Free_MB  OS_MB  Name       Failgroup  Failgroup_Type  Library  Label  UDID  Product  Redund   Path
    3067     3005   3067  CRS_0000   CRS_0000   REGULAR         System                         UNKNOWN  /dev/oracleasm/disks/CRS
   15311     3738  15311  DATA_0000  DATA_0000  REGULAR         System                         UNKNOWN  /dev/oracleasm/disks/DATA
   15311     9674  15311  FRA_0000   FRA_0000   REGULAR         System                         UNKNOWN  /dev/oracleasm/disks/FRA


ASMCMD [+DATA] > lsdsk -k -G DATA
Total_MB  Free_MB  OS_MB  Name       Failgroup  Failgroup_Type  Library  Label  UDID  Product  Redund   Path
   15311     3738  15311  DATA_0000  DATA_0000  REGULAR         System                         UNKNOWN  /dev/oracleasm/disks/DATA

To check the files used by processes currently

ASMCMD [+DATA/ORCL] > lsof
DB_Name  Instance_Name  Path
orcl     orcl           +DATA/ORCL/CONTROLFILE/current.260.1031501949
orcl     orcl           +DATA/ORCL/DATAFILE/example.265.1031501993
orcl     orcl           +DATA/ORCL/DATAFILE/sysaux.256.1031501729
orcl     orcl           +DATA/ORCL/DATAFILE/system.257.1031501823
orcl     orcl           +DATA/ORCL/DATAFILE/system.265
orcl     orcl           +DATA/ORCL/DATAFILE/undotbs1.259.1031501899
orcl     orcl           +DATA/ORCL/DATAFILE/users.272.1040745563
orcl     orcl           +DATA/ORCL/DATAFILE/users.274.1040915137
orcl     orcl           +DATA/ORCL/ONLINELOG/group_1.261.1031501951
orcl     orcl           +DATA/ORCL/ONLINELOG/group_2.262.1031501957
orcl     orcl           +DATA/ORCL/ONLINELOG/group_3.263.1031501965
orcl     orcl           +DATA/ORCL/TEMPFILE/temp.264.1031501981
orcl     orcl           +DATA/ORCL/users.new
orcl     orcl           +FRA/ORCL/CONTROLFILE/current.256.1031501949
orcl     orcl           +FRA/ORCL/FLASHBACK/log_20.372.1074184217
orcl     orcl           +FRA/ORCL/ONLINELOG/group_1.257.1031501953
orcl     orcl           +FRA/ORCL/ONLINELOG/group_2.258.1031501961
orcl     orcl           +FRA/ORCL/ONLINELOG/group_3.259.1031501967

To list the ASM background process with respect to disk

ASMCMD [+] > lsod
Instance Process                 OSPID Path
1        oracle@orcl (DBW0)      5949  /dev/oracleasm/disks/CRS
1        oracle@orcl (DBW0)      5949  /dev/oracleasm/disks/DATA
1        oracle@orcl (DBW0)      5949  /dev/oracleasm/disks/FRA
1        oracle@orcl (GMON)      5963  /dev/oracleasm/disks/CRS
1        oracle@orcl (GMON)      5963  /dev/oracleasm/disks/DATA
1        oracle@orcl (GMON)      5963  /dev/oracleasm/disks/FRA
1        oracle@orcl (LGWR)      5951  /dev/oracleasm/disks/CRS
1        oracle@orcl (LGWR)      5951  /dev/oracleasm/disks/DATA
1        oracle@orcl (LGWR)      5951  /dev/oracleasm/disks/FRA
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/CRS
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/CRS
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/DATA
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/DATA
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/FRA
1        oracle@orcl (RBAL)      5961  /dev/oracleasm/disks/FRA
1        oracle@orcl (TNS V1-V3) 22188 /dev/oracleasm/disks/CRS
1        oracle@orcl (TNS V1-V3) 22188 /dev/oracleasm/disks/DATA
1        oracle@orcl (TNS V1-V3) 6003  /dev/oracleasm/disks/DATA
1        oracle@orcl (TNS V1-V3) 7988  /dev/oracleasm/disks/DATA
1        oracle@orcl (TNS V1-V3) 22188 /dev/oracleasm/disks/FRA
1        oracle@orcl (TNS V1-V3) 6056  /dev/oracleasm/disks/FRA
1        oracle@orcl (TNS V1-V3) 6803  /dev/oracleasm/disks/FRA
1        oracle@orcl (TNS V1-V3) 7988  /dev/oracleasm/disks/FRA

To check the IOPS statistics with respect to each diskgroup

ASMCMD [+DATA] > iostat
Group_Name  Dsk_Name   Reads       Writes
CRS         CRS_0000   770048      45031424
DATA        DATA_0000  3899528192  703717376
FRA         FRA_0000   139511808   871506432

ASMCMD [+DATA] > iostat -G DATA
Group_Name  Dsk_Name   Reads       Writes
DATA        DATA_0000  3903112192  704871424

ASMCMD [+DATA] > iostat -e
Group_Name  Dsk_Name   Reads       Writes     Read_Err  Write_Err
CRS         CRS_0000   774144      45174784   0         0
DATA        DATA_0000  3905848320  705550848  0         0
FRA         FRA_0000   139794432   873151488  0         0


ASMCMD [+DATA] > iostat -e -t
Group_Name  Dsk_Name   Reads       Writes     Read_Err  Write_Err  Read_Time    Write_Time
CRS         CRS_0000   774144      45281280   0         0          334.442789   32978.196292
DATA        DATA_0000  3910714368  706893824  0         0          1260.296551  33436.794744
FRA         FRA_0000   140040192   874494464  0         0          347.646019   33490.751353

To check the rdbms and grid details with respect to diskgroup

ASMCMD [+] > lsct DATA
DB_Name  Status     Software_Version  Compatible_version  Instance_Name  Disk_Group
+ASM     CONNECTED        12.1.0.2.0          12.1.0.2.0  +ASM           DATA
orcl     CONNECTED        12.1.0.2.0          12.1.0.2.0  orcl           DATA

To get the spfile location in ASM

ASMCMD [+DATA] > spget
+CRS/ASM/ASMPARAMETERFILE/registry.253.1031499741

To list the files in ASM

ASMCMD [+DATA] > ls
ASM/
ORCL/

ASMCMD [+DATA] > ls -l
Type  Redund  Striped  Time             Sys  Name
                                        Y    ASM/
                                        Y    ORCL/

ASMCMD [+DATA/ORCL] > ls --permission
User  Group  Permission  Name
                         CONTROLFILE/
                         DATAFILE/
                         ONLINELOG/
                         PARAMETERFILE/
                         TEMPFILE/
              rw-rw-rw-  spfileorcl.ora => +DATA/ASM/PARAMETERFILE/spfileorcl.ora.271.1031777365
              rw-rw-rw-  users.new => +DATA/ORCL/DATAFILE/USERS.275.1040918051

To check count of number of files in ASM

ASMCMD [+] > lstmpl
Group_Name  Group_Num  Name
CRS         1          ARCHIVELOG
CRS         1          ASMPARAMETERFILE
CRS         1          AUDIT_SPILLFILES
CRS         1          AUTOBACKUP
CRS         1          AUTOLOGIN_KEY_STORE
CRS         1          BACKUPSET
CRS         1          CHANGETRACKING
CRS         1          CONTROLFILE
CRS         1          DATAFILE
CRS         1          DATAGUARDCONFIG
CRS         1          DUMPSET
CRS         1          FLASHBACK
CRS         1          FLASHFILE
CRS         1          INCR XTRANSPORT BACKUPSET
CRS         1          KEY_STORE
CRS         1          OCRFILE
CRS         1          ONLINELOG
CRS         1          PARAMETERFILE
CRS         1          TEMPFILE
CRS         1          VOTINGFILE
CRS         1          XTRANSPORT
CRS         1          XTRANSPORT BACKUPSET
DATA        2          ARCHIVELOG
DATA        2          ASMPARAMETERFILE
DATA        2          AUDIT_SPILLFILES
DATA        2          AUTOBACKUP
DATA        2          AUTOLOGIN_KEY_STORE
DATA        2          BACKUPSET
DATA        2          CHANGETRACKING
DATA        2          CONTROLFILE
DATA        2          DATAFILE
DATA        2          DATAGUARDCONFIG
DATA        2          DUMPSET
DATA        2          FLASHBACK
DATA        2          FLASHFILE
DATA        2          INCR XTRANSPORT BACKUPSET
DATA        2          KEY_STORE
DATA        2          OCRFILE
DATA        2          ONLINELOG
DATA        2          PARAMETERFILE
DATA        2          TEMPFILE
DATA        2          VOTINGFILE
DATA        2          XTRANSPORT
DATA        2          XTRANSPORT BACKUPSET
FRA         3          ARCHIVELOG
FRA         3          ASMPARAMETERFILE
FRA         3          AUDIT_SPILLFILES
FRA         3          AUTOBACKUP
FRA         3          AUTOLOGIN_KEY_STORE
FRA         3          BACKUPSET
FRA         3          CHANGETRACKING
FRA         3          CONTROLFILE
FRA         3          DATAFILE
FRA         3          DATAGUARDCONFIG
FRA         3          DUMPSET
FRA         3          FLASHBACK
FRA         3          FLASHFILE
FRA         3          INCR XTRANSPORT BACKUPSET
FRA         3          KEY_STORE
FRA         3          OCRFILE
FRA         3          ONLINELOG
FRA         3          PARAMETERFILE
FRA         3          TEMPFILE
FRA         3          VOTINGFILE
FRA         3          XTRANSPORT
FRA         3          XTRANSPORT BACKUPSET

To check the audit config parameters

ASMCMD [+] > lsaudconfigparams
Type   Parameter Name             Parameter Value
       AUDIT FILE MAX SIZE        10000
       AUDIT FILE MAX SIZE        10000
       AUDIT FILE MAX AGE         5
       AUDIT FILE MAX AGE         5
       AUDIT_TRAIL_WRITE_MODE     QUEUED WRITE MODE
       AUDIT_TRAIL_WRITE_MODE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s