Skip Headers
Oracle® Database Utilities
10g Release 2 (10.2)

Part Number B14215-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

20 ASM Command-Line Utility (ASMCMD)

This chapter describes the Automatic Storage Management Command-Line Utility (ASMCMD). It contains the following topics:

About ASMCMD

ASMCMD is a command-line utility that you can use to easily view and manipulate files and directories within Automatic Storage Management (ASM) disk groups. It can list the contents of disk groups, perform searches, create and remove directories and aliases, display space utilization, and more.

Note:

You cannot use ASMCMD to create or drop disk groups or to add or drop disks in a disk group. For these operations, you must use SQL commands.

See Also:

Oracle Database Administrator's Guide for general information on Automatic Storage Management.

About ASM Files, Filenames, Directories, and Aliases

ASMCMD works with Automatic Storage Management (ASM) files, directories, and aliases. Before using ASMCMD, you must understand how these common computing concepts apply to the unique ASM environment. The following are some key definitions.

Note:

The forward slash (/) and backward slash (\) are interchangeable in filenames. Also, filenames are case insensitive, but case retentive.

System-generated filename or 'fully qualified filename'

Every file created in ASM gets a system-generated filename, otherwise known as a fully qualified filename. This is analogous to a complete path name in a local file system. An example of a fully qualified filename is the following:

+dgroup2/sample/controlfile/Current.256.541956473

ASM generates filenames according to the following scheme:

+diskGroupName/databaseName/fileType/fileTypeTag.file.incarnation 

In the previous fully qualified filename, dgroup2 is the disk group name, sample is the database name, controlfile is the file type, and so on.

See Oracle Database Administrator's Guide for more detailed information on fully qualified filenames.

Directory

As in other file systems, an ASM directory is a container for files, and it can be part of a tree structure of other directories.

The fully qualified filename in fact represents a hierarchy of directories, with the plus sign (+) as the root. In each disk group, ASM creates a directory hierarchy that corresponds to the structure of the fully qualified filenames in the disk group. The directories in this hierarchy are known as system-generated directories. ASMCMD enables you to move up and down this directory hierarchy with the cd (change directory) command. The ASMCMD ls (list directory) command lists the contents of the current directory, while the pwd command prints the name of the current directory.

When you start ASMCMD, the current directory is set to root (+). For an ASM instance with two disk groups, dgroup1 and dgroup2, entering an ls command with the root directory as the current directory produces the following output:

ASMCMD> ls
DGROUP1/
DGROUP2/

The following example demonstrates navigating the ASM directory tree (refer to the fully qualified filename shown previously):

ASMCMD> cd +dgroup1/sample/controlfile
ASMCMD> ls
Current.256.541956473
Current.257.541956475

You can also create your own directories as subdirectories of the system-generated directories. You do so with the ALTER DISKGROUP command or with the ASMCMD mkdir command. Your user-created directories can have subdirectories, and you can navigate the hierarchy of both system-generated directories and user-generated directories with the cd command. See Oracle Database Administrator's Guide for more information on ASM directories.

The following example creates the directory mydir in the disk group dgroup1:

ASMCMD> mkdir +dgroup1/mydir

(Note that the directory dgroup1 is a system-generated directory. Its contents represent the contents of the disk group dgroup1.)

If you start ASMCMD with the -p flag, ASMCMD always shows the current directory as part of its prompt.

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

Note:

ASM does not place system-generated files into your user-created directories; it places them only in system-generated directories. You add aliases (described next) or other directories to a user-created directory.

Alias

An alias is a filename that is a reference (or pointer) to a system-generated filename, but with a more user-friendly name. It is similar to a symbolic link in Unix operating systems. You create aliases to make it easier to work with ASM filenames. You can create an alias with an ALTER DISKGROUP command or with the mkalias ASMCMD command.

An alias has at a minimum the disk group name as part of its complete path. You can create aliases at the disk group level or in any system-generated or user-created subdirectory. The following are examples of aliases:

+dgroup1/ctl1.f
+dgroup1/sample/ctl1.f
+dgroup1/mydir/ctl1.f

If you run the ASMCMD ls (list directory) with the -l flag, each alias is listed with the system-generated file that it references.

ctl1.f => +dgroup2/sample/controlfile/Current.256.541956473

See Oracle Database Administrator's Guide for more information on aliases.

Absolute path and Relative path

When you run an ASMCMD command that takes a filename or directory name as an argument, you can supply the name as either an absolute path or a relative path.

