Using ASMCMD Commands for Oracle ASM Management
Commands and Scripts with Examples
Asfaw Gedamu
Download this and similiar documents from:
[Link] 16/02/2024
A. Introduction:
This Standard Operating Procedure (SOP) outlines the usage of asmcmd, a command-line
interface for managing Oracle Automatic Storage Management (ASM). It covers common
commands, their purpose, prerequisites, and best practices.
B. Purpose:
• Manage ASM instances, disks, and disk groups.
• Perform routine maintenance tasks like adding/removing disks, resizing disk groups, and
monitoring performance.
• Troubleshoot ASM-related issues and identify potential problems.
C. Prerequisites:
• Access to an Oracle ASM instance with asmcmd installed.
• Basic understanding of ASM concepts and terminology.
• Privileged user account with appropriate permissions.
D. Best Practices:
• Always backup your ASM configuration before making significant changes.
• Test commands in a non-production environment before applying them to a production
system.
• Use asmcmd help for detailed information and syntax of specific commands.
• Consult the Oracle documentation for advanced usage and troubleshooting.
E. Common ASMCMD Commands:
• asmcmd start/stop instance: Starts or stops the ASM instance.
• asmcmd list diskgroups: Lists all ASM disk groups.
• asmcmd list disks: Shows information about all ASM disks.
• asmcmd add/remove disk: Adds or removes a disk from an ASM instance.
• asmcmd resize diskgroup: Resizes the size of a disk group.
• asmcmd show alert history: Displays historical ASM alerts.
• asmcmd monitor statistics: Monitors performance metrics for ASM components.
Now, to the list of useful asmcmd commands which will come handy in your day to day
operations.
1. List all diskgroups:
ASMCMD> lsdg
-- Include dismounted diskgroups:
ASMCMD> lsdg --discovery
-- List diskgroups across all nodes of cluster:
ASMCMD> lsdg -g --discovery
2. List asm disks:
-- List all asm disks
ASMCMD> lsdsk -k
-- List disks of a diskgroup(CDATA) with free and total MB
ASMCMD> lsdsk -k -G CDATA
-- List disks of a diskgroup(CDATA) with group and disk number
ASMCMD> lsdsk -p -G CDATA
-- List disks with disk creation date
ASMCMD> lsdsk -t -G CDATA
-- List candidiate disks only
ASMCMD> lsdsk --candidate -k
-- List member disks only
ASMCMD> lsdsk --candidate -p
3. Get attributes of ASM diskgroups:
-- List attribute of all diskgroups:
ASMCMD> lsattr -lm
-- List attribute of specific diskgroup(DMARCH)
ASMCMD> lsattr -lm -G DMARCH
Group_Name Name Value RO Sys
DMARCH access_control.enabled FALSE N Y
DMARCH access_control.umask 066 N Y
DMARCH au_size 1048576 Y Y
DMARCH cell.smart_scan_capable FALSE N N
-- List attributes with specific pattern
ASMCMD> lsattr -lm %au_size%
Group_Name Name Value RO Sys
CDATA au_size 1048576 Y Y
BDM au_size 1048576 Y Y
CRMG au_size 1048576 Y Y
PMARCH au_size 1048576 Y Y
BCMS au_size 1048576 Y Y
4. unmount diskgroup:
unmount command works only on the local node. So if you want to unmount the diskgroup from
all nodes of cluster, then run this command from all the nodes
-- unmount all diskgroups
ASMCMD> umount -a
--- unmount specific diskgroup(ARCH)
ASMCMD> umount ARCH
4. Mount diskgroup:
Mount command works only on the local node. So if you want to Mount the diskgroup from all
nodes of cluster, then run this command from all the nodes.
-- mount all diskgroups on local node
ASMCMD> mount -a
--- mount a specific diskgroup on local node
ASMCMD> mount ARCH
5. Rebalance a diskgroup:
-- here asm_power_limit is 8 and diskgroup is ARCH
ASMCMD> rebal --power 8 ARCH
Rebal on progress.
-- Monitor progress
ASMCMD> lsop
Group_Name Pass State Power EST_WORK EST_RATE EST_TIME
ARCH COMPACT RUN 8 0 16831 0
ARCH REBALANCE DONE 8 0 0 0
6. Get password file of database
ASMCMD> pwget --dbuniquename DBACLASS
+CDATA/DBACLASS/PASSWORD/pwddbaclass.256.899912377
8 .Get password file of asm :
ASMCMD> pwget --asm
+MGMT/orapwASM
9. Get asm template info of a diskgroup:
ASMCMD> lstmpl -l -G ARCH
Group_Name Group_Num Name Stripe Sys Redund PriReg MirrReg
ARCH 1 ARCHIVELOG COARSE Y UNPROT COLD COLD
ARCH 1 ASMPARAMETERFILE COARSE Y UNPROT COLD COLD
ARCH 1 AUDIT_SPILLFILES COARSE Y UNPROT COLD COLD
ARCH 1 AUTOBACKUP COARSE Y UNPROT COLD COLD
ARCH 1 AUTOLOGIN_KEY_STORE COARSE Y UNPROT COLD
COLD
ARCH 1 BACKUPSET COARSE Y UNPROT COLD COLD
10. Check whether flex asm is enabled or not
ASMCMD> showclustermode
ASM cluster : Flex mode disabled
[Link] cluster state:
ASMCMD> showclusterstate
Normal
12. View asm version:
ASMCMD> showversion
ASM version : [Link].0
13. Get asm spfile location:
ASMCMD> spget
+MGMT/DBACLASS-cluster/ASMPARAMETERFILE/registry.253.899644763
14. Take backup of asm spfile:
-- copy backup of spfile to a specific location
ASMCMD> spbackup +MGMT/DBACLASS-
cluster/ASMPARAMETERFILE/registry.253.899644763 /home/oracle/[Link]
15. Find clients connected to a diskgroup:
ASMCMD> lsct DMARCH
DB_Name Status Software_Version Compatible_version Instance_Name Disk_Group
DBACLASS CONNECTED [Link].0 [Link].0 DBACLASS1 DMARCH
16. Get asm diskstring
ASMCMD> dsget
parameter:ORCL:*
profile:ORCL:*
17. List asm users with password:
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
18. List open files of a diskgroup:
— Open files of a diskgroup ( ARCH)
ASMCMD>lsof -G ARCH
19 . List open files related to a database
-- Open files of a database( DBACLASS)
ASMCMD>lsof --dbname DBACLASS
20. Check filter driver is enabled or not:
ASMCMD> afd_state
ASMCMD-9526: The AFD state is 'NOT INSTALLED' and filtering is 'DEFAULT' on host
'b20e4bay01'
filter driver disks:
21. List filter driver disks(if enabled)
ASMCMD> afd_lsdsk
22. Get filter driver asm diskstring
ASMCMD> afd_dsget
AFD discovery string:
F. Conclusion:
By utilizing asmcmd effectively, you can efficiently manage your Oracle ASM environment,
ensuring optimal performance and data integrity. Remember to approach changes cautiously,
leverage available resources, and prioritize data protection. Additional Notes:
• This SOP provides a basic overview. For comprehensive information, refer to the official
Oracle ASM documentation.
• Consider including specific examples and use cases relevant to your environment for a
more practical guide.
• Regularly update the SOP to reflect changes in asmcmd functionality and best practices.