Running ASMCMD Utility

ASMCMD utility can be run in interactive and non-interactive mode. We need certain preparations before running ASMCMD utility.

Preparation before running ASMCMD utility :

Check the following before running the ASMCMD utility.

1) Check that ASM instance is started and disk groups are mounted.
2) Loginto host in which ASM instance is running.We must login as an user with SYSASM orSYSDBA system privileges through Operating system(OS) authentication.SYSASM is the preferred connection privilege.

3) Set the ORACLE_HOME and ORACLE_SID variables to refer to the ASM instance.
4) Set the operating system variables correctly to connect to the ASM instance.
5) The default value of ASM SID in a single instance database is +ASM.In case of a oracle RAC environment the value of ASM SID is +ASMnode#
6) Ensure that PATH variable is set properly.Issue echo $PATH command to check if bin directory of the ORACLE_HOME is in $PATH.

Running ASMCMD in Interactive-mode :

The interactive mode of the ASMCMD utility provides a shell-like environment where we are prompted to enter ASMCMD commands.

1. Enter the following at the operating system command prompt:
asmcmd
Oracle displays an ASMCMD command prompt as follows:
ASMCMD>
2. Enter an ASMCMD command and press Enter. The command runs and displays its output, if any, and then ASMCMD prompts for the next command.
3. Continue entering ASMCMD commands. Enter the command exit to exit ASMCMD.

We can specify the -v option when starting asmcmd to displays the asmcmd version number. After displaying the version number, asmcmd immediately exits.

$ asmcmd -v
asmcmd version 11.1.0.3.0


We can specify the -a option to choose the type of connection, either SYSASM or SYSDBA. The default value is SYSASM.

$ asmcmd -a sysasm

Running ASMCMD in Non-interactive Mode:

This mode is useful is automating the process using scripts. The format is asmcmd (command) (option),where command is the ASMCMD command to be run and option is the option with which the command has to be run.

For example asmcmd ls -l invokes asmcmd in non-interactive mode and lists the files in current directory along with its alias.