An absolute path refers to the full path to a file or directory. An absolute path begins with a plus sign (+), followed by a disk group name, followed by subsequent directories in the directory tree until the file or directory of interest is reached. A complete system-generated filename (otherwise known as the fully qualified filename) is an example of an absolute path to a file.

Using an absolute path enables the command to access the file or directory regardless of where the current directory is set. The following rm command uses an absolute path for the filename:

ASMCMD [+DGROUP1/MYDIR] > rm +dgroup2/sample/datafile/users.259.555341963

The following command uses an absolute path to the directory.

ASMCMD [+DGROUP1/MYDIR] > cd +dgroup2/sample/controlfile

A relative path includes only the part of the filename or directory name that is not part of the current directory. That is, the path to the file or directory is relative to the current directory.

In the following example, the rm command operates on the file undotbs1.272.557429239, which in this case is a relative path. ASMCMD prepends the current directory to the command argument to obtain the absolute path to the file, which is +dgroup1/sample/datafile/undotbs1.272.557429239.

ASMCMD [+] > cd +dgroup1
ASMCMD [+DGROUP1] > cd sample/datafile
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls
EXAMPLE.269.555342243
SYSAUX.257.555341961
SYSTEM.256.555341961
UNDOTBS1.258.555341963
UNDOTBS1.272.557429239
USERS.259.555341963
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rm undotbs1.272.557429239

Paths to directories can also be relative. You can go up or down the hierarchy of the current directory tree branch by providing a directory argument to the cd (change directory) command whose path is relative to the current directory.

In addition, you can use the pseudo-directories "." and ".." in place of a directory name. The "." pseudo-directory is the current directory. The ".." psuedo-directory is the parent directory of the current directory.

The following example demonstrates using relative directory paths and pseudo-directories:

ASMCMD [+DGROUP1/SAMPLE] > cd datafile
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] >cd ..
ASMCMD [+DGROUP1/SAMPLE] >

Wildcard

The wildcard characters "*" and "%" match zero or more characters anywhere within an absolute or relative path. The two characters behave identically. The ASMCMD commands that accept wildcards are ls, du, rm, and find. The following examples illustrate the use of wildcards.

ASMCMD> ls +dgroup1/mydir1
ctl.f
data1.f
dummy.f

ASMCMD> ls +dgroup1/mydir1/d*
data1.f
dummy.f

