Documente Academic
Documente Profesional
Documente Cultură
All above tasks, striping, mirroring, logical file system building, are done to serve Oracle
database. Oracle database offers some techniques of its own to simplify or enhance the
process. Lets DBAs execute many of the above tasks completely within the Oracle
framework. Using ASM you can transform a bunch of disks to a highly scalable and
performance file system/volume manager using nothing more than what comes with Oracle
database software at no extra cost and you don't need to be an expert in disk, volume
managers, or file system management.
You can store the following file types in ASM diskgroups:
o Datafiles
o Control files
o Online redo logs
o Archive logs
o Flashback logs
o SPFILEs
o RMAN backups
o Temporary datafiles
o Datafile copies
o Disaster recovery configurations
o Change tracking bitmaps
o Datapump dumpsets
In summary, ASM provides the following functionality/features:
Manages groups of disks, called diskgroups. Must be careful while choosing disks for
a diskgroup.
Manages disk redundancy within a diskgroup.
Provides near-optimal I/O balancing without any manual tuning.
Enables management of database objects without specifying mount points and
filenames.
Supports large files.
Replacement for CFS (Cluster File System).
Also useful for Non-RAC databases.
A new instance type - ASM is introduced in 10g.
ASM instance has no data dictionary.
A Disk can be a partial, full or a LUN from the RG.
I/O is spread evenly across all disks of a diskgroup.
Disks can be dynamically added to any diskgroup.
When combined with OMF increases manageability.
ASM cannot maintain empty directories “delete input” has issues, create a dummy
directory.
Use of ASM diskgroup is very simple create tablespace.
Enterprise Manager can also be used for administering diskgroups
Only RMAN can be used with ASM.
o Introduces three additional Oracle background processes – RBAL, ARBx and
ASMB.ASMB - This ASMB process is used to provide information to and from
cluster synchronization services used by ASM to manage the disk resources. It's
also used to update statistics and provide a heart beat mechanism.
o Re-Balance, RBAL - RBAL is the ASM related process that performs
rebalancing of disk resources controlled by ASM.
o Actual Rebalance, ARBx - ARBx is configured by ASM_POWER_LIMIT.
ASM instance has it own set of v$views and init.ora parameters.
The advantages of ASM are
Disk Addition - Adding a disk is very easy. No downtime is required and file extents
are redistributed automatically.
I/O Distribution - I/O is spread over all the available disks automatically, without
manual intervention, reducing chances of a hot spot.
Stripe Width - Striping can be fine grained as in redolog files (128K for faster transfer
rate) and coarse for datafiles (1MB for transfer of a large number of blocks at one time).
Mirroring - Software mirroring can be set up easily, if hardware mirroring is not
available.
Buffering - The ASM file system is not buffered, making it direct I/O capable by
design.
Kernelized Asynchronous I/O - There is no special setup necessary to enable
kernelized asynchronous I/O, without using raw or third-party file systems such as Veritas
Quick I/O.
ASMB
This ASMB process is used to provide information to and from cluster synchronization services
used by ASM to manage the disk resources. It's also used to update statistics and provide a heart
beat mechanism.
Re-Balance RBAL
RBAL is the ASM related process that performs rebalancing of disk resources controlled by ASM.
Actual Rebalance ARBx
ARBx is configured by ASM_POWER_LIMIT.
Performs the actual extent movement between disks in the disk groups
KATE - I/O to an ASM when disk offline
GMON – Global Monitor: It is responsible for coordinating the disk group activities whenever a
disk group becomes offline or drop.
KATE – Konductor for ASM Temporary Errand: It is responsible for making online for disk
groups.
PZ9X: It is responsible for gathering the dynamic views information globally across all the
instances of database.
Initialization Parameters and ASM Instance Creation
The initialization parameters that are of specific interest for an ASM instance are:
INSTANCE_TYPE- Set to ASM or RDBMS depending on the instance type. The default is
RDBMS.
DB_UNIQUE_NAME- Specifies a globally unique name for the database. This defaults to
+ASM but must be altered if you intend to run multiple ASM instances.
ASM_POWER_LIMIT-The maximum power for a rebalancing operation on an ASM instance.
The valid values range from 1 to 11, with 1 being the default. The higher the limit the more
resources are allocated resulting in faster rebalancing operations. This value is also used as the
default when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS- The list of disk groups that should be mounted by an ASM instance
during instance startup, or by the ALTER DISKGROUP ALL MOUNT statement. ASM
configuration changes are automatically reflected in this parameter.
ASM_DISKSTRING- Specifies a value that can be used to limit the disks considered for
discovery. Altering the default value may improve the speed of disk group mount time and the
speed of adding a disk to a disk group. Changing the parameter to a value which prevents the
discovery of already mounted disks results in an error. The default value is NULL allowing all
suitable disks to be considered.
ASM Instance
The ASM functionality is controlled by an ASM instance. This is a special instance, not a
database where users can create objects, just the memory structures and as such is very
small and lightweight.
With ASM, you don't have to create anything on the OS side; the feature will group a set of
physical disks to a logical entity known as a diskgroup. A diskgroup is analogous to a striped
and optionally mirrored, file system, with important differences: it's not a general-purpose file
system for storing user files and it's not buffered. Diskgroup offers the advantage of direct
access to this space as a raw device, yet provides the convenience and flexibility of a file
system. All the metadata about the disks are stored in the diskgroups themselves, making
them as self-describing as possible.
This special ASM instance is similar to other file systems in that it must be running for ASM to
work and can't be modified by the user. One ASM instance can serve number of Oracle
databases. ASM instance and database instances have to be present on same server.
Otherwise it will not work.
Logical volume managers typically use a function, such as hashing, to map the logical
address of the blocks to the physical blocks. This computation uses CPU cycles. When a new
disk is added, this typical striping function requires each bit of the entire data set to be
relocated. In contrast, ASM uses this special instance to address the mapping of the file
extents to the physical disk blocks. This design, in addition to being fast in locating the file
extents, helps while adding or removing disks because the locations of file extents need not
be coordinated.
You should start the instance up when the server is booted i.e. it should be started before the
database instances, and it should be one of the last things stopped when the server is
shutdown. From 11.2.0, we can use ASMCMD to start and stop the ASM instances.
Startup of ASM Instances
ASM instances are started and stopped in a similar way to normal database instances.
The options for the STARTUP command are:
NOMOUNT - Starts the ASM instance without mounting any diskgroups.
MOUNT - Starts the ASM instance and mounts the diskgroups specified by the
ASM_DISKGROUPS parameter.
OPEN - ASM instance does not have open stage.
FORCE - Performs a SHUTDOWN ABORT before restarting the ASM instance.
ASMCMD equivalent for this command is startup (11g R2 command).
ASM is supposed to stripe the data and also mirror the data (if using Normal, High
redundancy). So this can be used as an alternative for RAID (Redundant Array of Inexpensive
Disks) 0+1 solutions.
No, we cannot modify the redundancy for diskgroup once it has been created. To alter it we
will be required to create a new diskgroup and move the files to it. This can also be done by
restoring full backup on the new diskgroup.
Failure groups are defined within a diskgroup to support the required level of redundancy,
using normal/high redundancy. They contain the mirrored ASM extents and must be
containing different disks and preferably on separate disk controller.
In addition failure groups and preferred names for disks can be defined in CREATE
DISKGROUP statement. If the NAME clause is omitted the disks are given a system
generated name like "disk_group_1_0001". The FORCE option can be used to move a disk
from another diskgroup into this one.
Creating diskgroups
SQL> CREATE DISKGROUP dg_asm_data NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK'/devices/diska1' NAME diska1, '/devices/diska2' NAME
diska2,
FAILGROUP failure_group_2 DISK'/devices/diskb1' NAME diskb1, '/devices/diskb2' NAME
diskb2;
For two-way mirroring we would expect a diskgroup to contain two failure groups, so
individual files are written to two locations.
Although it may appear as such, d3 and d4 are not mirrors of d1 and d2. Rather, ASM uses all
the disks to create a fault-tolerant system. For example, a file on the diskgroup might be
created in d1 with a copy maintained on d4. A second file may be created on d3 with copy on
d2, and so on. That is, primary copy will be on one failure group and secondary copy will be
another (third copy will be another, for high redundancy).
Failure of a specific disk allows a copy on another disk so that the operation can continue. For
example, you could lose the controller for both disks d1 and d2 and ASM would mirror copies
of the extents across the failure group to maintain data integrity.
Dropping diskgroups
Diskgroups can be deleted using the DROP DISKGROUP statement.
SQL> DROP DISKGROUP disk_group_1 INCLUDING CONTENTS;
SQL> DROP DISKGROUP disk_group_1 FORCE; (11g R1 command)
SQL> DROP DISKGROUP disk_group_1 FORCE INCLUDING CONTENTS; ( 11gR1
command)
ASMCMD equivalent for this command is dropdg (11g R2 command).
Altering diskgroups
Disks can be added or removed from diskgroups using the ALTER DISKGROUP statement.
Remember that the wildcard "*" can be used to reference disks so long as the resulting string
does not match a disk already used by an existing diskgroup.
Adding disks
We may have to add additional disks into the diskgroup to accommodate growing demand.
SQL> ALTER DISKGROUP dskgrp1 ADD DISK '/dev/d5';
SQL> ALTER DISKGROUP dg1 ADD DISK '/devices/disk*3', '/devices/disk*4';
ASMCMD equivalent for this command is chdg (11g R2 command).
Listing disks
The following command shows all the disks managed by the ASM instance for all the client
databases.
SQL> SELECT * FROM V$ASM_DISK;
Offline disks
SQL> ALTER DISKGROUP data OFFLINE DISK 'disk_0000', 'disk_0001';
SQL> ALTER DISKGROUP data OFFLINE DISKS IN FAILGROUP 'fg_99';
SQL> ALTER DISKGROUP data OFFLINE DISK d1_0001 DROP AFTER 30m;
ASMCMD equivalent for this command is offline (11gR2 command).
Mounting diskgroups
Diskgroups are mounted at ASM instance startup and unmounted at ASM instance shutdown.
Manual mounting and dismounting can be accomplished using the ALTER DISKGROUP
statement as below.
SQL> ALTER DISKGROUP ALL MOUNT;
SQL> ALTER DISKGROUP dg_data2 MOUNT;
SQL> ALTER DISKGROUP dg_data2 MOUNT RESTRICTED; (11gR1 command)
Dismounting diskgroups
Changing attributes
SQL> ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.rdbms' = '11.1'; ( 11gR1
command)
SQL> ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.asm' = '11.2';
(11gR1 command)
SQL> ALTER DISKGROUP data3 SET ATTRIBUTE 'disk_repair_time' = '4.5h'; ( 11gR1
command)
ASMCMD equivalent for this command is setattr (11gR2 command).
Listing attributes
SQL> SELECT * FROM V$ASM_ATTRIBUTE;
IO statistics of a diskgroup
SQL> SELECT * FROM V$ASM_DISK_IOSTAT;
Aliases
Aliases allow you to reference ASM files using user-friendly names, rather than the fully
qualified ASM filenames.
Creating an alias
Creating an alias, using the fully qualified filename
SQL> ALTER DISKGROUP dg_3 ADD ALIAS '+dg_3/my_dir/users.dbf' FOR
'+dg_3/mydb/datafile/users.392.333222555';
Creating an alias, using the numeric form filename
SQL> ALTER DISKGROUP dg_3 ADD ALIAS '+dg_3/my_dir/my_file.dbf' FOR
'+dg_3.317.111222333';
ASMCMD equivalent for this command is mkalias.
Renaming an alias
SQL> ALTER DISKGROUP dg_3 RENAME ALIAS '+dg_3/my_dir/my_file.dbf' TO
'+dg_3/my_dir/my_file2.dbf';
Deleting an alias
SQL> ALTER DISKGROUP dg_3 DELETE ALIAS '+dg_3/my_dir/my_file.dbf';
ASMCMD equivalent for this command is rmalias.
Attempting to drop a system alias results in an error.
Templates
Templates are named groups of attributes that can be applied to the files within a diskgroup.
The level of redundancy and the granularity of the striping can be controlled using templates.
Default templates are provided for each file type stored by ASM, but additional templates can
be defined as needed.
Available attributes are:
UNPROTECTED - No mirroring or striping regardless of the redundancy setting.
MIRROR - Two-way mirroring for normal redundancy and three-way mirroring for high
redundancy.
COARSE - Specifies lower granularity for striping.
FINE - Specifies higher granularity for striping.
MIRROR, COARSE, FINE attributes are cannot be set for external redundancy.
Creating a template
SQL> ALTER DISKGROUP dg_4 ADD TEMPLATE mf_template ATTRIBUTES (MIRROR
FINE);
Listing templates
SQL> SELECT * FROM V$ASM_TEMPLATE;
ASMCMD equivalent for this command is lstmpl (11gR2 command).
Dropping a template
SQL> ALTER DISKGROUP dg_4 DROP TEMPLATE u_template;
Checking Metadata
The internal consistency of diskgroup metadata can be checked in a number of ways using
the CHECK clause of the ALTER DISKGROUP statement.
Checking metadata for a specific file
SQL> ALTER DISKGROUP dg_5 CHECK FILE '+dg_5/my_dir/my_file.dbf'
Volume Management
From 11g release 2, we can create Oracle ASM Dynamic Volume Manager (Oracle ADVM)
volumes in a diskgroups. The volume device associated with the dynamic volume can then be
used to host an (Oracle ACFS) file system.
Creating a volume
SQL> ALTER DISKGROUP data_dg ADD VOLUME volume1 SIZE 20G;
ASMCMD equivalent for this command is volcreate (11gR2 command).
Resizing a volume
SQL> ALTER DISKGROUP fra_dg RESIZE VOLUME volume1 SIZE 25G;
ASMCMD equivalent for this command is volresize (11gR2 command).
Disabling a volume
SQL> ALTER DISKGROUP redo_dg DISABLE VOLUME volume1;
SQL> ALTER DISKGROUP ALL DISABLE VOLUME ALL;
ASMCMD equivalent for this command is voldisable (11gR2 command).
Enabling a volume
SQL> ALTER DISKGROUP arch_dg ENABLE VOLUME volume1;
ASMCMD equivalent for this command is volenable (11gR2 command).
Setting a volume
SQL> ALTER DISKGROUP asm_dg_data MODIFY VOLUME volume1 USAGE 'acfs';
ASMCMD equivalent for this command is volset (11gR2 command).
Misc
Listing the current operations
SQL> SELECT * FROM V$ASM_OPERATION;
ASMCMD equivalent for this command is lsop (11gR2 command).
Creating Tablespaces
Now create a tablespace in the main database using a datafile in the ASM-enabled storage.
SQL> CREATE TABLESPACE user_data DATAFILE '+dskgrp1/user_data_01' SIZE 1024M;
ASM filenames can be used in place of conventional filenames for most Oracle file types,
including controlfiles, datafiles, logfiles etc. For example, the following command creates a
new tablespace with a datafile in the disk_group_1 diskgroup.
SQL> CREATE TABLESPACE my_ts DATAFILE '+disk_group_1' SIZE 100M AUTOEXTEND
ON;
Note how the diskgroup is used as a virtual file system. This approach is useful not only in
datafiles, but in other types of Oracle files as well. For instance, we can create online redo log
files as...
LOGFILE GROUP 1
('+dskgrp1/redo/group_1.258.659723485','+dskgrp2/redo/group_1.258.659723485') SIZE
50M,.
Archived log destinations can also be set to a diskgroup. Everything related to Oracle
database can be created in an ASM diskgroup. Backup is another great use of ASM. You can
set up a bunch of inexpensive disks to create the recovery area of a database, which can be
used by RMAN to create backup datafiles and archived log files.
ASM supports files created by and read by the Oracle database only; it is not a replacement
for a general-purpose file system.
Until Oracle 11g release1, we cannot store binaries or flat files. We cannot use ASM for storing
the voting disk and OCR. It is due to the fact that Clusterware starts before ASM instance and
it should be able to access these files which are not possible if you are storing it on ASM. You
will have to use raw devices or OCFS or any other shared storage. But from 11g release 2, we
can store ALL files on ASM.
Can we see the files stored in the ASM instance using standard Unix commands?
No, you cannot see the files using standard Unix commands like ls. You need to use utility
called asmcmd to do this. Oracle 10g release2 introduces asmcmd which makes administration
very easy.
$ asmcmd
ASMCMD>
ASMLIB is the support library for the ASM. ASMLIB allows an Oracle database using ASM
more efficient and capable access to diskgroups. The purpose of ASMLIB, is to provide an
alternative interface to identify and access block devices. ASMLIB API enables storage and
OS vendors to supply extended storage-related features.
Migrating to ASM using RMAN
The following method shows how a database can be migrated to ASM from a disk based
backup:
1) Shutdown the database.
SQL> SHUTDOWN IMMEDIATE
2) Modify the parameter file of the database as follows:
Set DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters to the
relevant ASM diskgroups.
3) Remove CONTROL_FILES parameter from the spfile so the control files will be moved to
the DB_CREATE_* destination and the spfile gets updated automatically. If you are using a
pfile the CONTROL_FILES parameter must be set to the appropriate ASM files or aliases.
4) Start the database in nomount mode.
RMAN> STARTUP NOMOUNT
5) Restore the controlfile into the new location from the old location.
RMAN> RESTORE CONTROLFILE FROM 'old_control_file_name';
6) Mount the database.
RMAN> ALTER DATABASE MOUNT;
7) Copy the database into the ASM diskgroup.
RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group';
8) Switch all datafile to the new ASM location.
RMAN> SWITCH DATABASE TO COPY;
9) Open the database.
RMAN> ALTER DATABASE OPEN;
10) Create new redo logs in ASM and delete the old ones.
2. ASM Disk Scrubbing - From RAC 12c, ASM comes with disk scrubbing feature so that
logical corruptions can be discovered. Also Oracle 12c ASM can automatically correct this in
normal or high redundancy diskgroups.
2. ASM Disk Scrubbing - From RAC 12c, ASM comes with disk scrubbing feature so that
logical corruptions can be discovered. Also Oracle 12c ASM can automatically correct this in
normal or high redundancy diskgroups.
ASM Views
The ASM configuration can be viewed using the V$ASM_% views, which contain information
depending on whether they are queried from the ASM instance, or a dependant database
instance.
View In A
V$ASM_ALIAS Displays a row for each alias present in ever
V$ASM_ATTRIBUTE (11gR2) Displays attributes of diskgroups.
V$ASM_CLIENT Displays a row for each database instance u
Displays a row for each disk discovered by
V$ASM_DISK or V$ASM_DISK_STAT
any diskgroup.
V$ASM_DISK_IOSTAT (11gR2) Displays IO statistics of disks.
V$ASM_DISKGROUP or V$ASM_DISKGROUP_STAT Displays a row for each diskgroup discovere
V$ASM_FILE Displays a row for each file for each diskgro
V$ASM_FILESYSTEM (11gR2) Displays a row for each filesystem for each d
V$ASM_OPERATION Displays a row for each file for each long run
V$ASM_TEMPLATE Displays a row for each template present in
V$ASM_USER (11gR2) Displays a row for each ASM user.
V$ASM_USERGROUP (11gR2) Displays a row for each ASM usergroup.
V$ASM_USERGROUP_MEMBER (11gR2) Displays ASM usergroups and it's members
V$ASM_VOLUME or V$ASM_VOLUME_STAT (11gR2) Displays a row for each volume.
ASM backup can be taken by spooling the output of the ASM views to text file.
SPOOL asm_views.log
SET ECHO ON
SELECT * FROM V$ASM_ALIAS;
SELECT * FROM V$ASM_ATTRIBUTE;
SELECT * FROM V$ASM_CLIENT;
SELECT * FROM V$ASM_DISK;
SELECT * FROM V$ASM_DISK_IOSTAT;SELECT * FROM V$ASM_DISK_STAT;
SELECT * FROM V$ASM_DISKGROUP;
SELECT * FROM V$ASM_DISKGROUP_STAT;
SELECT * FROM V$ASM_FILE;
SELECT * FROM V$ASM_FILESYSTEM;
SELECT * FROM V$ASM_OPERATION;
SELECT * FROM V$ASM_TEMPLATE;
SELECT * FROM V$ASM_USER;
SELECT * FROM V$ASM_USERGROUP;
SELECT * FROM V$ASM_USERGROUP_MEMBER;
SELECT * FROM V$ASM_VOLUME;
SELECT * FROM V$ASM_VOLUME_STAT;
SPOOL OFF
Managing ASM through SQL interfaces, in Oracle Database 10g Release 1, posed a challenge
for administrators who were not very familiar with SQL and preferred a more conventional
command line interface. From Oracle Database 10g Release 2, we have an option to manage
the ASM files by using ASMCMD, a powerful and easy to use command line tool.
In Oracle Database 10g Release 1, ASM diskgroups are not visible outside the database for
regular file system administration tasks such as copying and creating directories. From Oracle
Database 10g Release 2, we can transfer the files from ASM to locations outside of the
diskgroups via FTP and through a web browser using HTTP.
(From 11.2.0) ASMCMD is used to
start/stop ASM instances
create or alter or drop diskgroups
mount or dismount diskgroups
list the contents, statistics and attributes of diskgroups, and files on them
backup and restore the metadata of diskgroups
create and remove directories, templates and aliases
managing volumes
make online or offline the disks/failure groups
can rebalance the diskgroups
repair physical blocks
copy the files between the diskgroups and OS
backup and restore of SP file
add/remove/modify/list users from password file
add/remove/modify/list templates
manipulate diskstring
create/modify/remove ASM users, groups
change ASM file permissions, owners and groups
display space utilization
perform searches
ASMCMD has equivalent commands for all the SQL commands that can be performed
through SQL*Plus.
ASMCMD is included in the installation of the Oracle Database software (from 10g Release
2), no separate setup is required.
We can’t see the files stored in the ASM instance using standard UNIX commands like ls. We
need to use asmcmd. The asmcmd command line interface is very similar to standard
UNIX/Linux commands, but it only manages files at the OS level. The asmcmd utility supports
all common Linux commands. The idea of this tool is to make administering the ASM files
similar to administering standard OS files.
Invoking asmcmd
To start using ASMCMD, you must log in as a user that has SYSASM or SYSDBA privileges
through OS authentication. The environmental variables ORACLE_HOME and ORACLE_SID
must be set to the ASM instance. Ensure that $ORACLE_HOME/bin is in PATH environment
variable. You must have ASM configured on the machine and started, and the ASM
diskgroups are mounted.
The default value of the ASM SID for a single instance database is +ASM. In Real Application
Clusters (RAC) environments, the default value of the ASM SID on any node is +ASMnode#
(+ASM1, +ASM2, ...).
$ export ORACLE_SID=+ASM
To enter in interactive mode, type asmcmd, which brings up the ASM command prompt.
$ asmcmd
ASMCMD>
To run a specific ASMCMD command, non interactively, we can type
$ asmcmd command arguments
We can specify -p option with the asmcmd command to include current directory path in the
ASMCMD prompt.
$ asmcmd -p
ASMCMD [+] > cd dgroup1/hrms
ASMCMD [+dgroup1/hrms] >
We can specify -a option to choose the type of connection, either SYSASM or SYSDBA. From
11g, the SYSASM privilege is preferred & default.
$ asmcmd -a sysasm or asmcmd -a sysdba
We can specify -V option when starting asmcmd to displays the asmcmd version number.
This is from 11g.
$ asmcmd -V
asmcmd version 11.1.0.6.0
We can specify -v option when starting asmcmd to displays the additional information. This is
from 11g.
$ asmcmd -v
ASM Filenames & Directories
Pathnames within ASMCMD, can use either the forward slash (/) as in UNIX or the backward
slash (\) as in Windows, they're interchangeable. Also, we can use either the UNIX wildcard
"*" to match any string in a pathname, or its SQL equivalent, "%".
Filenames are not case sensitive, but are case retentive, that is, ASMCMD retains the case of
the directory that you entered.
The fully qualified filename represents a hierarchy of directories in which the plus sign (+)
represent the root directory. We can also create our own directories as subdirectories of the
system-generated directories using the ALTER DISKGROUP command or with the ASMCMD
mkdir command. Those directories can have subdirectories, and we can navigate the
hierarchy of both system-generated directories and user-created directories with the cd
command.
When we run an ASMCMD command that accepts a filename or directory name as an
argument, we can use the name as either an absolute path or a relative path.
An absolute path refers to the full path of a file or directory. An absolute path begins with a
plus sign (+) followed by a diskgroup name, followed by subsequent directories in the
directory tree. The absolute path includes directories until the file or directory is reached. A
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 [+] > rm +dgroup1/hrms/datafile/users.280.555341999
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.
ASMCMD [+dgroup1/hrms/DATAFILE] > ls -l undotbs1.267.557429239
Paths to directories can also be relative and we can use the pseudo-directories "." and ".." in
place of a directory name. The wildcard characters * and % match zero or more characters
anywhere within an absolute or relative path, which saves typing of the full directory or file
name. These two wildcard characters behave identically.
Alias
As in UNIX, we can create alias names for files listed in the diskgroup. Aliases are user-
friendly filenames that are references or pointers to system-generated filenames. Aliases are
similar to symbolic links in UNIX flavors. ASM's auto generated names can be a bit strange,
so creating aliases makes working with ASM files with ASMCMD easier. Aliases simplify ASM
filename administration. We can create aliases with an ALTER DISKGROUP command or
with the mkalias ASMCMD command.
An alias has at a minimum the diskgroup name as part of its complete path. We can create
aliases at the diskgroup level or in any system-generated or user-created subdirectory. The
following are examples of aliases:
+dgroup1/ctl1.f
+dgroup1/crm/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 to which the alias refers.
ctl1.f => +dgroup2/hrms/CONTROLFILE/Current.256.541956473
We can run the ASMCMD utility in either interactive or non interactive mode.
ASMCMD in Interactive Mode
The interactive mode of the ASMCMD utility provides an environment like shell or SQL*Plus,
where we are prompted to enter ASMCMD commands.
To run ASMCMD in interactive mode:
1. Enter the following at the OS 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,
and then ASMCMD prompts for the next command.
3. Continue entering ASMCMD commands. Enter the command exit to exit ASMCMD.
cd command
Changes to a specified directory. We can go up or down the hierarchy of the current directory
tree by providing a directory argument to the cd command.
cd dir_name
dir_name may be specified as either an absolute path or a relative path, including the . and ..
pseudo-directories and wildcards.
ASMCMD [+dgroup2/crm] > cd +dgroup1/hrms
ASMCMD [+dgroup1/hrms] > cd DATAFILE
ASMCMD [+dgroup1/hrms/DATAFILE] > cd ..
ASMCMD [+]> cd +dgroup1/sample/C*
If a wildcard pattern matches only one directory when using wildcard characters with cd, then
cd changes the directory to that destination. If the wildcard pattern matches multiple
directories, then ASMCMD does not change the directory but instead returns an error.
pwd command
Displays the absolute path of the current directory.
pwd
ASMCMD> pwd
help command
Displays the syntax of a command and description of the command parameters.
help [command] or ? [command]
If you do not specify a value for command, then the help command lists all of the ASMCMD
commands and general information about using the ASMCMD utility.
ASMCMD> help
ASMCMD> help lsct
ASMCMD> ?
ASMCMD> ? mkgrp
du command
Displays the total space used for files in the specified directory and in the entire directory tree
under the directory.
du [-H] [dir_name]
ls command
Lists the contents of an ASM directory, the attributes of the specified file, or the names and
attributes of all diskgroups from the V$ASM_DISKGROUP_STAT (default) or
V$ASM_DISKGROUP.
ls [-lsdrtLacgH] [name]
ls [-lsdtLacgH] [--reverse] [--permission] [pattern] (11g R2syntax)
name can be a filename or directory name, can include wildcards.
If name is a directory name, then ASMCMD lists the contents of the directory and depending
on flag settings, ASMCMD also lists information about each directory member. Directories are
listed with a trailing forward slash (/) to distinguish them from files.
If name is a filename, then ASMCMD lists the file and depending on the flag settings,
ASMCMD also lists information about the file.
Flag Description
(none) Displays only filenames and directory names.
Displays extended file information, including striping and redundancy information and whether t
file was system-generated (indicated by Y under the SYS column) or user-created (as in the ca
-l
of an alias, indicated by N under the SYS column). Note that not all possible file attributes
diskgroup attributes are included.
-s Displays file space information.
If the value for the name argument is a directory, then ASMCMD displays information about th
-d
directory, rather than the directory contents. Typically used with another flag, such as the -l flag.
-r or
Reverses the sort order of the listing.
--reverse
-t Sorts the listing by timestamp.
If the value for the name argument is an alias, then ASMCMD displays information about the f
-L
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.
-c Selects from V$ASM_DISKGROUP or GV$ASM_DISKGROUP if the -g flag is also specified.
Selects from GV$ASM_DISKGROUP_STAT or GV$ASM_DISKGROUP if the -c flag is al
-g
specified. GV$ASM_DISKGOUP.INST_ID is included in the output.
-H Suppresses column headings.
Shows the permissions of a file (V$ASM_FILE.permission, V$ASM_FILE.own
--permission
V$ASM_FILE.usergroup, V$ASM_ALIAS.name).
pattern Name of a file, directory, or pattern.
If you specify all of the flags, then the command shows a union of their attributes, with
duplicates removed. To see the complete set of column values for a file or a diskgroup, query
the V$ASM_FILE and V$ASM_DISKGROUP.
ASMCMD [+dgroup1/sample/DATAFILE] > ls
EXAMPLE.269.555342243
SYSAUX.257.555341961
SYSTEM.256.555341961
UNDOTBS1.258.555341963
UNDOTBS1.272.557429239
USERS.259.555341963
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
lsct command
Lists information about current ASM clients (from V$ASM_CLIENT). A client, is a database or
Oracle ASM Dynamic Volume Manager (Oracle ADVM), uses diskgroups that are managed
by the ASM instance to which ASMCMD is currently connected.
lsct [-gH] [disk_group]
Flag Description
(none) Displays information about current ASM clients from V$ASM_CLIENT.
-g Selects from GV$ASM_CLIENT. GV$ASM_CLIENT.INST_ID is included in the output.
-H Suppresses column headings.
An ASM instance serves as a storage container; it's not a database by itself. Other databases
use the space in the ASM instance for datafiles, control files, and so on.
How do you know how many databases are using an ASM instance?
ASMCMD [+DG1_FRA] > lsct
DB_Name Status Software_Version Compatible_version Instance_Name
Flag Description
(none) Displays all the diskgroup attributes.
Selects from V$ASM_DISKGROUP or GV$ASM_DISKGROUP if the -g flag is also specifi
-c or --discovery
option is ignored if the ASM instance is version 10.1 or earlier.
Selects from GV$ASM_DISKGROUP_STAT or GV$ASM_DISKGROUP if the -c or --discov
-g is also specified. GV$ASM_DISKGOUP.INST_ID is included in the output. The REBAL co
the GV$ASM_OPERATION is also included in the output.
-H Suppresses column headings.
Returns only information about the specified diskgroup or diskgroups that match the s
pattern
pattern.
To see the complete set of attributes for a diskgroup, use the V$ASM_DISKGROUP_STAT or
V$ASM_DISKGROUP.
The following example lists the attributes of the dg_data diskgroup (in 11.2.0).
ASMCMD [+] > lsdg dg_data
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB
Offline_disks Voting_files Name
MOUNTED NORMAL N 512 4096 4194304 12288 8835 1117 3859 0 N DG_DATA
mkalias command
Creates an alias for specified system-generated filename.
mkalias file alias
alias must be in the same diskgroup as the system-generated file. Only one alias is permitted
for each ASM file.
mkdir command
Creates ASM directories under the current directory.
mkdir dir_name [dir_name...]
The current directory can be created by the system or by the user. You cannot create a
directory at the root (+) level, which is a diskgroup.
rm command
Deletes specified ASM files and directories.
rm [-rf] name [name]...
Flag Description
-f Force, remove it without user interaction.
-r Recursive, remove sub-directories also.
If name is a file or alias (can contain wildcard characters), then the rm command can delete
the file or alias, only if it is not currently in use by a client database.
If name 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 name is an alias, then the rm command deletes both the alias and the file to which the alias
refers.
For example, if we have an alias,
+dg1/dir1/file.alias => +dg/orcl/DATAFILE/System.256.146589651
then running the
rm -r +dg1/dir1
command removes the +dg1/dir1/file.alias as well as
+dg/orcl/DATAFILE/System.256.146589651.
To delete only an alias and retain the file that the alias references, use the rmalias command.
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. This enables you
to 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. When
using the -r flag, either the system-generated file or the alias must be present in the directory
in which you run the rm command.
rmalias command
Deletes the specified aliases, retaining the files that the aliases reference.
rmalias [-r] alias [alias]...
To recursively delete, use the -r flag. This enables you to delete 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 as a result of deleting aliases, they are also deleted. Files
and directories created by the system are not deleted.
exit command
Exits ASMCMD and returns control to the OS command prompt.
exit
ASMCMD> exit
cp command
Used to copy files between ASM diskgroups on local instances to and from remote instances.
The local ASM instance must be either the source or the target. The file copy cannot be
between remote instances. We can also use this command to copy files from ASM diskgroups
to the OS.
cp [-ifr] [\@connect_identifier:]src_fname [\@connect_identifier:]tgt_fname
cp [-ifr] [\@connect_identifier:]src_fnameN[, src_fnameN+1…]
[\@connect_identifier:]tgt_directory
Flag Description
-i Interactive, prompt before copy file or overwrite.
-f Force, if an existing destination file, remove it and try again without user interaction.
-r Recursive, copy forwarding sub-directories recursively.
The connect_identifier parameter is not required for a local instance copy, which is default. In
case of a remote instance copy, we need to specify the connect_identifier and ASM prompts
for a password in a non-echoing prompt. The connect_identifier is in the form of:
user_name@host_name[.port_number].SID
The user_name, host_name, and SID are required. The default port number is 1521.
src_fname(s) - Source file name to copy from. Enter either the fully qualified file name, or the
ASM alias.
tgt_fname - A user alias for the created target file name or alias directory name.
tgt_directory - A target alias directory within an ASM diskgroup. The target directory must
exist, otherwise the file copy returns an error.
The format of copied files is portable between Little-Endian and Big-Endian systems, if the
files exist in an ASM diskgroup. ASM automatically converts the format when it writes the files.
For copying non-ASM files from or to an ASM diskgroup, you can copy the files to a different
endian platform and then use one of the commonly used utilities to convert the file.
ASMCMD [+] > cp +DG1/vdb.ctf1 /backups/vdb.ctf1
copying file(s)...
source +DG1/vdb.ctf1
target /backups/vdb.ctf1
file, /backups/vdb.ctf1, copy committed.
md_backup command
Creates a backup file containing metadata for one or more diskgroups. By default, all the
mounted diskgroups are included in the backup file which is saved in the current working
directory. If the name of the backup file is not specified, ASM names the file
AMBR_BACKUP_INTERMEDIATE_FILE. Here AMBR stands for ASM Managed Backup
Recovery.
md_backup [-b location_of_backup] [-g dgname [-g dgname...]]
md_backup [-b location_of_backup] [-g dgname[, dgname...]]
Flag Description
-b Specifies the location in which you want to store the intermediate backup file.
-g Specifies the diskgroup name that needs to be backed up.
This example backs up all of the mounted diskgroups and creates the backup in the current
working directory.
ASMCMD > md_backup
The following example creates a backup of diskgroup asmdsk1 and asmdsk2. The backup will
be saved in the /tmp/dgbackup100221 file.
ASMCMD > md_backup –b /tmp/dgbackup100221 –g admdsk1 –g asmdsk2
ASMCMD > md_backup -b /u01/backup/backup.txt -g dg_fra,dg_data
md_restore command
This command restores a diskgroup metadata backup.
md_restore -b backup_file [-li] [-t (full)|nodg|newdg] [-f sql_script_file] [-g
'dg_name,dg_name,...'] [-o 'old_dg_name:new_dg_name,...']
Flag Description
-b Reads the metadata information from backup_file.
-l Prints the messages to a file.
-i or --silent If md_restore encounters an error, it will stop. Specifying this flag ignores any errors.
Specifies the type of diskgroup to be created:
full - Create diskgroup and restore metadata.
-t
nodg - Restore metadata only.
newdg - Create diskgroup with a different name and restore metadata, -o is required to rename.
-f or -S Write SQL commands to sql_script_file instead of executing them.
Select the diskgroups to be restored. If no diskgroups are defined, then all diskgroups wil
-g or -G
restored.
-o Rename diskgroup old_dg_name to new_dg_name.
Example restores the diskgroup asmdsk1 from the backup script and creates a copy.
ASMCMD> md_restore –t full –g asmdsk1 –i backup_file
Example restores from the backup file after applying the overrides defined in the file
override.txt.
ASMCMD> md_restore –t newdg –of override.txt –i backup_file
Example restores the diskgroup data from the backup script and creates a copy.
ASMCMD [+] > md_restore –-full –G data –-silent /tmp/dgbackup20090714
Example restores diskgroup data completely but the new diskgroup that is created is called
data2.
ASMCMD [+] > md_restore –-newdg -o 'data:data2' --silent /tmp/dgbackup20090714
Example restores from the backup file after applying the overrides defined in the override.sql
script file.
ASMCMD [+] > md_restore -S override.sql --silent /tmp/dgbackup20090714
lsdsk command
List the disks that are visible to ASM, using V$ASM_DISK_STAT (default) or V$ASM_DISK.
lsdsk [-ksptcgHI] [-d diskgroup_name] [pattern]
Flag Description
(none) Displays PATH column of V$ASM_DISK.
Displays TOTAL_MB, FREE_MB, OS_MB, NAME, FAILGROUP, LIBRARY, LABE
-k
PRODUCT, REDUNDANCY, and PATH columns of V$ASM_DISK.
-s or --statistics Displays READS, WRITES, READ_ERRS, WRITE_ERRS, READ_TIME, WRI
BYTES_READ, BYTES_WRITTEN, and PATH columns of V$ASM_DISK.
Displays GROUP_NUMBER, DISK_NUMBER, INCARNATION, MOUNT
-p
HEADER_STATUS, MODE_STATUS, STATE, and PATH columns of V$ASM_DISK.
-t Displays CREATE_DATE, MOUNT_DATE, REPAIR_TIMER, and PATH columns of V$AS
Selects from GV$ASM_DISK_STAT or GV$ASM_DISK if the -c flag is also
-g
GV$ASM_DISK.INST_ID is included in the output.
Selects from V$ASM_DISK or GV$ASM_DISK, if the -g flag is also specified. This option
-c
if the ASM instance is version 10.1 or earlier.
-H Suppresses column headings.
Scans disk headers for information rather than extracting the information from an ASM
-I
This option forces the non-connected mode.
-d or -G Restricts results to only those disks that belong to the group specified by diskgroup_name
Selects from V$ASM_DISK, or from GV$ASM_DISK if the -g flag is also specified. This
--discovery always enabled if the Oracle ASM instance is version 10.1 or earlier. This flag is disr
lsdsk is running in non-connected mode.
Displays the disks that are visible to some but not all active instances. These are dis
-M included in a diskgroup, cause the mount of that diskgroup to fail on the instances where
are not visible.
--candidate Restricts results to only disks having membership status equal to CANDIDATE.
--member Restricts results to only disks having membership status equal to MEMBER.
pattern Returns only information about the specified disks that match the supplied pattern.
The k, s, p, and t flags modify how much information is displayed for each disk. If any
combinations of the flags are specified, then the output shows the union of the attributes
associated with each flag.
pattern restricts the output to only disks that matches the pattern specified.
ASMCMD> lsdsk -d DG_DATA -k
ASMCMD> lsdsk -g -t -d DATA1 *_001
This command can run in connected or non-connected mode. The connected mode is always
attempted first. The -I option forces the non-connected mode.
In connected mode, ASMCMD uses dynamic views to retrieve disk information.
In non-connected mode, ASMCMD scans disk headers to retrieve disk information, using an
ASM disk string to restrict the discovery set. This is not supported on Windows.
The first and second examples list information about disks in the data diskgroup.
ASMCMD [+] > lsdsk -t -G data
Create_Date Mount_Date Repair_Timer Path
13-JUL-09 13-JUL-09 0 /devices/diska1
13-JUL-09 13-JUL-09 0 /devices/diska2
13-JUL-09 13-JUL-09 0 /devices/diskb1
13-JUL-09 13-JUL-09 0 /devices/diskb2
remap command
Repairs range of physical blocks on a disk. The remap command only repairs blocks that
have read disk I/O errors. It does not repair blocks that contain corrupted contents, whether
those blocks can be read or not. The command assumes a physical block size of 512 bytes
and supports all allocation unit sizes (1MB to 64MB).
It reads the blocks from a good copy of an ASM mirror and rewrites them to an alternate
location on disk if the blocks on the original location cannot be read properly.
remap diskgroup_name disk_name block_range
Flag Description
diskgroup_name Name of the diskgroup in which a disk must be repaired.
disk_name Name of the disk that must be repaired.
block_range Range of physical blocks to repair, in the format: starting_number-ending_number
The following example repairs blocks 4500 through 5599 for disk DATA_001 in diskgroup
DISK_GRP_DATA.
ASMCMD> remap DISK_GRP_DATA DATA_001 4500-5599
The following example repairs blocks 7200 through 8899 for disk largedisk_2 in diskgroup
DISK_GRP_GRA.
ASMCMD> remap DISK_GRP_FRA largedisk_2 7200-8899
startup command
Starts up an Oracle ASM instance.
startup [--nomount] [--restrict] [--pfile pfile_name]
Flag Description
(default) Will mount diskgroups and enables Oracle ADVM volumes.
--nomount Specifies no mount operation.
--restrict Specifies restricted mode.
--pfile Oracle ASM initialization parameter file.
The following is an example of the startup command that starts the Oracle ASM instance
without mounting diskgroups and uses the asm_init.ora initialization parameter file.
ASMCMD> startup --nomount --pfile asm_init.ora
shutdown command
Shuts down an Oracle ASM instance.
shutdown [--abort|--immediate]
Flag Description
(default) normal shutdown.
--abort Shut down aborting all existing operations.
--immediate Shut down immediately.
Oracle strongly recommends that you shut down all database instances that use the Oracle
ASM instance and dismount all file systems mounted on Oracle ASM Dynamic Volume
Manager (Oracle ADVM) volumes before attempting to shut down the Oracle ASM instance
with the abort (--abort) option.
The first example performs a shutdown of the Oracle ASM instance with normal action.
ASMCMD [+] > shutdown
The third example performs a shut down that aborts all existing operations.
ASMCMD [+] > shutdown --abort
dsset command
Sets the discovery diskstring value that is used by the Oracle ASM instance and its clients.
The specified diskstring must be valid for existing mounted diskgroups. The updated value
takes effect immediately.
dsset [--normal] [--parameter] [--profile [--force]] diskstring
Flag Description
Sets the discovery string in the Grid Plug and Play (GPnP) profile and in the Oracle AS
The update occurs after the Oracle ASM instance has successfully validated that t
--normal discovery string has discovered all the necessary diskgroups and voting files. This com
the instance is not using a server parameter file (SPFILE).
This is the default setting.
Specifies the discovery diskstring that is pushed to the GPnP profile without any valid
Oracle ASM instance, ensuring that the instance can discover all the required disk
update is guaranteed to be propagated to all the nodes that are part of the cluster.
--profile [--force] If --force is specified, the specified diskstring is pushed to the local GPnP profile
synchronization with other nodes in the cluster. This command option updates only the
file. This option should only be used for recovery. The command fails if the Oracle
stack is running.
Specifies that the diskstring is updated in memory after validating that the discove
--parameter discovers all the current mounted diskgroups and voting files. The diskstring is not
recorded in either the SPFILE or the GPnP profile.
diskstring Specifies the value for the discovery diskstring.
The following example uses dsset to set the current value of the discovery diskstring in the
GPnP profile.
ASMCMD [+] > dsset /devices/disk*
dsget command
Retrieves the discovery diskstring value that is used by the Oracle ASM instance and its
clients.
dsget [[--normal] [--profile [--force]] [--parameter]]
Flag Description
Retrieves the discovery string from the Grid Plug and Play (GPnP) profile and the one
--normal the Oracle ASM instance. It returns one row each for the profile and parameter settin
default setting.
Retrieves the discovery string from the GPnP profile. If --force is specified, retrieves t
--profile [--force]
string from the local GPnP profile.
--parameter Retrieves the ASM_DISKSTRING parameter setting of the Oracle ASM instance.
The following example uses dsget to retrieve the current discovery diskstring value from the
GPnP profile and the ASM_DISKSTRING parameter.
ASMCMD [+] > dsget
profile: /devices/disk*
parameter: /devices/disk*
lspwusr command
List the current users from the local Oracle ASM password file.
lspwusr [-H]
orapwusr command
Add, drop, or modify an Oracle ASM password file user. The command requires the SYSASM
privilege to run. A user logged in as SYSDBA cannot change its password using this
command.
orapwusr {{ {--add | --modify [--password]}
[--privilege {sysasm|sysdba|sysoper}] } | --delete} user
Flag Description
--add Adds a user to the password file. Also prompts for a password.
--delete Drops a user from the password file.
--modify Changes a user in the password file.
--privilege Sets the role for the user. The options are sysasm, sysdba, and sysoper.
--password Prompts for and then changes the password of a user.
user Name of the user to add, drop, or modify.
This example adds the Satya to the Oracle ASM password file with the role of the user set to
SYSASM.
ASMCMD [+] > orapwusr --add --privilege sysasm Satya
ASMCMD [+] > lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
Satya TRUE TRUE TRUE
spset command
Sets the location of the Oracle ASM SPFILE in the Grid Plug and Play (GPnP) profile.
spset location
The following is an example of the spset command that sets the location of the Oracle ASM
SPFILE command in the dg_data diskgroup.
ASMCMD> spset +DG_DATA/asm/asmparameterfile/asmspfile.ora
spget command
Retrieves the location of the Oracle ASM SPFILE from the Grid Plug and Play (GPnP) profile.
spget
The location retrieved by spget is the location in the GPnP profile, but not always the location
of the SPFILE currently used. For example, the location could have been recently updated by
spset or spcopy with the -u option on an Oracle ASM instance that has not been restarted.
After the next restart of the Oracle ASM, this location point to the ASM SPFILE currently is
being used.
The following is an example of the spget command that retrieves and displays the location of
the SPFILE from the GPnP profile.
ASMCMD [+] > spget
+DATA/asm/asmparameterfile/registry.253.691575633
spbackup command
Backs up an Oracle ASM SPFILE. spbackup does not affect the GPnP profile.
spbackup source destination
The backup file that is created is not a special file type and is not identified as a SPFILE. This
file cannot be copied with spcopy. To copy this backup file, use the ASMCMD cp command.
The first example backs up the Oracle ASM SPFILE from one operating system location to
another.
ASMCMD> spbackup /u01/oracle/dbs/spfile+ASM.ora /u01/oracle/dbs/bakspfileASM.ora
The second example backs up the SPFILE from an operating system location to the
data/bakspfileASM.ora diskgroup.
ASMCMD> spbackup /u01/oracle/dbs/spfile+ASM.ora +DG_DATA/bakspfileASM.ora
spcopy command
Copies an Oracle ASM SPFILE from source to destination. To use spcopy to copy an Oracle
ASM SPFILE into a diskgroup, the diskgroup attribute COMPATIBLE.ASM must be set to 11.2
or greater.
spcopy [-u] source destination
-u updates the Grid Plug and Play (GPnP) profile. We can also use spset to update the GPnP
profile.
After copying the SPFILE, you must restart the instance with the SPFILE in the new location
to use that SPFILE. When the Oracle ASM instance is running with the SPFILE in the new
location, you can remove the source SPFILE.
The first example copies the Oracle ASM SPFILE from one operating system location to
another.
ASMCMD> spcopy /u01/oracle/dbs/spfile+ASM.ora /u01/oracle/dbs/testspfileASM.ora
The second example copies the SPFILE from an operating system location to the data
diskgroup and updates the GPnP profile.
ASMCMD> spcopy -u /u01/oracle/dbs/spfile+ASM.ora +DATA/testspfileASM.ora
spmove command
Moves an Oracle ASM SPFILE from source to destination and automatically updates the
GPnP profile. To use spmove to move an Oracle ASM SPFILE into a diskgroup, the diskgroup
attribute COMPATIBLE.ASM must be set to 11.2 or greater.
spmove source destination
The first example moves the Oracle ASM SPFILE from one operating system location to
another.
ASMCMD> spmove /u01/oracle/dbs/spfile+ASM.ora /u01/oracle/dbs/testspfileASM.ora
The second example moves the SPFILE from an operating system location to the data
diskgroup.
ASMCMD> spmove /u01/oracle/dbs/spfile+ASM.ora +DATA/testspfileASM.ora
lsop command
Lists the current operations on diskgroups or Oracle ASM instance, from
V$ASM_OPERATION.
lsop
The following example adds the asmdba2 user to the dg_fra diskgroup.
ASMCMD [+] > mkusr dg_fra asmdba2
lsusr command
Lists Oracle ASM users in a diskgroup.
lsusr [-Ha] [-G diskgroup] [pattern]
Flag Description
-H Suppresses column headings.
-a List all users and the diskgroups to which the users belong.
-G Limits the results to the specified diskgroup name.
pattern Displays the users that match the pattern expression.
The example lists users in the asm_dg_data diskgroup and also shows the OS user Id
assigned to the user.
ASMCMD [+] > lsusr -G asm_dg_data
User_Num OS_ID OS_Name
3 1001 oradba
1 1021 asmdba1
2 1022 asmdba2
ASMCMD [+] > lsusr -G asm_dg_fra asm*
User_Num OS_ID OS_Name
1 1021 asmdba1
2 1022 asmdba2
passwd command
Changes the password of a user. The command requires the SYSASM privilege to run.
passwd user
The user is first prompted for the current password, then the new password. An error will be
raised if the user does not exist in the Oracle ASM password file.
rmusr command
Deletes an OS user from a diskgroup. Only a user authenticated as SYSASM can run this
command.
rmusr [-r] diskgroup user
-r removes all files in the diskgroup that the user owns at the same time that the user is
removed.
The following is an example to remove the asmdba2 user from the dg_data2 diskgroup.
ASMCMD [+] > rmusr dg_data2 asmdba2
mkgrp command
Creates a new Oracle ASM user group. We can optionally specify a list of users to be
included as members of the new user group. User group name can have maximum 30
characters.
mkgrp diskgroup usergroup [user] [user...]
This example creates the asm_data user group in the dg_data diskgroup and adds the
asmdba1 and asmdba2 users to the user group.
ASMCMD [+] > mkgrp dg_data asm_data asmdba1 asmdba2
lsgrp command
Lists all Oracle ASM user groups.
lsgrp [-Ha] [-G diskgroup] [pattern]
Flag Description
-H Suppresses column headings.
-a Lists all columns.
-G Limits the results to the specified diskgroup name.
pattern Displays the user groups that match the pattern expression.
The following example displays a subset of information about the user groups whose name
matches the asm% pattern.
ASMCMD [+] > lsgrp asm%
DG_Name Grp_Name Owner
DG_FRA asm_fra grid
DG_DATA asm_data grid
The second example displays all information about all the user groups.
ASMCMD [+] > lsgrp –a –G DG_DATA
DG_Name Grp_Name Owner Members
DG_DATA asm_data grid asmdba1 asmdba2
SQL equivalent for lsgrp command is:
SQL> SELECT * FROM V$ASM_USERGROUP;
rmgrp command
Removes a user group from a diskgroup. The command must be run by the owner of the
group and also requires the SYSASM privilege to run.
rmgrp diskgroup usergroup
Removing a group might leave some files without a valid group. To ensure that those files
have a valid group, explicitly update those files to a valid group.
The following is an example of the rmgrp command that removes the asm_data user group
from the dg_data diskgroup.
ASMCMD [+] > rmgrp dg_data asm_data
grpmod command
Adds or removes OS users to and from an existing Oracle ASM user group. Only the owner of
the user group can use this command. The command requires the SYSASM privilege to run.
This command accepts an OS user name or multiple user names separated by spaces. The
OS users are typically owners of a database instance home.
grpmod {--add | --delete} diskgroup usergroup user [user...]
Flag Description
--add Specifies to add users to the user group.
--delete Specifies to delete users from the user group.
usergroup Name of the user group.
user Name of the user to add or remove from the user group.
The following example adds the asmdba1 and asmdba2 users to the asm_fra user group of
the dg_fra diskgroup.
ASMCMD [+] > grpmod –-add dg_fra asm_fra asmdba1 asmdba2
The second example removes the asmdba2 user from the asm_data user group of the
dg_data diskgroup.
ASMCMD [+] > grpmod –-delete dg_data asm_data asmdba2
groups command
Lists all the user groups to which the specified user belongs.
groups diskgroup user
chmod command
Changes permissions of a file or list of files. This command accepts a file name or multiple file
names separated by spaces. The specified files must be closed.
chmod mode file [file ...]
We can only set file permissions to read-write, read-only, and no permissions. We cannot set
file permissions to write-only.
ASMCMD [+fra/orcl/archivelog/flashback] > chmod ug+rw log_7.264.684968167
log_8.265.684972027
To view the permissions on a file, use the ASMCMD ls command with the --permission option.
ASMCMD [+] > ls --permission +fra/orcl/archivelog/flashback
User Group Permission Name
grid asm_fra rw-r----- log_7.264.684968167
grid asm_fra rw-r----- log_8.265.684972027
chown command
Changes the owner of a file or list of files. This command accepts a file name or multiple file
names separated by spaces. The specified files must be closed. Only the Oracle ASM
administrator can use this command.
chown user[:usergroup ] file [file ...]
user typically refers to the user that owns the database instance home. Oracle ASM File
Access Control uses the OS name to identify a database.
ASMCMD [+fra/orcl/archivelog/flashback] > chown asmdba1 log_7.264.684968167
log_8.265.684972027
chgrp command
Changes the Oracle ASM user group of a file or list of files. This command accepts a file
name or multiple file names separated by spaces. Only the file owner or the Oracle ASM
administrator can use this command. If the user is the file owner, then he must also be either
the owner or a member of the group for this command to succeed.
chgrp usergroup file [file ...]
mkdg command
Creates a diskgroup based on an XML configuration file which specifies the name of the
diskgroup, redundancy, attributes, and paths of the disks that form the diskgroup.
mkdg {config_file.xml | 'contents_of_xml_file'}
Flag Description
Name of the XML file that contains the configuration for the new diskgroup. m
config_file
XML file in the directory where ASMCMD was started unless a path is specifie
contents_of_xml_file The XML script enclosed in single quotations.
Redundancy is an optional parameter; the default is normal redundancy. For some types of
redundancy, disks are required to be gathered into failure groups. In the case that failure
groups are not specified for a diskgroup, each disk in the diskgroup belongs to its own failure
group.
It is possible to set some diskgroup attribute values during diskgroup creation. Some
attributes, such as AU_SIZE and SECTOR_SIZE, can be set only during diskgroup creation.
The default diskgroup compatibility settings are 10.1 for Oracle ASM compatibility, 10.1 for
database compatibility, and no value for Oracle ADVM compatibility.
<dsk> disk
name disk name
path disk path
size size of the disk to add
</dsk>
<a> attribute
name attribute name
value attribute value
</a>
</dg>
The following is an example of an XML configuration file for mkdg. The configuration file
creates a diskgroup named dg_data with normal redundancy. Two failure groups, fg1 and fg2,
are created, each with two disks identified by associated disk strings. The diskgroup
compatibility attributes are all set to 11.2.
<dg name="dg_data" redundancy="normal">
<fg name="fg1">
<dsk string="/dev/disk1"/>
<dsk string="/dev/disk2"/>
</fg>
<fg name="fg2">
<dsk string="/dev/disk3"/>
<dsk string="/dev/disk4"/>
</fg>
<a name="compatible.asm" value="11.2"/>
<a name="compatible.rdbms" value="11.2"/>
<a name="compatible.advm" value="11.2"/>
</dg>
The first example executes mkdg with an XML configuration file in the directory where
ASMCMD was started.
ASMCMD [+] > mkdg data_config.xml
The second example executes mkdg using information on the command line.
ASMCMD [+] > mkdg '<dg name="data"><dsk path="/dev/disk*"/></dg>'
chdg command
Changes a diskgroup (adds disks, drops disks, or rebalances) based on an XML configuration
file.
chdg {config_file.xml | 'contents_of_xml_file'}
Flag Description
Name of the XML file that contains the changes for the diskgroup. chdg searc
config_file
the directory where ASMCMD was started unless a path is specified.
contents_of_xml_file The XML script enclosed in single quotations.
The modification includes adding or deleting disks from an existing diskgroup, and the setting
rebalance power level. The power level can set from 0 to the maximum of 11, the same
values as the ASM_POWER_LIMIT initialization parameter.
When adding disks to a diskgroup, the diskstring must be specified in a format similar to the
ASM_DISKSTRING initialization parameter.
The failure groups are optional parameters. The default causes every disk to belong to a its
own failure group.
Dropping disks from a diskgroup can be performed through this operation. An individual disk
can be referenced by its Oracle ASM disk name. A set of disks that belong to a failure group
can be specified by the failure group name.
We can resize a disk inside a diskgroup with chdg. The resize operation fails if there is not
enough space for storing data after the resize.
<dsk> disk
name disk name
path disk path
size size of the disk to add
</dsk>
</chdg>
The following is an example of an XML configuration file for chdg. This XML file alters the
diskgroup named data. The failure group fg1 is dropped and the disk data_0001 is also
dropped. The /dev/disk8 disk is added to failure group fg2. The rebalance power level is set to
4.
<chdg name="data" power="4">
<drop>
<fg name="fg1"></fg>
<dsk name="data_0001"/>
</drop>
<add>
<fg name="fg2">
<dsk string="/dev/disk8"/>
</fg>
</add>
</chdg>
The following are examples of the chdg command with the configuration file or configuration
information on the command line.
ASMCMD [+] > chdg data_config.xml
Flag Description
-f Force the operation. Only applicable if the diskgroup cannot be mounted.
-r Recursive, include contents.
diskgroup Name of diskgroup to drop.
The first example forces the drop of the diskgroup dg_data, including any data in the
diskgroup.
ASMCMD [+] > dropdg -r -f dg_data
The second example drops the diskgroup dg_fra, including any data in the diskgroup.
ASMCMD [+] > dropdg -r dg_fra
chkdg command
Checks or repairs the metadata of a diskgroup. chkdg checks the metadata of a diskgroup for
errors and optionally repairs the errors.
chkdg [--repair] diskgroup
The following is an example of the chkdg command used to check and repair the dg_data
diskgroup.
ASMCMD [+] > chkdg --repair dg_data
mount command
Will mount the specified diskgroups. This operation mounts one or more diskgroups. A
diskgroup can be mounted with or without force or restricted options.
mount [--restrict] {[-a] | [-f] diskgroup[,diskgroup,...]}
Flag Description
--restrict Mounts in restricted mode.
-a Mounts all diskgroups.
-f Forces the mount operation.
diskgroup Name of the diskgroup.
The following are examples of the mount command showing the use of the force, restrict, and
all options.
ASMCMD [+] > mount -f data
umount command
Will dismount the specified diskgroup.
umount {-a | [-f] diskgroup}
Flag Description
Dismounts all mounted diskgroups. These disk groups are listed in the output
-a
V$ASM_DISKGROUP view.
-f Forces the dismount operation.
diskgroup Name of the diskgroup.
The first example dismounts all diskgroups mounted on the Oracle ASM instance.
ASMCMD [+] > umount -a
The second example forces the dismount of the data disk group.
ASMCMD [+] > umount -f data
offline command
Offline disks or failure groups that belong to a diskgroup.
offline -G diskgroup {-F failgroup|-D disk} [-t {minutes|hours}]
Flag Description
-G Diskgroup name.
-F Failure group name.
-D Specifies a single disk name.
Specifies the time before the specified disk is dropped as nm or nh, where m specifies minutes and
-t
h specifies hours. The default unit is hours.
When a failure group is specified, this implies all the disks that belong to it should be offlined.
The first example offlines the failgroup1 failure group of the dg_data diskgroup.
ASMCMD [+] > offline -G dg_data -F failgroup1
The second example offlines the data_0001 disk of the dg_data diskgroup with a time of 1.5
hours before the disk is dropped.
ASMCMD [+] > offline -G dg_data -D data_0001 -t 1.5h
online command
Online all disks, a single disk, or a failure group that belongs to a diskgroup.
online {[-a] -G diskgroup|-F failgroup|-D disk} [-w]
Flag Description
-a Online all offline disks in the diskgroup.
-G Diskgroup name.
-F Failure group name.
-D Disk name.
Wait option. Causes ASMCMD to wait for the diskgroup to be rebalanced before returning control to
-w
the user. The default is not waiting.
When a failure group is specified, this implies all the disks that belong to it should be onlined.
The first example onlines all disks in the failgroup1 failure group of the dg_data diskgroup with
the wait option enabled.
ASMCMD [+] > online -G dg_data -F failgroup1 -w
The second example onlines the data_0001 disk in the dg_data diskgroup.
ASMCMD [+] > online -G dg_data -D data_0001
rebal command
Rebalances a diskgroup. The power level can be set from 0 to 11. A value of 0 disables
rebalancing. If the rebalance power is not specified, the value defaults to the setting of the
ASM_POWER_LIMIT initialization parameter.
rebal [--power power_value] [-w] diskgroup
Flag Description
--power Power setting (0 to 11).
Wait option. Causes ASMCMD to wait for the diskgroup to be rebalanced before returning c
-w
the user. The default is not waiting.
diskgroup Diskgroup name.
The following example rebalances the dg_fra diskgroup with a power level set to 6.
ASMCMD [+] > rebal --power 6 dg_fra
We can determine if a rebalance operation is occurring with the ASMCMD lsop command.
ASMCMD [+] > lsop
Group_Name Dsk_Num State Power
FRA REBAL RUN 6
iostat command
Will display I/O statistics of disks in mounted ASM diskgroups, by using
V$ASM_DISK_IOSTAT.
iostat [-etH] [--io] [--region] [-G diskgroup] [interval]
Flag Description
-e Displays error statistics (Read_Err, Write_Err).
-t Displays time statistics (Read_Time, Write_Time).
-H Suppresses column headings.
--io Displays information in number of I/Os, instead of bytes.
Displays information for cold and hot disk regions (Cold_Reads, Cold_Writes, Hot_R
--region
Hot_Writes).
-G Displays statistics for the diskgroup name.
Refreshes the statistics display based on the interval value (seconds). Use Ctrl-C to sto
interval
interval display.
To see the complete set of statistics for a diskgroup, use the V$ASM_DISK_IOSTAT view.
Attribute Name Description
Group_Name Name of the diskgroup.
Dsk_Name Name of the disk.
Number of bytes read from the disk. If the --io option is entered, then the valu
Reads
number of I/Os.
Number of bytes written from the disk. If the --io option is entered, then the valu
Writes
number of I/Os.
Number of bytes read from the cold disk region. If the --io option is entered,
Cold_Reads
displayed as number of I/Os.
Number of bytes written from the cold disk region. If the --io option is entered,
Cold_Writes
displayed as number of I/Os.
Number of bytes read from the hot disk region. If the --io option is entered,
Hot_Reads
displayed as number of I/Os.
Number of bytes written from the hot disk region. If the --io option is entered,
Hot_Writes
displayed as number of I/Os.
Read_Err Number of failed I/O read requests for the disk.
Write_Err Number of failed I/O write requests for the disk.
I/O time (in hundredths of a second) for read requests for th
Read_Time
TIMED_STATISTICSinitialization parameter is set to TRUE (0 if set to FALSE).
I/O time (in hundredths of a second) for write requests for th
Write_Time
TIMED_STATISTICSinitialization parameter is set to TRUE (0 if set to FALSE).
If a refresh interval is not specified, the number displayed represents the total number of
bytes or I/Os. If a refresh interval is specified, then the value displayed (bytes or I/Os) is the
difference between the previous and current values, not the total value.
The first example displays disk I/O statistics for the data diskgroup in total number of bytes.
The second example displays disk I/O statistics for the data diskgroup in total number of I/O
operations.
ASMCMD [+] > iostat --io -G data
Group_Name Dsk_Name Reads Writes
DATA DATA_0000 2801 34918
DATA DATA_0001 58301 35700
DATA DATA_0002 3320 36345
ASMCMD> iostat -t
Group_Name Disk_Name Reads Writes Read_Time Write_Time
FRA DATA_0099 54601 38411 441.234546 672.694266
setattr command
setattr command will change an attribute of a diskgroup.
setattr -G disk_group attribute_name attribute_value
lsattr command
List attributes of a diskgroup, from V$ASM_ATTRIBUTE.
lsattr [-G diskgroup] [-Hlm] [pattern]
Flag Description
-G Diskgroup name.
-H Suppresses column headings.
-l Display names with values.
-m Displays additional information, such as the RO and Sys columns.
pattern Display the attributes that contain pattern expression.
The RO (read-only) column identifies those attributes that can only be set when a diskgroup is
created. The Sys column identifies those attributes that are system-created.
lsod command
Lists the open ASM disks.
lsod [-H] [-G diskgroup] [--process process_name] [pattern]
Flag Description
-H Suppresses column header information from the output.
-G Specifies the diskgroup that contains the open disks.
--process Specifies a pattern to filter the list of processes.
pattern Specifies a pattern to filter the list of disks.
The rebalance operation (RBAL) opens a disk both globally and locally so the same disk may
be listed twice in the output for the RBAL process.
The first example lists the open devices associated with the data diskgroup and the LGWR
process.
ASMCMD [+] > lsod -G data --process LGWR
Instance Process OSPID Path
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska1
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska2
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska3
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diskb1
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diskb2
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diskb3
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diskd1
The second example lists the open devices associated with the LGWR process for disks that
match the diska pattern.
ASMCMD [+] > lsod --process LGWR diska
Instance Process OSPID Path
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska1
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska2
1 oracle@dadvmn0652 (LGWR) 26593 /devices/diska3
Flag Description
-G Name of the diskgroup.
--striping Striping specification, either coarse or fine.
--redundancy Redundancy specification, either high, mirror, or unprotected.
--primary Intelligent Data Placement specification for primary extents, either hot or cold region.
--secondary Intelligent Data Placement specification for secondary extents, either hot or cold regi
template Name of the template to create.
The following example adds temp_mc template to the dg_data diskgroup. The new template
has the redundancy set to mirror and the striping set to coarse.
ASMCMD [+] > mktmpl -G dg_data --redundancy mirror --striping coarse temp_mc
lstmpl command
Lists all templates or the templates for a specified diskgroup.
lstmpl [-Hl] [-G diskgroup] [pattern]
Flag Description
-H Suppresses column headings.
-l Displays all details.
-G Specifies diskgroup name.
pattern Displays the templates that match pattern expression.
The example lists all details of the templates in the dg_data diskgroup.
ASMCMD [+] > lstmpl -l -G dg_data
Group_Name Group_Num Name Stripe Sys Redund PriReg MirrReg
DG_DATA 1 ARCHIVELOG COARSE Y MIRROR COLD COLD
DG_DATA 1 ASMPARAMETERFILE COARSE Y MIRROR COLD COLD
DG_DATA 1 AUTOBACKUP COARSE Y MIRROR COLD COLD
DG_DATA 1 BACKUPSET COARSE Y MIRROR COLD COLD
DG_DATA 1 CHANGETRACKING COARSE Y MIRROR COLD COLD
DG_DATA 1 CONTROLFILE FINE Y HIGH COLD COLD
DG_DATA 1 DATAFILE COARSE Y MIRROR COLD COLD
DG_DATA 1 DATAGUARDCONFIG COARSE Y MIRROR COLD COLD
DG_DATA 1 DUMPSET COARSE Y MIRROR COLD COLD
DG_DATA 1 FLASHBACK COARSE Y MIRROR COLD COLD
DG_DATA 1 MYTEMPLATE FINE N HIGH COLD COLD
DG_DATA 1 OCRFILE COARSE Y MIRROR COLD COLD
DG_DATA 1 ONLINELOG COARSE Y MIRROR COLD COLD
DG_DATA 1 PARAMETERFILE COARSE Y MIRROR COLD COLD
DG_DATA 1 TEMPFILE COARSE Y MIRROR COLD COLD
DG_DATA 1 XTRANSPORT COARSE Y MIRROR COLD COLD
chtmpl command
Changes the attributes of a template.
chtmpl -G diskgroup { [--striping {coarse|fine}]
[--redundancy {high|mirror|unprotected}] [--primary {hot|cold}]
[--secondary {hot|cold}]} template
Flag Description
-G Name of the diskgroup.
--striping Striping specification, either coarse or fine.
--redundancy Redundancy specification, either high, mirror, or unprotected.
--primary Intelligent Data Placement specification for primary extents, either hot or cold region
--secondary Intelligent Data Placement specification for secondary extents, either hot or cold reg
template Name of the template to change.
The following example updates temp_hf template of the dg_fra diskgroup. The redundancy
attribute is set to high and the striping attribute is set to fine.
ASMCMD [+] > chtmpl -G dg_fra --redundancy high --striping fine temp_hf
rmtmpl command
Removes a template from a diskgroup.
rmtmpl -G diskgroup template
The following example removes temp_uf template from the dg_data diskgroup.
ASMCMD [+] > rmtmpl -G dg_data temp_uf
When creating an Oracle ADVM volume, a volume device name is created with a unique
Oracle ADVM persistent diskgroup number that is concatenated to the end of the volume
name. The unique number can be one to three digits.
On Linux, the volume device name is in the format volume_name-nnn, such as volume1-123.
On Windows the volume device name is in the format asm-volume_name-nnn, such as asm-
volume1-123.
The volume device file functions as any other disk or logical volume to mount file systems or
for applications to use directly.
The following example creates volume1 in the dg_data diskgroup with the size set to 10
gigabytes.
ASMCMD [+] > volcreate -G dg_data -s 10G --width 64K --column 8 volume1
You can determine the volume device name with the volinfo command.
ASMCMD [+] > volinfo -G dg_data volume1
Diskgroup Name: DATA
Volume Name: VOLUME1
Volume Device: /dev/asm/volume1-123
State: ENABLED
Size (MB): 10240
Resize Unit (MB): 512
Redundancy: MIRROR
Stripe Columns: 8
Stripe Width (K): 64
Usage:
Mountpath:
volinfo command
Displays information about Oracle ADVM volumes.
volinfo {-a | -G diskgroup -a | -G diskgroup volume}
volinfo [--show_diskgroup|--show_volume] volumedevice}
Flag Description
When used without a diskgroup name, specifies all volumes within all diskg
-a
a diskgroup name (-G diskgroup -a), specifies all volumes within that diskgro
-G Name of the diskgroup containing the volume.
volume Name of the volume.
--show_diskgroup Returns only the diskgroup name. A volume device name is required.
--show_volume Returns only the volume name. A volume device name is required.
volumedevice Name of the volume device.
The first example displays information about the volume1 volume in the dg_data diskgroup
and was produced in a Linux environment. The mount path field displays the last mount path
for the volume.
ASMCMD [+] > volinfo -G dg_data volume1
Diskgroup Name: DG_DATA
Volume Name: VOLUME1
Volume Device: /dev/asm/volume1-123
State: ENABLED
Size (MB): 10240
Resize Unit (MB): 512
Redundancy: MIRROR
Stripe Columns: 8
Stripe Width (K): 64
Usage: ACFS
Mountpath: /u01/app/acfsmounts/acfs1
The second example displays information about the asm-volume1 volume in the dg_data
diskgroup and was produced in a Windows environment.
ASMCMD [+] > volinfo -G dg_data -a
Diskgroup Name: DG_DATA
Volume Name: VOLUME1
Volume Device: \\.\asm-volume1-311
State: ENABLED
Size (MB): 1024
Resize Unit (MB): 256
Redundancy: MIRROR
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: C:\oracle\acfsmounts\acfs1
voldelete command
Deletes an Oracle ADVM volume.
voldelete -G diskgroup volume
To successfully execute this command, the local Oracle ASM instance must be running and
the diskgroup required by this command must be mounted in the Oracle ASM instance.
Before deleting a volume, you must ensure that there are no active file systems associated
with the volume.
voldisable command
Disables Oracle ADVM volumes in mounted diskgroups and removes the volume device on
the local node.
voldisable {-a | -G diskgroup -a | -G diskgroup volume}
Flag Description
When used without a diskgroup name, specifies all volumes within all diskgroups.
-a
When used with a diskgroup name (-G diskgroup -a), specifies all volumes within that diskgr
-G Name of the diskgroup containing the volume.
Name of the volume to be operated on. Can be maximum of 30 alphanumeric characters. T
volume
character must be alphabetic.
You can disable volumes before shutting down an Oracle ASM instance or dismounting a
diskgroup to verify that the operations can be accomplished normally without including a force
option due to open volume files. Disabling a volume also prevents any subsequent opens on
the volume or device file because it no longer exists.
Before disabling a volume, you must ensure that there are no active file systems associated
with the volume. You must first dismount the Oracle ACFS file system before disabling the
volume. You can delete a volume without first disabling the volume.
volenable command
Enables Oracle ADVM volumes in mounted diskgroups. A volume is enabled when it is
created.
volenable {-a | -G diskgroup -a | -G diskgroup volume}
Description
Flag
When used without a diskgroup name, specifies all volumes within all diskgroups.
-a
When used with a diskgroup name (-G diskgroup -a), specifies all volumes within that diskg
-G Name of the diskgroup containing the volume.
volume Name of the volume to be operated on.
volresize command
Resizes an Oracle ADVM volume.
volresize -G diskgroup -s size [-f] volume
Flag Description
-G Name of the diskgroup containing the volume.
Force the shrinking of a volume that is not an Oracle ACFS volume to suppress the
-f
message.
volume Name of the volume to be operated on.
-s New size of the volume in units of K, M, G, or T.
If the volume is mounted on a non-Oracle ACFS file system, then dismount the file system
first before resizing. If the new size is smaller than current, you are warned of possible data
corruption. Unless the -f (force) option is specified, you are prompted whether to continue with
the operation.
If there is an Oracle ACFS file system on the volume, then you cannot resize the volume with
the volresize command. You must use the acfsutil size command, which also resizes the
volume and file system.
The following is an example of the volresize command that resizes volume1 in the dg_data
diskgroup to 20 gigabytes.
ASMCMD [+] > volresize -G dg_data -s 20G volume1
volset commnad
Sets attributes of an Oracle ADVM volume in mounted diskgroups.
volset -G diskgroup [--usagestring string] [--mountpath mount_path] [--primary {hot|cold}] [--
secondary {hot|cold}] volume
Flag Description
-G Name of the diskgroup containing the volume.
Optional usage string to tag a volume which can be up to 30 characters. This str
--usagestring
when the volume is attached to an Oracle ACFS file system and should not be ch
--mountpath Optional string to tag a volume with its mount path string which can be up to 102
string is set when the file system is mounted and should not be changed.
--primary Intelligent Data Placement specification for primary extents, either hot or cold reg
--secondary Intelligent Data Placement specification for secondary extents, either hot or cold r
volume Name of the volume to be operated on.
When running the mkfs command to create a file system, the usage field is set to ACFS and
mountpath field is reset to an empty string if it has been set. The usage field should remain at
ACFS.
When running the mount command to mount a file system, the mountpath field is set to the
mount path value to identify the mount point for the file system. After the value is set by the
mount command, the mountpath field should not be updated.
The following is an example of a volset command that sets the usage string for a volume that
is not associated with a file system.
ASMCMD [+] > volset -G dg_arch --usagestring 'no file system created' volume1
ASMCMD [+] > volset -G dg_data --usagestring 'acfs' volume1
volstat command
Reports I/O statistics for Oracle ADVM volumes.
volstat [-G diskgroup] [volume]
The following is an example of the volstat command that displays information about volumes
in the dg_data diskgroup.
ASMCMD [+] > volstat -G dg_data
DISKGROUP NUMBER / NAME: 1 / DG_DATA
---------------------------------------
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
-------------------------------------------------------------
VOLUME1
10085 2290573312 22923 0
1382 5309440 1482 0
lsof command
Lists the open files of the local clients.
lsof [-H] {-G diskgroup|--dbname db|-C instance}
Flag Description
-H Suppresses column headings.
-G List files only from this specified disk group.
--dbname List files only from this specified database.
-C List files only from this specified instance.
6. How to find out the databases, which are using the ASM instance?
ASMCMD> lsct
SQL> select DB_NAME from V$ASM_CLIENT;