ASM
Check
To check ASM status using srvctl...
srvctl status asm
To check that ASM is running and to see which user owns it...
ps -ef | grep -i ASM
All further commands on this page assume you are logged in to the OS as this userDiskgroup Summary
asmcmd
asmcmd
lsdg
exit
sqlplus
sqlplus as sysasm
@/u01/dba/asm/asm_diskgroups.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_diskgroups.sqlsqlplus
sqlplus / as sysdba
SET LINESIZE 132
SELECT state AS "State",
type AS "Type",
NULL AS "Rebal",
sector_size AS "Sector",
logical_sector_size AS "Logical_Sector",
block_size AS "Block",
allocation_unit_size AS "AU",
total_mb AS "Total_MB",
free_mb AS "Free_MB",
required_mirror_free_mb AS "Req_mir_free_MB",
usable_file_mb AS "Usable_file_MB",
offline_disks AS "Offline_disks",
voting_files AS "Voting_files",
name AS "Name"
FROM v$asm_diskgroup;
EXIT
The SQL script on the right does not currently include the Rebal information.ASM Summary Report (HTML)
See Note: 470211.1
sqlplus / as sysdba
@asm_first.sql
@asm_second.sql
Disk Usage Report
sqlplus / as sysasm
@/u01/dba/asm/asm_disks.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_disks.sqlExample Output
+------------------------------------------------------------------------+| Report : ASM Disks || Instance : +ASM1 |+------------------------------------------------------------------------+Disk Group Name Path File Name Fail Group File Size (MB) Used Size (MB) Pct. Used------------------------- -------------------- -------------------- -------------------- -------------- -------------- ---------DATA /dev/DATADISK3 DATA_0000 DATA_0000 65,536 61,864 94.40 /dev/DATADISK4 DATA_0003 DATA_0003 65,536 61,780 94.27 /dev/DATADISK2 DATA_0001 DATA_0001 65,536 61,808 94.31 /dev/DATADISK1 DATA_0002 DATA_0002 65,536 61,780 94.27************************* -------------- -------------- 262,144 247,232
RECO /dev/RECODISK1 RECODISK1 RECODISK1 65,536 53,616 81.81 /dev/RECODISK4 RECODISK4 RECODISK4 65,536 53,564 81.73 /dev/RECODISK3 RECODISK3 RECODISK3 65,536 53,440 81.54 /dev/RECODISK2 RECODISK2 RECODISK2 65,536 53,472 81.59************************* -------------- -------------- 262,144 214,092
-------------- --------------Grand Total: 524,288 461,324
sqlplus / as sysasm
@/u01/dba/asm/asm_disks1.sql
As above, but with the STATE column added to the outputDisk Group Name Path File Name STATE Fail Group File Size (MB) Used Size (MB) Pct. Used------------------------- -------------------- -------------------- -------- -------------------- -------------- -------------- ---------DATA /dev/DATADISK6 DATA_0005 NORMAL DATA_0005 131,072 51,588 39.36 /dev/DATADISK5 DATA_0004 NORMAL DATA_0004 131,072 51,620 39.38 /dev/DATADISK8 DATA_0007 NORMAL DATA_0007 131,072 51,576 39.35 /dev/DATADISK4 DATA_0003 DROPPING DATA_0003 65,536 14,264 21.77 /dev/DATADISK2 DATA_0001 DROPPING DATA_0001 65,536 14,264 21.77 /dev/DATADISK7 DATA_0006 NORMAL DATA_0006 131,072 51,596 39.36 /dev/DATADISK3 DATA_0000 DROPPING DATA_0000 65,536 14,296 21.81 /dev/DATADISK1 DATA_0002 DROPPING DATA_0002 65,536 14,272 21.78************************* -------------- -------------- 786,432 263,476
RECO /dev/RECODISK1 RECODISK1 NORMAL RECODISK1 65,536 53,648 81.86 /dev/RECODISK2 RECODISK2 NORMAL RECODISK2 65,536 53,660 81.88 /dev/RECODISK3 RECODISK3 NORMAL RECODISK3 65,536 53,628 81.83 /dev/RECODISK4 RECODISK4 NORMAL RECODISK4 65,536 53,672 81.90************************* -------------- -------------- 262,144 214,608
-------------- --------------Grand Total: 1,048,576 478,084
Disk Performance Report
sqlplus / as sysasm
@/u01/dba/asm/asm_disks_perf.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_disks_perf.sqlSample Output
+------------------------------------------------------------------------+| Report : ASM Disk Performance || Instance : +ASM1 |+------------------------------------------------------------------------+Read Write Read Write Bytes BytesDisk Group Name Disk Path Reads Writes Errors Errors Time Time Read Written-------------------- -------------------- ---------------- ---------------- ----------- ------------ ---------------- ---------------- -------------------- --------------------DATA /dev/DATADISK3 33,709,905 16,896,461 0 0 59,185 1,200,442 2,359,301,932,544 430,127,716,352 /dev/DATADISK4 240,370,335 16,700,470 0 0 182,227 853,981 5,206,277,542,400 430,156,206,080 /dev/DATADISK2 36,368,437 19,004,162 0 0 60,565 969,628 2,416,323,789,312 455,628,063,744 /dev/DATADISK1 586,927,755 19,404,473 0 0 390,070 1,758,182 11,879,652,850,176 459,077,994,496******************** ---------------- ---------------- ----------- ------------ ---------------- ---------------- -------------------- -------------------- 897,376,432 72,005,566 0 0 692,047 4,782,233 21,861,556,114,432 1,774,989,980,672
RECO /dev/RECODISK1 23,759,995 40,243,950 0 0 45,413 98,794 960,918,323,200 626,679,333,376 /dev/RECODISK4 15,172,482 39,790,749 0 0 36,704 85,572 815,737,315,328 611,133,980,160 /dev/RECODISK3 41,840,544 42,804,028 0 0 53,521 71,348 1,257,232,960,000 660,393,681,408 /dev/RECODISK2 134,442,316 48,838,567 0 0 103,199 93,326 1,474,106,978,816 762,312,910,848******************** ---------------- ---------------- ----------- ------------ ---------------- ---------------- -------------------- -------------------- 215,215,337 171,677,294 0 0 238,837 349,040 4,507,995,577,344 2,660,519,905,792
---------------- ---------------- ----------- ------------ ---------------- ---------------- -------------------- --------------------Grand Total: 1,112,591,769 243,682,860 0 0 930,885 5,131,273 26,369,551,691,776 4,435,509,886,464
Other Reports
sqlplus / as sysasm
@/u01/dba/asm/asm_alias.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_alias.sql@/u01/dba/asm/asm_clients.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_clients.sql@/u01/dba/asm/asm_files.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_files.sql@/u01/dba/asm/asm_files2.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_files2.sql@/u01/dba/asm/asm_templates.sql
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_templates.sqlStartup
srvctl start asm
Stop
srvctl stop asm
Create Diskgroup
ALTER SYSTEM SET ASM_DISKSTRING = '/dev/rhdisk2*' , '/dev/asm*' SCOPE=BOTH;
CREATE DISKGROUP oradata2 EXTERNAL REDUNDANCY DISK '/dev/asm69','/dev/asm70','/dev/asm103','/dev/asm104','/dev/asm105';
ALTER Diskgroup
ALTER DISKGROUP oradata REBALANCE POWER 10;
ADD DISK
ALTER DISKGROUP oradata ADD DISK '/dev/rhdisk28';
To add a disk to a specific failgroup...
ALTER DISKGROUP oradata ADD FAILGROUP controller2 DISK '/dev/rhdisk28';
If you don't specify a failgroup then per disk failgroups are usedYou should run a rebalance after adding a disk...
ALTER DISKGROUP oradata REBALANCE;
You can track rebalance progress using...
SELECT * FROM v$asm_operation;
See the section on v$asm_operatioon later on this page for more informationDROP Disks
ALTER DISKGROUP oradata DROP DISK oradata1_0004;
ALTER DISKGROUP oradata DROP DISKS IN FAILGROUP controller1;
DROP Diskgroup
For RAC, shutdown ASM instances on other nodes, leaving just one instance, then:
DROP DISKGROUP oradata INCLUDING CONTENTS;
Parameters
Set in the ASM InstanceASM_DISKGROUPS
ASM_DISKSTRING
ASM_PREFREERD_READ_FAILURE_GROUPS
ASM_POWER_LIMIT
Sets the default rebalance power. Permitted value from 0 to 11, where 0 stops the rebalance operation and 11 permits Automatic Storage Management to execute the rebalance as fast as possible
Views
V$ASM_ALIAS
ASM Instance OnlyDisplays a row for each alias in every disk group mounted by ASM
V$ASM_CLIENT
Displays a row for each database instance using a disk group managed by ASM.
V$ASM_DISK
Reduced functionality if acces via database instanceDisplays a row for each disk discovered by the ASM instance
V$ASM_DISK_STAT
Same as V$ASM_DISK without performing discovery of new disks
V$ASM_DISKGROUP
Displays a row for each disk group discovered by the ASM instance.
V$ASM_DISKGROUP_STAT
Same as V$ASM_DISKGROUP without performing discovery of new diskgroups
V$ASM_FILE
ASM Instance OnlyDisplays a row for each file for each disk group mounted by ASM
V$ASM_OPERATION
ASM Instance OnlyDisplays a row for each file for each long running operation executing in ASM
SELECT *
FROM v$asm_operation;
- REBAL - Rebalance pending for this group. The diskgroup needs rebalance to complete.
- COD - COD recovery pending for group. There are COD's that need to be recovered, These could be CODs which are part of the rebalance or CODs which are rolling back operations, such as file creations
- DSCV - Disk rediscovery pending. RBAL is doing disk discovery, probing the system for devices that ASM can use.
- ACD - ACD grow chunk pending for group. New ASM instance has joined the cluster and this instance is growing the ACD to accommodate it.
- RFRSH - PST refresh/disk expel required. Requesting PST refresh and asking the disk to be expelled after it is refreshed.
- EXPEL - End of rebalance expel required. Background operation complete, winding down.
- WAIT - No operations running for the group
- RUN - Operation running for the group
- REAP - Operation is being run down
- HALT - Operation halted by admin
- ERRORS - Operation halted by errors
GV$ASM_OPERATION
ASM Instance OnlyCluster wide implementation of V$ASM_OPERATION
V$ASM_TEMPLATE
Displays a row for each template present in each disk group mounted by ASM
Bibliography
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_1006.htm#SQLRF01113 (ALTER DISKGROUP)http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5008.htm (CREATE DISKGROUP)http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8013.htm#i2152629 (DROP DISKGROUP)http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams011.htm#sthref76 (ASM_DISKSTRING)
https://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_disks.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_disks_perf.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_alias.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_clients.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_diskgroups.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_drop_files.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_files.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_files2.sqlhttps://github.com/windwiny/Oracle-DBA-tips-scripts/blob/master/sql/asm_templates.sql
https://support.oracle.com470211.1369525.1
Dell EMC Storage and ASMhttps://www.delltechnologies.com/asset/en-us/products/storage/industry-market/dell-emc-sc-series-oracle-asm-cml.pdf