ASMCMD> ls +group1/sample/*
+dgroup1/sample/CONTROLFILE/:
Current.260.555342185
Current.261.555342183
 
+dgroup1/sample/DATAFILE/:
EXAMPLE.269.555342243
SYSAUX.257.555341961
SYSTEM.256.555341961
UNDOTBS1.272.557429239
USERS.259.555341963
 
+dgroup1/sample/ONLINELOG/:
group_1.262.555342191
group_1.263.555342195
group_2.264.555342197
group_2.265.555342201
 
+dgroup1/sample/PARAMETERFILE/:
spfile.270.555342443
 
+dgroup1/sample/TEMPFILE/:
TEMP.268.555342229

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.

    See Oracle Database Administrator's Guide for information on 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. See Oracle Database Administrator's Guide for more information on setting environment variables.

    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

This section describes each individual ASMCMD command in detail. Table 20-1 provides a summary of all ASMCMD commands.

Table 20-1 Summary of ASM Commands

Command Description
cd Changes the current directory to the specified directory.
du Displays the total disk space occupied by ASM files in the specified ASM directory and all its subdirectories, recursively.
exit Exits ASMCMD.
find Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory.
help Displays the syntax and description of ASMCMD commands.
ls Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.
lsct Lists information about current ASM clients.
lsdg Lists all disk groups and their attributes.
mkalias Creates an alias for a system-generated filename.
mkdir Creates ASM directories.
pwd Displays the path of the current ASM directory.
rm Deletes the specified ASM files or directories.
rmalias Deletes the specified alias, retaining the file that the alias points to.

cd

Purpose

Changes the current directory to the specified directory.

Syntax and Description

cd dir

dir may be specified as either an absolute path or a relative path, including the pseudo-directories "." and "..".

Examples

ASMCMD [+DGROUP2/HR] > cd +dgroup1/sample
ASMCMD [+DGROUP1/SAMPLE] > cd datafile
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] >cd ..
ASMCMD [+DGROUP1/SAMPLE] >

du

Purpose

Displays the total space used for files in the specified directory and in the entire directory tree under it.

Syntax and Description

du [-H] dir

This command is similar to the du -s command in UNIX. If you do not specify dir, information about the current directory is displayed. dir can contain wildcard characters.

The following two values are displayed, both in units of MB.

Used_MB—This value does not take the mirroring into account. Mirror_used_MB—This value takes mirroring into account.

For example, if a normal redundancy disk group contains 100 MB of data, then assuming that each file in the disk group is 2-way mirrored, Used_MB is 100 MB and Mirror_used_MB is roughly 200 MB.

The -H flag suppresses column headings from the output.

Example

The following example shows disk space used in the SAMPLE directory in DGROUP1, including all directories below SAMPLE.

ASMCMD [+DGROUP1/SAMPLE] > du
Used_MB      Mirror_used_MB
   1251                2507

exit

Purpose

Exits ASMCMD and returns to the operating system command line prompt.

Syntax

exit

find

Purpose

Displays the absolute paths of all occurrences of the specified name (with wildcards) in a specified directory and its subdirectories.

Syntax and Description

find [-t type] dir name

This command searches the specified directory and all subdirectories below it in the directory tree for the supplied name. name can be a directory name or a filename, and can include wildcard characters. dir may also include wildcards. In the output of the command, directory names are suffixed with the slash character (/) to distinguish them from filenames.

You use the -t flag to find all the files of a particular type (specified as type). For example, you can search for control files by specifying type as CONTROLFILE. Valid values for type are the following:

CONTROLFILE
DATAFILE
ONLINELOG
ARCHIVELOG
TEMPFILE
BACKUPSET
DATAFILE
PARAMETERFILE
DATAGUARDCONFIG
FLASHBACK
CHANGETRACKING
DUMPSET
AUTOBACKUP
XTRANSPORT

Note:

These are the values from the type column of the V$ASM_FILE view.

Examples

The following example searches the dgroup1 disk group for files that begin with 'undo':

ASMCMD> find +dgroup1 undo*
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.258.555341963
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.272.557429239

The following example returns the absolute path of all the control files in the +dgroup1/sample directory.

ASMCMD> find -t CONTROLFILE +dgroup1/sample *
+dgroup1/sample/CONTROLFILE/Current.260.555342185
+dgroup1/sample/CONTROLFILE/Current.261.555342183

help

Purpose

Displays the syntax of a command and a description of the command parameters.

Syntax and Description

help [command]

If command is not specified, the help command displays a list of all the ASMCMD commands and general information about using the ASMCMD utility.

Example

help mkalias

ls

Purpose

Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.

Syntax and Description

ls [-lsdrtLaH] [name]

name can be a filename or directory name, including wildcard characters.

If name is a directory name, ASMCMD lists the contents of the directory, and, depending on flag settings, information about each directory member. Directories are listed with a trailing slash (/) to distinguish them from files.

If name is a filename, ASMCMD lists the file, and, depending on flag settings, information about the file. The file must be located in the current directory if the filename is specified with a relative path.

Command flags enable you to modify and customize the output of the command. The following table lists the flags and their descriptions.

Table 20-2 Flags for the ls command

Flag Description
(none) Displays only filenames and directory names.
-l Displays extended file information, including striping and redundancy attributes and whether the file was system-generated (indicated by Y under the SYS column) or user-created (as in the case of an alias, indicated by N under the SYS column). When used in the "ls -l +" command, displays extended disk group information. Note that not all possible file attributes or disk group attributes are included. To view the complete set of attributes for a file or a disk group, query the V$ASM_FILE and V$ASM_DISKGROUP views.
-s Displays file space information.
-d If the name argument is a directory, displays information about that directory, rather than the directory contents. Typically used with another flag, such as the -l flag.
-r Reverses the sort order of the listing.
-t Sorts the listing by timestamp (latest first) instead of by name.
-L If the name argument is an alias, displays information on the file that it references. Typically used with another flag, such as the -l flag.
-a For each listed file, displays the absolute path of the alias that references it, if any.
-H Suppresses column headings.

If you specify all flags, then the command shows a union of their attributes, with duplicates removed. If you enter ls +, then the command returns information on all disk groups, including whether or not they are mounted.

Examples

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls
EXAMPLE.269.555342243
SYSAUX.257.555341961
SYSTEM.256.555341961
UNDOTBS1.258.555341963
UNDOTBS1.272.557429239
USERS.259.555341963


ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -l
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    EXAMPLE.269.555342243
DATAFILE  MIRROR  COARSE   MAY 09 22:01:28  Y    SYSAUX.257.555341961
DATAFILE  MIRROR  COARSE   APR 19 19:16:24  Y    SYSTEM.256.555341961
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    USERS.259.555341963


ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -lt
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   MAY 09 22:01:28  Y    SYSAUX.257.555341961
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239
DATAFILE  MIRROR  COARSE   APR 19 19:16:24  Y    SYSTEM.256.555341961
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    USERS.259.555341963
DATAFILE  MIRROR  COARSE   APR 18 19:16:07  Y    EXAMPLE.269.555342243


ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -l undo*
Type      Redund  Striped  Time             Sys  Name
DATAFILE  MIRROR  COARSE   MAY 05 12:28:42  Y    UNDOTBS1.258.555341963
DATAFILE  MIRROR  COARSE   MAY 04 17:27:34  Y    UNDOTBS1.272.557429239


ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -s
Block_Size  Blocks      Bytes       Space  Name
      8192   12801  104865792   214958080  EXAMPLE.269.555342243
      8192   48641  398467072   802160640  SYSAUX.257.555341961
      8192   61441  503324672  1011875840  SYSTEM.256.555341961
      8192    6401   52436992   110100480  UNDOTBS1.258.555341963
      8192   12801  104865792   214958080  UNDOTBS1.272.557429239
      8192     641    5251072    12582912  USERS.259.555341963


ASMCMD [+DGROUP1] > ls +DGROUP1/SAMPLE
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilesample.ora


ASMCMD [+DGROUP1] > ls -l +DGROUP1/SAMPLE
Type  Redund  Striped  Time  Sys Name
                             Y   CONTROLFILE/
                             Y   DATAFILE/
                             Y   ONLINELOG/
                             Y   PARAMETERFILE/
                             Y   TEMPFILE/
                             N   spfilesample.ora=>
                              +DGROUP1/SAMPLE/PARAMETERFILE/spfile.270.555342443


ASMCMD [+DGROUP1] > ls -r +DGROUP1/SAMPLE
spfilesample.ora
TEMPFILE/
PARAMETERFILE/
ONLINELOG/
DATAFILE/
CONTROLFILE/


ASMCMD [+DGROUP1] > ls -lL example_df2.f
Type      Redund  Striped  Time          Sys  Name
DATAFILE  MIRROR  COARSE   APR 27 11:04  N    example_df2.f => +DGROUP1/SAMPLE/DATAFILE/EXAMPLE.271.556715087


ASMCMD [+DGROUP1] > ls -a +DGROUP1/SAMPLE/DATAFILE/EXAMPLE.271.556715087
+DGROUP1/example_df2.f => EXAMPLE.271.556715087


ASMCMD [+DGROUP1] > ls -lH +DGROUP1/SAMPLE/PARAMETERFILE
PARAMETERFILE  MIRROR  COARSE   MAY 04 21:48  Y    spfile.270.555342443


ASMCMD [+DGROUP1] > ls -l +
State    Type    Rebal  Unbal  Name
MOUNTED  NORMAL  N      N      DGROUP1/
MOUNTED  NORMAL  N      N      DGROUP2/
MOUNTED  EXTERN  N      N      DGROUP3/

lsct

Purpose

Lists information about current ASM clients. A client is a database that uses disk groups managed by the ASM instance that ASMCMD is currently connected to.

Syntax and Description

lsct [-H] [group]

If group is specified, information about only that disk group is displayed. The -H flag suppresses column headings.

Example

This example displays information about the client accessing the dgroup1 disk group.

ASMCMD [+] > lsct dgroup1
DB_Name   Status        Software_Version  Compatible_version  Instance_Name
sample    CONNECTED           10.2.0.0.0          10.2.0.0.0  sample

lsdg

Purpose

Lists all disk groups and their attributes.

Syntax and Description

lsdg [-H] [group]

Table 20-3 shows the attributes listed for each disk group.

Table 20-3 Attribute descriptions for lsdg command output

Attribute Name Description
State Mounted/connected state of the disk group
Type Disk group redundancy (NORMAL, HIGH, EXTERNAL)
Rebal Y if a rebalance operation is in progress
Unbal Y if the disk group is in need of rebalancing
Sector Sector size in bytes
Block Block size in bytes
AU Allocation Unit size in bytes
Total_MB Size of the disk group in MB
Free_MB Free space in the disk group in MB, without regard to redundancy. From the V$ASM_DISKGROUP view.
Req_mir_free_MB Amount of space that must be available in the disk group to restore full redundancy after the worst failure that can be tolerated by the disk group. This is the REQUIRED_MIRROR_FREE_MB column from the V$ASM_DISKGROUP view.
Usable_file_MB Amount of free space, adjusted for mirroring, that is available for new files. From the V$ASM_DISKGROUP view.
Offline_disks Number of offline disks in the disk group. Offline disks are eventually dropped.
Name Disk group name

See Oracle Database Administrator's Guide for more information on the attributes that are designated in Table 20-3 as being from the V$ASM_DISKGROUP view.

If group is specified, information about only that disk group is listed. The -H flag suppresses column headings.

Example

The following example lists the attributes of the dgroup2 disk group.

ASMCMD [+] > lsdg dgroup2
State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB
Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  NORMAL  N      N         512   4096  1048576      4096     1208
           1024              92              0  DGROUP2/

mkalias

Purpose

Creates an alias for the specified system-generated filename.

Syntax and Description

mkalias file alias

alias must be in the same disk group as the system-generated file. Only one alias is permitted for each ASM file.

Note:

The SQL*Plus equivalent of the mkalias command is:
ALTER DISKGROUP dg_name ADD ALIAS user_alias FOR file

Example

The following example creates the sysaux.f alias for the fully qualified filename +DGROUP1/SAMPLE/DATAFILE/SYSAUX.257.555341961.

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > mkalias SYSAUX.257.555341961 sysaux.f
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls -a
none => EXAMPLE.269.555342243
+DGROUP1/SAMPLE/DATAFILE/sysaux.f => SYSAUX.257.555341961
none => SYSTEM.256.555341961
none => UNDOTBS1.258.555341963
none => UNDOTBS1.272.557429239
none => USERS.259.555341963
sysaux.f

mkdir

Purpose

Creates ASM directories under the current directory.

Syntax and Description

mkdir dir [dir] . . .

The current directory can be a system-created or user-created directory. You cannot create a directory at the root (+) level.

Note:

The SQL*PLUS equivalent of the mkdir command is ALTER DISKGROUP dg_name ADD DIRECTORY dir, dir . . .

Example

The following example creates the directories subdir1 and subdir2 at the disk group level in the disk group dgroup1.

ASMCMD [+DGROUP1] > mkdir subdir1 subdir2
ASMCMD [+DGROUP1] > ls
SAMPLE/
example_df2.f
subdir1/
subdir2/

pwd

Purpose

Displays the absolute path of the current directory.

Syntax and Description

pwd

Example

ASMCMD> pwd
+dgroup1/sample/controlfile

rm

Purpose

Deletes the specified ASM files and directories.

Syntax and Description

rm [-rf] name [name] . . .

If name is a file or alias, rm can delete it only if it is not currently in use by a client database. If name is a directory, rm can delete it only if it is empty (unless the -r flag is used) and it is not a system-generated directory. If name is an alias, rm deletes both the alias and the file that the alias references. (To delete just an alias and retain the file that the alias references, use the rmalias command.)

Note:

The SQL*Plus equivalents of the rm command are:
ALTER DISKGROUP ... DROP FILE
ALTER DISKGROUP ... DROP DIRECTORY

If you use a wildcard, rm deletes all matches except non-empty directories (unless the -r flag is used).

To recursively delete, use the -r flag. This enables you to delete a non-empty directory, including all files and directories in it and in the entire directory tree underneath it.

If you use the -r flag or a wildcard character, rm prompts you to confirm deletion before proceeding, unless you specify the -f flag.If a wildcard character matches an alias or a system-generated file that has an alias, both the alias and the system-generated file that it references are deleted. When using the -r flag, either the system-generated file or the alias needs to be present in the directory in which you run the rm command.

For example, if you have a user alias, +dg1/dir1/file.alias that points to +dg/ORCL/DATAFILE/System.256.146589651, then running the rm -r +dg1/dir1 command will remove +dg1/dir1/file.alias as well as +dg/ORCL/DATAFILE/System.256.146589651.

Example

The following example deletes the alias alias293.f.

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rm alias293.f

rmalias

Purpose

Deletes the specified aliases, retaining the files that the aliases reference.

Syntax and Description

rmalias [-r] alias [alias] . . .

Note:

The SQL*Plus equivalent of the rmalias command is:
ALTER DISKGROUP dg_name DROP ALIAS user_alias

To recursively delete, use the -r flag. This enables you to delete all aliases in the current directory and in the entire directory tree beneath the current directory. If any user-created directories become empty as a result of deleting aliases, they are deleted also. System-created files and directories are not deleted.

Example

The following example deletes the alias sysaux.f, retaining the datafile that it references.

ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rmalias sysaux.f