ASMCMD File Management Commands
This topic provides a summary of the ASMCMD file management commands.
Table 10-44 lists the ASMCMD file management commands with brief descriptions.
Table 10-44 Summary of ASMCMD file management commands
Command | Description |
---|---|
Extracts a file from a disk group. |
|
Changes the current directory to the specified directory. |
|
Enables you to copy files between disk groups, and between a disk group and the operating system. |
|
Displays the total disk space occupied by files in the specified Oracle ASM directory and all of its subdirectories, recursively. |
|
Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory. |
|
Copies an Oracle KEYSTORE file from the source location to the destination location. |
|
Lists the contents of an Oracle ASM directory, the attributes of the specified file, or the names and attributes of all disk groups. |
|
Creates an alias for system-generated file names. |
|
Creates Oracle ASM directories. |
|
Displays the path of the current Oracle ASM directory. |
|
Deletes the specified Oracle ASM files or directories. |
|
Deletes the specified alias, retaining the file that the alias points to. |
amdu_extract
Purpose
Extracts a file from a disk group.
Syntax and Description
amdu_extract diskgroup [--sys_filename] file_name disk_string
Table 10-45 Options for the amdu_extract command
Option | Description |
---|---|
|
Name of the disk group where the file is located. |
|
If this option is specified, then the |
|
Name of the file to extract. The file name must be one of the following:
The file name can be specified as an absolute or a relative path. |
|
Value for the Oracle ASM discovery disk string. |
amdu_extract
calls the Oracle ASM Metadata Dump Utility (AMDU) command to extract a file using an Oracle ASM alias name.
Example
The following is an example of the amdu_extract
command used to extract a file from the data disk group.
Example 10-49 Using the ASMCMD amdu_extract command
ASMCMD> amdu_extract data data/orcl/my_alias_filename /devices/disk*
cd
Purpose
Changes the current directory to the specified directory.
Syntax and Description
cd [dir]
Table 10-46 lists the options for the cd
command.
Table 10-46 Options for the cd command
Option | Description |
---|---|
|
Name of the directory. |
dir
can be specified as either an absolute path or a relative path, including the .
and ..
pseudo-directories. dir
can contain wildcard characters. See "Wildcard Characters".
Examples
The following are examples of the cd
command changing into various directories.
Example 10-50 Using the ASMCMD cd command
ASMCMD [+data/hr] > cd +data/orcl ASMCMD [+data/orcl] > cd DATAFILE ASMCMD [+data/orcl/DATAFILE] >cd ..
cp
Purpose
Enables you to copy files between Oracle ASM disk groups and between a disk group and the operating system.
Syntax and Description
cp [connect_str:]src_file [--target target_type] [--service service_name] [--port port_num] [--dest_dbname dbname] [--sparse] [--sparse_merge_begin] [connect_str:]tgt_file [--sparse_merge_end sparse_merge_end_file] [--local] [--pdbguid pdbguid]
The following table contains the syntax options for the cp
command.
Table 10-47 Options for the cp command
Option | Description |
---|---|
|
Only used if target file is in a disk group.
Specified name will be used as the root directory instead of
using the default (either ASM, IOS, or APX, depending which
target was specified). If this option is used, the system alias
root path will be
|
|
Indicates that it is a sparse copy of a file. |
|
Beginning depth of a sparse file to be merged. |
|
Ending depth of a sparse file to be merged. |
|
Copy from/to the local file system to the ASM disk group when ASMCMD is running in a different node than the ASM instance. Not to be used to copy a file from one diskgroup to another, or when source and target file paths are both OS file systems. |
|
Only used if target file is in a disk group.
Specified PDB will be used as the directory for destination file
system alias. If this option is used, the system alias root path
will be:
|
|
Specifies the target type of the instance that
ASMCMD must be connected to for the copy operation. Valid
options are |
|
Specifies the Oracle ASM instance name if not the default +ASM. |
|
Specifies the listener port number. The default is 1521. |
|
Specifies the connection string for a remote instance. |
|
Name of the source file to copy. |
|
A user alias for the created target file name or an alias directory name. |
cp
cannot copy files between two remote instances. The local Oracle ASM instance must be either the source or the target of the operation.
You can use the cp
command to:
-
Copy files from a disk group to the operating system
-
Copy files from a disk group to a disk group
-
Copy files from the operating system to a disk group
Some file types cannot be the source or destination of the cp command. These file
types include the OCR, SPFILE, Password file, and Oracle Keystore file types. To
back up, copy, or move an Oracle ASM SPFILE, use the spbackup
,
spcopy
, or spmove
commands. To create, copy,
or move a Password file, use the pwcreate
, pwcopy
,
or pwmove
commands. To copy an OCR backup file type, the source
must be from a disk group. To copy an Oracle Keystore file use the
kscopy
command.
The format of copied files is portable between Little-Endian and Big-Endian systems if the files exist in an Oracle ASM disk group. Oracle ASM automatically converts the format when the files are written. For copying a non-Oracle ASM file from or to an Oracle ASM disk group, you can copy the file to a different endian platform and then use one of the commonly used utilities to convert the file.
connect_str
is not required for a local instance copy, which is the default case. For a remote instance copy, you must specify the connect string and Oracle ASM prompts for a password in a non-echoing prompt. The connect_str
is in the form:
user
@
host
.
SID
user
, host
, and SID
are required in the connect_str
parameter. The default port number is 1521
and can be changed with the --port
option.
The connection privilege (SYSASM
or SYSDBA
) is determined by the use of the --privilege
option when starting ASMCMD.
src_file
must be either a fully qualified file name or an Oracle ASM alias.
During an ASMCMD copy process, the Oracle ASM server creates an Oracle Managed File (OMF) file in the following format:
diskgroup
/
db_unique_name
/
file_type
/
file_name
.
#
.
#
where db_uniq_name
is set to ASM
and #
is a string of digits. In the copy process, ASMCMD cp
creates the directory structure for the destination and creates a user alias from that location to the actual OMF file that is created.
Examples
The following are examples of the cp
command. The first example
shows a copy of a file in the data disk group to a file on the operating system. The
second example shows a copy of a file on the operating system to the data disk
group. The third example shows how to copy a file in the data disk group to a remote
server. You are prompted to enter a password. The fourth example shows how to copy a
file in the data disk group to a remote server (operating system file) providing a
password. The fifth example shows a copy of several files in the data disk group to
a directory on the operating system. The sixth example shows a copy of a file on the
operating system to the data disk group. The --dest_dbname
option
was used, so the system alias for the copied file will be stored under
+DATA/DB1/DATAFILE
instead of using the default
+DATA/ASM/DATAFILE
. The seventh example shows how to copy a
remote operating system file to the data disk group. The eight example shows how to
copy a remote operating system file to the data disk group when listener port is not
the default. The ninth example shows how to make a sparse copy of a file between
sparse disk groups. The tenth example shows how to make a sparse copy of multiple
sparse files.
Sparse merge: Consider a multi-level sparse file hierarchy having sparse files
SPARSE.205.14770227--SPARSE.241.14770227--SPARSE.257.71740127--SPARSE.259.91640227
where SPARSE.205.14770227
is the base parent and
SPARSE.241.14770227
is the parent of
SPARSE.257.71740127
, which in turn is the parent of
SPARSE.259.91640227
.
The eleventh example shows how to merge multiple sparse files into a new destination file (out-of-place merge). The twelfth example shows how to merge multiple sparse files into an existing sparse file (in-place merge). The thirteenth example shows how to copy from the local operating system to an ASM disk group when there is no ASM instance in the same node as where ASMCMD is running. The fourteenth example shows how to do the reverse of the previous example, which is copying a file from an ASM disk group to an operating system file when there is no ASM instance running in the same node as where ASMCMD resides. The fifteenth example shows how to specify the PDB GUID directory for the target file system alias.
Example 10-51 Using the ASMCMD cp command
ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 /mybackups/example.bak
copying +data/orcl/datafile/EXAMPLE.265.691577295 -> /mybackups/example.bak
ASMCMD [+] > cp /mybackups/examples.bak +data/orcl/datafile/myexamples.bak
copying /mybackups/examples.bak -> +data/orcl/datafile/myexamples.bak
ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 sys@myserver.+ASM:/scratch/backup/myexamples.bak
Enter Password:
ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 sys/passwd@server.asminstance:/scratch/file
copying +data/orcl/datafile/EXAMPLE.265.691577295 -> /scratch/file
ASMCMD [+] > cp +data/orcl/data*/orcl* /mybackups
copying +data/orcl/DATAFILE/ORCLTABLES.273.924621557 -> /mybackups/ORCLTABLES.273.924621557
copying +data/orcl/DATAFILE/ORCLTABLES.274.924621557 -> /mybackups/ORCLTABLES.274.924621557
copying +data/orcl/DATAFILE/ORCLTABLES.275.924621557 -> /mybackups/ORCLTABLES.275.924621557
ASMCMD [+] > cp /mybackups/examples.bak +data/orcl/datafile/myexamples.bak --dest_dbname DB1
copying /mybackups/examples.bak -> +data/orcl/datafile/myexamples.bak
ASMCMD [+] > cp sys@server.SID:/scratch/file +data/orcl/datafile/file
copying /scratch/file -> +data/orcl/datafile/file
ASMCMD [+] > cp --port 2500 sys@server.SID:/scratch/file +data/orcl/datafile/file
copying /scratch/file -> +data/orcl/datafile/file
ASMCMD [+] > cp --sparse +SPARSEDG/SPARSE.259.91640227 +SPARSEDG/sparsefile/sparse_cp
copying +SPARSEDG/SPARSE.259.91640227 -> +SPARSEDG/sparsefile/sparse_cp
ASMCMD [+] > cp --sparse +SPARSEDG/sparse_alias.1 +SPARSEDG/sparse_alias.2 +SPARSEDG/dir/sp_alias.3 +SPARSEDG/sparsedir/
copying +SPARSEDG/sparse_alias.1 -> +SPARSEDG/sparsedir/sparse_alias.1
copying +SPARSEDG/sparse_alias.2 -> +SPARSEDG/sparsedir/sparse_alias.2
copying +SPARSEDG/dir/sp_alias.3 -> +SPARSEDG/sparsedir/sp_alias.3
ASMCMD [+] > cp --sparse_merge_begin +SPARSEDG/SPARSE.259.91640227 +SPARSEDG/sparsefile/sparse_merge --sparse_merge_end +SPARSEDG/SPARSE.205.14770227
merging +SPARSEDG/SPARSE.259.91640227 through +SPARSEDG/SPARSE.205.14770227 to +SPARSEDG/sparsefile/sparse_merge
ASMCMD [+] > cp --sparse_merge_begin +SPARSEDG/SPARSE.259.91640227 +SPARSEDG/SPARSE.259.91640227 --sparse_merge_end +SPARSEDG/SPARSE.241.14770227
merging +SPARSEDG/SPARSE.259.91640227 through +SPARSEDG/SPARSE.241.14770227 to +SPARSEDG/SPARSE.259.91640227
ASMCMD [+] > cp --local /mybackups/backup.bak +data/backup_dir/backup.bak
copying /mybackups/backup.bak -> +data/backup_dir/backup.bak
ASMCMD [+] > cp --local +data/hm/datafile/EXAMPLE.265.691577295 /mybackups/backup.bak
copying +data/hm/datafile/EXAMPLE.265.691577295 -> /mybackups/backup.bak
ASMCMD [+] > cp /tmp/f1.df +data/f1.df --pdbguid ABCDEFGHIJKLM1234567890
copying /tmp/f1.df -> +data/f1.df
NOTE: cp command can be used to copy files from ASM disk groups to named pipe (FIFO). The following is an example to copy to a FIFO special file.
$bash> mkfifo /tmp/fifotest
$bash> cp /tmp/fifotest /tmp/file &
$bash> asmcmd cp +data/orcl/datafile/file /tmp/fifotest
copying +data/orcl/datafile/file -> /tmp/fifotest
See Also:
-
Specifying the Type of Connection for more information about connection options with ASMCMD
-
Oracle Database Net Services Administrator's Guide for more information about connection strings
du
Purpose
Displays the total space used for files in the specified directory and in the entire directory tree under the directory.
Syntax and Description
du [--suppressheader] [dir]
Table 10-48 lists the syntax options for the du
command.
Table 10-48 Options for the du command
Option | Description |
---|---|
|
Name of the directory. |
|
Suppresses column headings from the output. |
If you do not specify dir
, then information about the current directory is displayed. dir
can contain wildcard characters. See "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.
Example
The following is an example of the du
command. The example shows disk space used in the orcl
directory in the data
disk group, including all of the directories under the orcl
directory.
Example 10-52 Using the ASMCMD du command
ASMCMD [+] > du data/orcl Used_MB Mirror_used_MB 1756 3519
find
Purpose
Displays the absolute paths of all occurrences of the specified name pattern (with wildcards) in a specified directory and its subdirectories.
Syntax and Description
find [--type type] [--filegroup filegroup] dir pattern
Table 10-49 lists the syntax options for the find
command.
Table 10-49 Options for the find command
Option | Description |
---|---|
|
Type of target to find. |
|
Name of the file group containing the target files. |
|
Name of a target or a wildcard pattern. |
This command searches the specified directory and all subdirectories under it in the directory tree for the supplied pattern
. The value used for pattern
can be a directory name or a file name, and can include wildcard characters. See "Wildcard Characters".
The ASMCMD find
command is case insensitive.
In the output of the command, directory names are suffixed with the slash character (/) to distinguish them from file names.
Use the --type
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 listed in Table 5-1. These are type values from the type
column of the V$ASM_FILE
view.
Examples
The following are examples of the find
command. The first example
searches the data
disk group for files that begin with
undo
. The second example returns the absolute path of all the
control files (--type
CONTROLFILE
) in the +data/orcl
directory. The
third example returns the files contained in a file group called ORCL.
Example 10-53 Using the ASMCMD find command
ASMCMD [+] > find +data undo* +data/ORCL/DATAFILE/UNDOTBS1.258.691577151 ASMCMD [+] > find --type CONTROLFILE +data/orcl * +data/orcl/CONTROLFILE/Current.260.691577263 ASMCMD [+] > find +data --filegroup ORCL * +data/ORCL/DATAFILE/UNDOTBS1.258.691577151 +data/ORCL/CONTROLFILE/Current.260.691577263
kscopy
Purpose
Copies an Oracle KEYSTORE file from the source location to the destination location.
Syntax and Description
Examples
kscopy source_file <destination_path> [--autologin] [--local] [--dbuniquename <string>]
The following table contains the syntax options for the kscopy
command.
Table 10-50 Options for the kscopy command
Option | Description |
---|---|
|
Specifies the keystore source file. |
|
Specifies the destination file path. |
|
Specifies the filetype as an autologin keystore file. |
|
Specifies that the keystore file should be copied across different nodes. |
|
Specifies the database resource to update with the keystore file location. |
Note the following about the use of kscopy
:
-
kscopy
can copy an Oracle keystore file from an operating system path to a disk group. -
kscopy
can copy an Oracle keystore file from a disk group to an operating system path. -
kscopy
can copy an Oracle keystore file from a disk group to another disk group. -
kscopy
should not be used to copy a keystore file from an operating system path to an operating system path, for this case use the appropriate operating system command. - When the source keystore file is located in the OS file system and
the file name is not the default name for keystore files
ewallet.p12
or autologin keystore filescwallet.sso
the file type to be used isKEYSTORE
by default. However if--autologin
is specified the file type is set toAUTOLOGIN KEYSTORE
instead.
See Also:
The CREATE_KEYSTORE
clause of the
ADMINISTER KEY MANAGEMENT
statement in the Oracle Database SQL
Language Reference for information about creating
a server keystore file.
The following are examples of the kscopy
command. The
first example copies the Oracle KEYSTORE
from the data disk group
to an operating system location. The second example copies the Oracle
KEYSTORE
from an operating system location to the data
diskgroup . The third example copies an Oracle AUTOLOGIN KEYSTORE
from an operating system location to the data diskgroup. The fourth example copies
an Oracle KEYSTORE
from the data diskgroup to an operating system
location in the local node. The fifth example copies an Oracle AUTOLOGIN
KEYSTORE
from an operating system location to the data diskgroup and
sets “ORCL” string as the database name this keystore will be stored in.
Example 10-54 Using the ASMCMD kscopy command
ASMCMD> kscopy +DATA/tde/ewallet.p12 /tmp/tde ASMCMD> kscopy /tmp/tde/ewallet.p12 +DATA/tde ASMCMD> kscopy /tmp/tde/cwallet.sso +DATA/tde –autologin ASMCMD> kscopy +DATA/tde/ewallet.p12 /tmp/tde –local ASMCMD> kscopy /tmp/tde/ewallet.p12 +DATA/tde –dbuniquename ORCL
ls
Purpose
Lists the contents of an Oracle ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.
Syntax and Description
ls [--suppressheader] [-lshdtLg] [--absolutepath] [--reverse] [--permission] [--time_style style] [--fg] [pattern]
Table 10-51 lists the syntax options for the ls
command.
Table 10-51 Options for the ls command
Option | Description |
---|---|
(none) |
Displays only file names and directory names. |
|
Displays extended file information, including striping and redundancy information and whether the file was system-generated (indicated by Not all possible file attributes or disk group attributes are included. To view the complete set of column values for a file or a disk group, query the |
|
Displays file space information. |
|
With |
|
If the value for the |
|
Reverses the sort order of the listing. |
|
Sorts the listing by timestamp (latest first) instead of by name. |
|
If the value for the |
|
For each listed file, displays the absolute path of the alias that references it, if any. |
|
|
|
Specify the format in which the date will
be printed, using the format models for datetime
used in the Oracle Database (e.g., " |
|
Displays the file group containing the file. If the |
|
Suppresses column headings. |
|
Shows the permissions of a file ( |
|
Name of a file, directory, or a pattern. |
Command options enable you to modify and customize the output of the command. Table 10-51 lists the options and their descriptions. For disk group information, this command queries the V$ASM_DISKGROUP_STAT
view by default. If you specify all of the options, then the command shows a union of their attributes, with duplicates removed. If you enter ls
+
, the top level directory structure is displayed.
pattern
can be a file name, directory name, or a pattern including wildcard characters. See "Wildcard Characters".
-
If
pattern
is a directory name, thenls
lists the contents of the directory and depending on flag settings,ls
also lists information about each directory member. Directories are listed with a trailing slash (/) to distinguish them from files. -
If the value that you enter for
pattern
is a file name, thenls
lists the file and depending on the flag settings,ls
also lists information about the file. The file must be located in the current directory if the file name is specified with a relative path.
Examples
The following are examples of the ls
command that display various information about directories and the contents of the directories.
Example 10-55 Using the ASMCMD ls command
ASMCMD [+] > ls +data/orcl/datafile EXAMPLE.265.691577295 SYSAUX.257.691577149 SYSTEM.256.691577149 UNDOTBS1.258.691577151 USERS.259.691577151 ASMCMD [+] > ls -lt +data/orcl/datafile Type Redund Striped Time Sys Name DATAFILE MIRROR COARSE JUL 13 08:00:00 Y EXAMPLE.265.691577295 DATAFILE MIRROR COARSE JUL 13 05:00:00 Y SYSAUX.257.691577149 DATAFILE MIRROR COARSE JUL 13 02:00:00 Y USERS.259.691577151 DATAFILE MIRROR COARSE JUL 13 02:00:00 Y UNDOTBS1.258.691577151 DATAFILE MIRROR COARSE JUL 13 02:00:00 Y SYSTEM.256.691577149 ASMCMD [+] > ls -l +data/orcl/datafile/sy* Type Redund Striped Time Sys Name DATAFILE MIRROR COARSE JUL 13 05:00:00 Y SYSAUX.257.691577149 DATAFILE MIRROR COARSE JUL 13 02:00:00 Y SYSTEM.256.691577149 ASMCMD [+] > ls -s +data/orcl/datafile Block_Size Blocks Bytes Space Name 8192 12801 104865792 214958080 EXAMPLE.265.691577295 8192 88321 723525632 1452277760 SYSAUX.257.691577149 8192 88321 723525632 1452277760 SYSTEM.256.691577149 8192 7681 62922752 131072000 UNDOTBS1.258.691577151 8192 641 5251072 12582912 USERS.259.691577151 ASMCMD [+] > ls --permission +data/orcl/datafile User Group Permission Name rw-rw-rw- EXAMPLE.265.691577295 rw-rw-rw- SYSAUX.257.691577149 rw-rw-rw- SYSTEM.256.691577149 rw-rw-rw- UNDOTBS1.258.691577151 rw-rw-rw- USERS.259.691577151 ASMCMD [+] > ls -l --time_style 'MON DD HHAM' +data/orcl/datafile/sy* Type Redund Striped Time Sys Name DATAFILE MIRROR COARSE JUL 13 05PM Y SYSAUX.257.691577149 DATAFILE MIRROR COARSE JUL 13 02PM Y SYSTEM.256.691577149 ASMCMD [+] > ls -sh +data/orcl/datafile Block_Size Blocks Bytes Space Name 8K 12801 100M 205M EXAMPLE.265.691577295 8K 88321 690M 1.4G SYSAUX.257.691577149 8K 88321 690M 1.4G SYSTEM.256.691577149 8K 7681 60M 125M UNDOTBS1.258.691577151 8K 641 5M 12M USERS.259.691577151 ASMCMD [+] > ls --fg +data/orcl/datafile Filegroup Name ORCL EXAMPLE.265.691577295 ORCL SYSAUX.257.691577149 ORCL USERS.259.691577151 ORCL UNDOTBS1.258.691577151 ORCL SYSTEM.256.691577149
lsof
Purpose
Lists the open files of the local clients.
Syntax and Description
lsof [--suppressheader] {-G diskgroup|--dbname db| -C instance}
Table 10-52 lists the syntax options for the lsof
command.
Table 10-52 Options for the lsof command
Option | Description |
---|---|
|
Suppresses column headings. |
|
List files only from the specified disk group. |
|
List files only from the specified database. |
|
List files only from the specified instance. |
Example
The following are examples of the lsof
command. The first example lists the open files for the data
disk group. The second example lists the open files for the Oracle ASM instance.
Example 10-56 Using the ASMCMD lsof command
ASMCMD [+] > lsof -G data DB_Name Instance_Name Path orcl orcl +data/orcl/controlfile/current.260.691577263 orcl orcl +data/orcl/datafile/example.265.691577295 orcl orcl +data/orcl/datafile/sysaux.257.691577149 orcl orcl +data/orcl/datafile/system.256.691577149 orcl orcl +data/orcl/datafile/undotbs1.258.691577151 orcl orcl +data/orcl/datafile/users.259.691577151 orcl orcl +data/orcl/onlinelog/group_1.261.691577267 orcl orcl +data/orcl/onlinelog/group_2.262.691577271 orcl orcl +data/orcl/onlinelog/group_3.263.691577275 orcl orcl +data/orcl/tempfile/temp.264.691577287 ASMCMD [+] > lsof -C +ASM DB_Name Instance_Name Path asmvol +ASM +data/VOLUME1.271.679226013 asmvol +ASM +data/VOLUME2.272.679227351
mkalias
Purpose
Creates an alias for the specified system-generated file name.
Syntax and Description
mkalias file alias
Table 10-53 lists the syntax options for the mkalias
command.
Table 10-53 Options for the mkalias command
Option | Description |
---|---|
|
System-generated file name. |
|
Alias for the file name. |
alias
must be in the same disk group as the system-generated file. Only one alias is permitted for each Oracle ASM file.
Example
The following example creates the sysaux.f
alias for the fully qualified file name +data/orcl/DATAFILE/SYSAUX.257.721811945
. Following the mkalias
command, ls
--absolutepath
is run to check the results.
Example 10-57 Using the ASMCMD mkalias command
ASMCMD [+data/orcl/datafile] > mkalias SYSAUX.257.721811945 sysaux.f ASMCMD [+data/orcl/datafile] > ls --absolutepath none => EXAMPLE.265.721812093 +DATA/ORCL/DATAFILE/sysaux.f => SYSAUX.257.721811945 none => SYSTEM.256.721811945 none => UNDOTBS1.258.721811945 none => USERS.259.721811947 sysaux.f
mkdir
Purpose
Creates Oracle ASM directories under the current directory.
Syntax and Description
mkdir dir [dir . . .]
Table 10-54 lists the syntax options for the mkdir
command.
Table 10-54 Options for the mkdir command
Option | Description |
---|---|
|
Directory name to create. |
The directory from which mkdir
is run can be a system-created or user-created directory. You cannot create a directory at the root (+) level.
Example
The following is an example of the mkdir
command. The example creates the directories subdir1
and subdir2
at the disk group level in the disk group data
.
Example 10-58 Using the ASMCMD mkdir command
ASMCMD [+data] > mkdir subdir1 subdir2 ASMCMD [+data] > ls ASM/ ORCL/ subdir1/ subdir2/
pwd
Purpose
Displays the absolute path of the current directory.
Syntax and Description
pwd
Example
The following is an example of the pwd
command. The example displays the current directory.
Example 10-59 Using the ASMCMD pwd command
ASMCMD [+data/orcl/datafile] > pwd +data/orcl/datafile
rm
Purpose
Deletes the specified Oracle ASM files and directories.
Syntax and Description
rm [-f|-r] pattern [pattern...]
Table 10-55 lists the syntax options for the rm
command.
Table 10-55 Options for the rm command
Option | Description |
---|---|
|
Recursively deletes files and subdirectories. |
|
Deletes files and subdirectories without prompting for confirmation. |
|
Name of a file, directory, or wildcard pattern. |
If pattern
is a file or alias, then the rm
command can delete the file or alias only if it is not currently in use. If pattern
is a directory, then the rm
command can delete it only if it is empty (unless the -r
flag is used) and it is not a system-generated directory. If pattern
is an alias, then the rm
command deletes both the alias and the file to which the alias refers. To delete only an alias and retain the file that the alias references, use the rmalias
command.
Note:
When you delete all of the files in a system-created directory, the directory is removed. If the parent directories are empty, all of the parent directories are also removed.
pattern
can contain wildcard characters. See "Wildcard Characters".
If you use a wildcard, the rm
command deletes all of the matches except nonempty directories, unless you use the -r
flag. To recursively delete, use the -r
flag. With -r
option you can delete a nonempty 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, then the rm
command prompts you to confirm the 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, then both the alias and the system-generated file that it references are deleted. When using the -r
flag to delete an alias that matches a wildcard pattern, either the alias or the system-generated file that has an alias must be present in the directory in which you run the rm
command.
For example, if you have a user alias, +data/dir1/file.alias
that points to +data/orcl/DATAFILE/System.256.146589651
, then running the rm -r +data/dir1
command removes the +data/dir1/file.alias
and +data/orcl/DATAFILE/System.256.146589651
.
Example
The following are examples of the rm
command. The first example deletes the myexamples.bak
file. The second example removes the subdir2
directory and its contents.
Example 10-60 Using the ASMCMD rm command
ASMCMD [+data/orcl/datafile] > rm myexamples.bak ASMCMD [+data] > rm -r subdir2 You may delete multiple files and/or directories. Are you sure? (y/n) y
rmalias
Purpose
Removes the specified aliases, retaining the files that the aliases reference.
Syntax and Description
rmalias [-r] alias [alias...]
Table 10-56 lists the syntax options for the rmalias
command.
Table 10-56 Options for the rmalias command
Option | Description |
---|---|
|
Recursively removes aliases. |
|
Alias for the file name or directory. |
The -r
flag enables you to remove all of the aliases in the current directory and in the entire directory tree beneath the current directory. If any user-created directories become empty after deleting aliases, they are also deleted. Files and directories created by the system are not deleted.
Example
The following is an example of the rmalias
command. The example deletes the alias sysaux.f
, retaining the data file that it references.
Example 10-61 Using the ASMCMD rmalias command
ASMCMD [+data/orcl/datafile] > rmalias sysaux.f