Sunday, April 1, 2012

How to check a file size within asmcmd

If you ever work with asmcmd command line interface you might want to know file size of a particular file. The command du displays the total space used for files in the specified directory and in the entire directory tree under the directory. For example,
ASMCMD> du
Used_MB      Mirror_used_MB
4210456             4210456
We can specify a directory name with du comamnd in order to check disk usage for a particular directory. If you do not specify directory, then information about the current directory is displayed. dir can contain wildcard characters. The following two values are displayed, both in units of megabytes. Used_MB - This value does not include mirroring. Mirror_used_MB - This value includes mirroring. For example, if a normal redundancy disk group contains 100 MB of data and each file in the disk group is 2-way mirrored, then Used_MB is 100 MB and Mirror_used_MB is roughly 200 MB.
ASMCMD> du BDAFISDC/
Used_MB      Mirror_used_MB
     31                  31
But by du command we are not able to check size of a particular file. In order to see size for a particular file, we need to use ls -s command. For example:
ASMCMD> ls -s bddipdcforstandbyl2n6hv3s_1_1
Block_Size    Blocks         Bytes         Space  Name
                                                  bddipdcforstandbyl2n6hv3s_1_1                                                                                         => +DATA/ASM/BACKUPSET/bddipdcforstandbyl2n6hv3s_1_1.612.779205591
Note that, here we have used relative path and so bytes value is blank. Oracle is horrible! We have to use absolute path with ls -s command to check the actual size occupied by a file in ASM file system.
ASMCMD> ls -s +DATA/ASM/BACKUPSET/bddipdcforstandbyl2n6hv3s_1_1.612.779205591
Block_Size    Blocks         Bytes         Space  Name
      8192  24372861  199662477312  199664599040  bddipdcforstandbyl2n6hv3s_1_1.612.779205591

No comments: