Automatic Storage Management (ASM) Command line utility (ASMCMD), introduced with Oracle Database 10g release 2.
(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 version 11.1.0.6.0
$ asmcmd md_restore -b /u01/app/oracle/BACKUP/asm_md_backup -t nodg
ASMCMD> help lsct
ASMCMD> ? mkgrp
Flag | Description |
---|---|
(none) | Displays only filenames and directory names. |
-l | Displays extended file information, including striping and redundancy information and whether the file was system-generated (indicated by Y under the SYS column) or user-created (as in the case of an alias, indicated by N under the SYS column). Note that not all possible file attributes or diskgroup attributes are included. |
-s | Displays file space information. |
-d | If the value for the name argument is a directory, then ASMCMD displays information about that directory, rather than the directory contents. Typically used with another flag, such as the -l flag. |
-r or –reverse |
Reverses the sort order of the listing. |
-t | Sorts the listing by timestamp. |
-L | If the value for the name argument is an alias, then ASMCMD displays information about the file that it references. Typically used with another flag, such as the -l flag. |
-a | For each listed file, displays the absolute path of the alias that references it. |
-c | Selects from V$ASM_DISKGROUP or GV$ASM_DISKGROUP if the -g flag is also specified. |
-g | Selects from GV$ASM_DISKGROUP_STAT or GV$ASM_DISKGROUP if the -c flag is also specified. GV$ASM_DISKGOUP.INST_ID is included in the output. |
-H | Suppresses column headings. |
–permission | Shows the permissions of a file (V$ASM_FILE.permission, V$ASM_FILE.owner, V$ASM_FILE.usergroup, V$ASM_ALIAS.name). |
pattern | Name of a file, directory, or pattern. |
lsct command
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. |
lsdg [-gH] [–discovery] [pattern] (11.2.0 syntax)
Flag | Description |
---|---|
(none) | Displays all the diskgroup attributes. |
-c or –discovery | Selects from V$ASM_DISKGROUP or GV$ASM_DISKGROUP if the -g flag is also specified. This option is ignored if the ASM instance is version 10.1 or earlier. |
-g | Selects from GV$ASM_DISKGROUP_STAT or GV$ASM_DISKGROUP if the -c or –discovery flag is also specified. GV$ASM_DISKGOUP.INST_ID is included in the output. The REBAL column of the GV$ASM_OPERATION is also included in the output. |
-H | Suppresses column headings. |
pattern | Returns only information about the specified diskgroup or diskgroups that match the supplied pattern. |
Attribute Name | Description |
---|---|
State | State of the diskgroup (BROKEN, CONNECTED, DISMOUNTED, MOUNTED, QUIESCING, and UNKNOWN). |
Type | Diskgroup redundancy (NORMAL, HIGH, EXTERN). |
Rebal | Y if a rebalance operation is in progress. |
Sector | Sector size in bytes. |
Block | Block size in bytes. |
AU | Allocation unit size in bytes. |
Total_MB | Size of the diskgroup in MB. |
Free_MB | Free space in the diskgroup in MB, without redundancy, from V$ASM_DISKGROUP. |
Req_mir_free_MB | Amount of space that must be available in the diskgroup to restore full redundancy after the most severe failure that can be tolerated by the diskgroup. This is the REQUIRED_MIRROR_FREE_MB column from V$ASM_DISKGROUP. |
Usable_file_MB | Amount of free space, adjusted for mirroring, that is available for new files, from V$ASM_DISKGROUP. |
Offline_disks | Number of offline disks in the diskgroup. Offline disks are eventually dropped. |
Name | Diskgroup name. |
Voting_files | Specifies whether the diskgroup contains voting files (Y or N). |
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
Flag | Description |
---|---|
-f | Force, remove it without user interaction. |
-r | Recursive, remove sub-directories also. |
SQL> ALTER DISKGROUP dg_name DELETE ALIAS user_alias;
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. |
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. |
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,…’]
md_restore backup_file [–silent]
[–full|–nodg|–newdg -o ‘old_diskgroup:new_diskgroup [,…]’]
[-S sql_script_file] [-G ‘diskgroup [,diskgroup…]’] (11g R2 syntax)
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. |
-t | Specifies the type of diskgroup to be created:
full – Create diskgroup and restore metadata.
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. |
-g or -G | Select the diskgroups to be restored. If no diskgroups are defined, then all diskgroups will be restored. |
-o | Rename diskgroup old_dg_name to new_dg_name. |
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 takes an existing diskgroup data and restores its metadata.
ASMCMD [+] > md_restore –-nodg –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 [-ksptcgHI] [-d diskgroup_name] [pattern]
lsdsk [-kptgMHI] [-G diskgroup] [–member|–candidate]
[–discovery] [–statistics] [pattern] (11g R2 syntax)
Flag | Description |
---|---|
(none) | Displays PATH column of V$ASM_DISK. |
-k | Displays TOTAL_MB, FREE_MB, OS_MB, NAME, FAILGROUP, LIBRARY, LABEL, UDID, PRODUCT, REDUNDANCY, and PATH columns of V$ASM_DISK. |
-s or –statistics | Displays READS, WRITES, READ_ERRS, WRITE_ERRS, READ_TIME, WRITE_TIME, BYTES_READ, BYTES_WRITTEN, and PATH columns of V$ASM_DISK. |
-p | Displays GROUP_NUMBER, DISK_NUMBER, INCARNATION, MOUNT_STATUS, 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$ASM_DISK. |
-g | Selects from GV$ASM_DISK_STAT or GV$ASM_DISK if the -c flag is also specified. GV$ASM_DISK.INST_ID is included in the output. |
-c | Selects from V$ASM_DISK or GV$ASM_DISK, if the -g flag is also specified. This option is ignored if the ASM instance is version 10.1 or earlier. |
-H | Suppresses column headings. |
-I | Scans disk headers for information rather than extracting the information from an ASM instance. 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. |
–discovery | Selects from V$ASM_DISK, or from GV$ASM_DISK if the -g flag is also specified. This option is always enabled if the Oracle ASM instance is version 10.1 or earlier. This flag is disregarded if lsdsk is running in non-connected mode. |
-M | Displays the disks that are visible to some but not all active instances. These are disks that, if included in a diskgroup, cause the mount of that diskgroup to fail on the instances where the disks 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. |
ASMCMD> lsdsk -Ct -d ASM_DG_DATA *_001
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
ASMCMD [+] > lsdsk -p -G data /devices/diska*
Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path
1 0 2105454210 CACHED MEMBER ONLINE NORMAL /devices/diska1
1 1 2105454199 CACHED MEMBER ONLINE NORMAL /devices/diska2
1 2 2105454205 CACHED MEMBER ONLINE NORMAL /devices/diska3
The third example lists information about candidate disks.
ASMCMD [+] > lsdsk –candidate -p
Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Path
0 5 2105454171 CLOSED CANDIDATE ONLINE NORMAL /devices/diske1
0 25 2105454191 CLOSED CANDIDATE ONLINE NORMAL /devices/diske2
0 18 2105454184 CLOSED CANDIDATE ONLINE NORMAL /devices/diske3
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.
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 |
From 11g release 2, ASMCMD utility can also do
- startup and shutdown of ASM instances.
- Managing diskgroups (create, mount, alter, drop).
- File access control (like OS, ugo and rwx …).
- User management.
- Template management.
- Volume management.
ASMCMD Instance Management Commands
startup command
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.
shutdown command
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.
dsset command
Flag | Description |
---|---|
–normal | Sets the discovery string in the Grid Plug and Play (GPnP) profile and in the Oracle ASM instance. The update occurs after the Oracle ASM instance has successfully validated that the specified discovery string has discovered all the necessary diskgroups and voting files. This command fails if the instance is not using a server parameter file (SPFILE).
This is the default setting.
|
–profile [–force] | Specifies the discovery diskstring that is pushed to the GPnP profile without any validation by the Oracle ASM instance, ensuring that the instance can discover all the required diskgroups. The update is guaranteed to be propagated to all the nodes that are part of the cluster.
If –force is specified, the specified diskstring is pushed to the local GPnP profile without any synchronization with other nodes in the cluster. This command option updates only the local profile file. This option should only be used for recovery. The command fails if the Oracle Clusterware stack is running.
|
–parameter | Specifies that the diskstring is updated in memory after validating that the discovery diskstring discovers all the current mounted diskgroups and voting files. The diskstring is not persistently recorded in either the SPFILE or the GPnP profile. |
diskstring | Specifies the value for the discovery diskstring. |
Flag | Description |
---|---|
–normal | Retrieves the discovery string from the Grid Plug and Play (GPnP) profile and the one that is set in the Oracle ASM instance. It returns one row each for the profile and parameter setting. This is the default setting. |
–profile [–force] | Retrieves the discovery string from the GPnP profile. If –force is specified, retrieves the discovery string from the local GPnP profile. |
–parameter | Retrieves the ASM_DISKSTRING parameter setting of the Oracle ASM instance. |
lspwusr command
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. |
orapwusr attempts to update passwords on all nodes in a cluster.
-
- spcopy can copy an Oracle ASM SPFILE from a diskgroup to a different diskgroup or to an operating system file.
- spcopy can copy an Oracle ASM SPFILE from an operating system file to a diskgroup or to an operating system file.
- spcopy can copy an Oracle ASM SPFILE when the SPFILE is being used by an open Oracle ASM instance.
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.
-
- spmove can move an Oracle ASM SPFILE when the open instance is using a PFILE or a different SPFILE. After moving the SPFILE, you must restart the instance with the SPFILE in the new location to use that SPFILE.
- spmove cannot move an Oracle ASM SPFILE when the SPFILE is being used by an open Oracle ASM instance.
The first example moves the Oracle ASM SPFILE from one operating system location to another.
ASMCMD File Access Control Commands
The following example adds the asmdba2 user to the dg_fra diskgroup.
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. |
SQL> ALTER DISKGROUP disk_group ADD USERGROUP ‘usergroup_name’ WITH MEMBER ‘user_names’;
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. |
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. |
SQL> ALTER DISKGROUP disk_group MODIFY USERGROUP ‘usergroup_name’ DROP MEMBER ‘user_name’;
- {ugo|ug|uo|go|u|g|o|a} {+|-} {r|w|rw}
a specifies permissions for all users, u specifies permissions for the owner/user of the file, g specifies the group permissions, and o specifies permissions for other users. - {0|4|6} {0|4|6} {0|4|6}
The first digit specifies owner permissions, the second digit specifies group permissions, and the third digit specifies other permissions.
Flag | Description |
---|---|
6 | Read write permissions |
4 | Read only permissions |
0 | No permissions |
u | Owner permissions, used with r or w |
g | Group permissions, used with r or w |
o | Other user permissions, used with r or w |
a | All user permissions, used with r or w |
+ | Add a permission, used with r or w |
– | Removes a permission, used with r or w |
r | Read permission |
w | Write permission |
file | Name of a file |
ASMCMD> chmod ug+rw +data/hrms/Controlfile/Current.175.654892547
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 |
---|---|
config_file | Name of the XML file that contains the configuration for the new diskgroup. mkdg searches for the XML file in the directory where ASMCMD was started unless a path is specified. |
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.
Tags for mkdg XML Configuration File
<dg> diskgroup
name diskgroup name
redundancy normal, external, high
<fg> failure group
name failure group name
</fg>
<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 |
---|---|
config_file | Name of the XML file that contains the changes for the diskgroup. chdg searches for the XML file in 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.
Tags for the chdg XML Configuration Template
<chdg> update disk clause (add/delete disks/failure groups)
name diskgroup to change
power power to perform rebalance
<add> items to add are placed here</add>
<drop> items to drop are placed here</drop>
<fg> failure group
name failure group name
</fg>
<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
ASMCMD [+] > chdg ‘<chdg name=”data” power=”3″>
<drop><fg name=”fg1″></fg><dsk name=”data_0001″/></drop>
<add><fg name=”fg2″><dsk string=”/dev/disk5″/></fg></add></chdg>’
dropdg command
Drops an existing diskgroup. The diskgroup cannot be mounted on multiple nodes.
dropdg [-r] [-f] diskgroup
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
ASMCMD [+] > mount –restrict data
ASMCMD [+] > mount -a
umount command
umount {-a | [-f] diskgroup}
Flag | Description |
---|---|
-a | Dismounts all mounted diskgroups. These disk groups are listed in the output of the 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
SQL> ALTER DISKGROUP diskgroup_name DISMOUNT;
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. |
-t | Specifies the time before the specified disk is dropped as nm or nh, where m specifies minutes and 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
SQL equivalent offline command is:
SQL> ALTER DISKGROUP diskgroup_name OFFLINE …;
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. |
-w | Wait option. Causes ASMCMD to wait for the diskgroup to be rebalanced before returning control to 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
SQL equivalent online command is:
SQL> ALTER DISKGROUP diskgroup_name ONLINE …;
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). |
-w | Wait option. Causes ASMCMD to wait for the diskgroup to be rebalanced before returning control to 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
SQL equivalent rebal command is:
SQL> ALTER DISKGROUP diskgroup_name REBALANCE POWER n;
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. |
–region | Displays information for cold and hot disk regions (Cold_Reads, Cold_Writes, Hot_Reads, Hot_Writes). |
-G | Displays statistics for the diskgroup name. |
interval | Refreshes the statistics display based on the interval value (seconds). Use Ctrl-C to stop the 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. |
Reads | Number of bytes read from the disk. If the –io option is entered, then the value is displayed as number of I/Os. |
Writes | Number of bytes written from the disk. If the –io option is entered, then the value is displayed as number of I/Os. |
Cold_Reads | Number of bytes read from the cold disk region. If the –io option is entered, then the value is displayed as number of I/Os. |
Cold_Writes | Number of bytes written from the cold disk region. If the –io option is entered, then the value is displayed as number of I/Os. |
Hot_Reads | Number of bytes read from the hot disk region. If the –io option is entered, then the value is displayed as number of I/Os. |
Hot_Writes | Number of bytes written from the hot disk region. If the –io option is entered, then the value is 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. |
Read_Time | I/O time (in hundredths of a second) for read requests for the disk if the TIMED_STATISTICSinitialization parameter is set to TRUE (0 if set to FALSE). |
Write_Time | I/O time (in hundredths of a second) for write requests for the disk if the 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.
DG_DATA DATA_0011 4860 18398
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
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.
Name | Value |
access_control.enabled | FALSE |
access_control.umask | 066 |
au_size | 1048576 |
cell.smart_scan_capable | FALSE |
compatible.asm | 11.2.0.0.0 |
compatible.rdbms | 10.1.0.0.0 |
disk_repair_time | 3.6h |
sector_size | 512 |
Name | Value |
access_control.enabled | FALSE |
access_control.umask | 066 |
au_size | 1048576 |
cell.smart_scan_capable | FALSE |
compatible.asm | 11.2.0.0.0 |
compatible.rdbms | 11.2.0.0.0 |
disk_repair_time | 3.6h |
sector_size | 512 |
Name Value
compatible.asm 11.2.0.0.0
compatible.rdbms 10.1.0.0.0
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 [email protected] (LGWR) 26593 /devices/diska1
1 [email protected] (LGWR) 26593 /devices/diska2
1 [email protected] (LGWR) 26593 /devices/diska3
1 [email protected] (LGWR) 26593 /devices/diskb1
1 [email protected] (LGWR) 26593 /devices/diskb2
1 [email protected] (LGWR) 26593 /devices/diskb3
1 [email protected] (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 [email protected] (LGWR) 26593 /devices/diska1
1 [email protected] (LGWR) 26593 /devices/diska2
1 [email protected] (LGWR) 26593 /devices/diska3
ASMCMD Template Management Commands
mktmpl command
Adds a template to a diskgroup.
mktmpl -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 region. |
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
SQL equivalent for lstmpl command is:
SQL> SELECT * FROM V$ASM_TEMPLATE;
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 region. |
template | Name of the template to change. |
At least one of these options is required: –striping, –redundancy, –primary, or –secondary.
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
ASMCMD Volume Management Commands
volcreate command
Creates an Oracle ADVM volume in the specified diskgroup.
volcreate -G diskgroup -s size [–column number] [–width stripe_width] [–redundancy {high|mirror|unprotected}]
[–primary {hot|cold}] [–secondary {hot|cold}] volume
Flag | Description |
---|---|
-G | Name of the diskgroup containing the volume. |
-s size | Size of the volume to be created in units of K, M, G, T, P, or E. The unit designation must be appended to the number specified. No space is allowed. For example: 20G |
–column | Number of columns in a stripe set. Values range from 1 to 8. The default value is 4. |
–width | Stripe width of a volume. The value can range from 4 KB to 1 MB, at power-of-two intervals, with a default of 128 KB. |
–redundancy | Redundancy of the Oracle ADVM volume which can be specified for normal redundancy diskgroups. The range of values are as follows: unprotected for non-mirrored redundancy, mirror for double-mirrored redundancy, or high for triple-mirrored redundancy. If redundancy is not specified, the setting defaults to the redundancy level of the diskgroup. |
–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 region. |
volume | Name of the volume to be created. Can be a maximum of 11 alphanumeric characters; dashes are not allowed. The first character must be alphabetic. |
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.
A successful volume creation automatically enables the volume device.
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:
ASMCMD [+] > volcreate -G dg_fra -s 100M vol2
volinfo command
Displays information about Oracle ADVM volumes.
volinfo {-a | -G diskgroup -a | -G diskgroup volume}
volinfo [–show_diskgroup|–show_volume] volumedevice}
Flag | Description |
---|---|
-a | When used without a diskgroup name, specifies all volumes within all diskgroups. When used with a diskgroup name (-G diskgroup -a), specifies all volumes within that diskgroup. |
-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:oracleacfsmountsacfs1
ASMCMD [+] > volinfo -a
SQL> SELECT * FROM V$ASM_VOLUME_STAT;
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.
The following example deletes volume1 from the dg_data diskgroup.
ASMCMD [+] > voldelete -G dg_data volume1
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 |
---|---|
-a | When used without a diskgroup name, specifies all volumes within all diskgroups. When used with a diskgroup name (-G diskgroup -a), specifies all volumes within that diskgroup. |
-G | Name of the diskgroup containing the volume. |
volume | Name of the volume to be operated on. Can be maximum of 30 alphanumeric characters. The first 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.
The following example disables volume1 in the dg_data diskgroup.
ASMCMD [+] > voldisable -G dg_data volume1
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}
Flag | Description |
---|---|
-a | When used without a diskgroup name, specifies all volumes within all diskgroups. When used with a diskgroup name (-G diskgroup -a), specifies all volumes within that diskgroup. |
-G | Name of the diskgroup containing the volume. |
volume | Name of the volume to be operated on. |
The following example enables volume1 in the dg_data diskgroup.
ASMCMD [+] > volenable -G dg_data volume1
volresize command
Resizes an Oracle ADVM volume.
volresize -G diskgroup -s size [-f] volume
Flag | Description |
---|---|
-G | Name of the diskgroup containing the volume. |
-f | Force the shrinking of a volume that is not an Oracle ACFS volume to suppress the warning 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. |
–usagestring | Optional usage string to tag a volume which can be up to 30 characters. This string is set to ACFS when the volume is attached to an Oracle ACFS file system and should not be changed. |
–mountpath | Optional string to tag a volume with its mount path string which can be up to 1024 characters. This 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 region. |
–secondary | Intelligent Data Placement specification for secondary extents, either hot or cold region. |
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 apply when using the volstat command.
- If the diskgroup is not specified and the volume name is specified, all mounted diskgroups are searched for the specified volume name.
- If the diskgroup name is specified and the volume name is omitted, all volumes are displayed for the named diskgroup.
- If both the diskgroup name and the volume name are omitted, all volumes on all diskgroups are displayed.
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
SQL> SELECT * FROM V$ASM_VOLUME_STAT;
ASMCMD File Management Commands
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. |
Other file management commands are
cd, cp, du, find, ls, mkalias, pwd, rm, rmalias