In noninteractive mode, you run a single ASMCMD command by including the command and command options on the command line when invoking ASMCMD. ASMCMD runs the command, generates output if any, and then exits. The noninteractive mode is especially useful for running scripts.
On most operating systems, wildcard characters must be enclosed in quotes when running ASMCMD commands in noninteractive mode.
To run ASMCMD in noninteractive mode where command
is any valid ASMCMD command and options
is a list of command options, at the command prompt enter the following:
asmcmd
command
options
In noninteractive mode, ASMCMD returns the codes listed in Table 10-3.
Table 10-3 ASMCMD return codes
Type | Return Code | Description |
---|---|---|
General |
0 |
No issues for the command. |
General |
1 |
Internal error. |
General |
255 or -1 |
External user error as returned by a command. |
|
0 |
Results include member disks only. |
|
1 |
Results include candidate disks only. |
|
2 |
Results include both member and candidate disks. |
Example 10-2 shows how to run ASMCMD in the noninteractive mode. The first command runs the ls
command to list the disk groups for the Oracle ASM instance. The second command redirects the output of the lsod
command to the my_lsod_test
file. The third command runs lsdsk
using a pattern with a wildcard character to list specific disks in the data
disk group. Note that wildcard characters must be enclosed in quotes when running ASMCMD in noninteractive mode on most operating systems.
Example 10-3 raises an error with an incorrect disk group name and the return code equal (255) is displayed.
Example 10-4 shows an example of ASMCMD commands run in noninteractive mode inside a script.
Example 10-2 Running ASMCMD commands in noninteractive mode
$ asmcmd ls -l State Type Rebal Name MOUNTED NORMAL N DATA/ MOUNTED NORMAL N FRA/ $ asmcmd lsod --suppressheader -G data > my_lsod_test $ asmcmd lsdsk -G data '/devices/diska*' Path /devices/diska1 /devices/diska2 /devices/diska3