Translate

Monday, 10 October 2011

Oracle ASM Commands

Running ASMCMD

You can run the ASMCMD utility in either interactive or noninteractive mode. Before running ASMCMD, you must ensure that you are logged in properly and that your environment is properly configured.

Preparing to Run ASMCMD

To prepare to run ASMCMD:

•Ensure that the ASM instance is started and the ASM disk groups are mounted. (You cannot use ASMCMD to mount disk groups.)

•Log in to the host that is running the ASM instance that you want to work with. You must log in as a user that has SYSDBA privileges through operating system authentication.

•Set the ORACLE_HOME and ORACLE_SID environment variables to select the ASM instance. Depending on your operating system, you may have to set other environment variables to properly connect to the ASM instance.

• The default value of the ASM SID for a single instance database is +ASM. On a Real Application Clusters system, the default value of the ASM SID on any node is+ASMnode#.

•Ensure that bin subdirectory of your Oracle home is in your PATH environment variable.

Running ASMCMD in Interactive Mode

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

To run ASMCMD in interactive mode:

1.At the operating system command prompt, enter:

asmcmd

An ASMCMD command prompt is displayed.
ASMCMD>

2.Enter an ASMCMD command and press the Enter key.

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.

Including the Current Directory in the ASMCMD Prompt
You can specify the -p option with the asmcmd command to include the current directory in the ASMCMD prompt, as shown in the following example:

% asmcmd -p

ASMCMD [+] > cd dgroup1/mydir
ASMCMD [+DGROUP1/MYDIR] >

Running ASMCMD in Noninteractive Mode

In noninteractive mode, you run a single ASMCMD command by including the command and command arguments on the command line that invokes ASMCMD. ASMCMD runs the command, generates output if any, and then exits. The noninteractive mode is especially useful for running scripts.

To run ASMCMD in noninteractive mode:

•At the command prompt, enter:
asmcmd command arguments
where:
command is any valid ASMCMD command. arguments is a list of command flags and arguments.
The following example demonstrates running ASMCMD in the noninteractive mode.
% asmcmd ls -l
State Type Rebal Unbal Name
MOUNTED NORMAL N N DGROUP1/
MOUNTED NORMAL N N DGROUP2/
%
Getting Help
Type help at the ASMCMD prompt or as a command in noninteractive mode to view general ASMCMD help and a list of available commands.
ASMCMD Command Reference

No comments:

Post a Comment