Oracle ASM disk groups Administration includes creating, altering, dropping, mounting, and dismounting tasks.
Creating the DATA disk group
CREATE DISKGROUP data NORMAL REDUNDANCY FAILGROUP controller1 DISK '/devices/diska1' NAME diska1, '/devices/diska2' NAME diska2, '/devices/diska3' NAME diska3, '/devices/diska4' NAME diska4 FAILGROUP controller2 DISK '/devices/diskb1' NAME diskb1, '/devices/diskb2' NAME diskb2, '/devices/diskb3' NAME diskb3, '/devices/diskb4' NAME diskb4 ATTRIBUTE 'au_size'='4M', 'compatible.asm' = '19.0', 'compatible.rdbms' = '19.0', 'compatible.advm' = '19.0';
Creating the FRA disk group
CREATE DISKGROUP fra NORMAL REDUNDANCY DISK '/devices/diskc*';
You can determine the logical sector and sector size values that have either been assumed or explicitly set for a successful disk group creation by querying V$ASM
views or running ASMCMD commands. The LOGICAL_SECTOR_SIZE
and SECTOR_SIZE
columns are included in the V$ASM_DISKGROUP
and V$ASM_ATTRIBUTE
views to display the values. These columns represent the logical sector size and sector size values of the disk group in bytes. The ASMCMD lsdg
also displays the values of the logical sector size and sector size for the disk group. In addition, the disk group attributes are displayed with the V$ASM_ATTRIBUTE
view and the ASMCMD lsattr
command. For example:
SQL> SELECT name, value FROM V$ASM_ATTRIBUTE WHERE (name = 'sector_size' OR name = 'logical_sector_size') AND group_number = 1; NAME VALUE ----------------------------- --------------------------- sector_size 4096 logical_sector_size 512 SQL> SELECT logical_sector_size, sector_size FROM V$ASM_DISKGROUP WHERE group_number = 1; LOGICAL_SECTOR_SIZE SECTOR_SIZE ------------------- ----------- 512 4096
Specifying logical and sector sizes for disks in a disk group
CREATE DISKGROUP data NORMAL REDUNDANCY FAILGROUP controller1 DISK '/devices/diska1', '/devices/diska2', '/devices/diska3', '/devices/diska4' FAILGROUP controller2 DISK '/devices/diskb1', '/devices/diskb2', '/devices/diskb3', '/devices/diskb4' QUORUM FAILGROUP quorum_failgrp DISK '/devices/diskc1' ATTRIBUTE 'compatible.asm' = '12.2', 'compatible.rdbms' = '12.2', 'sector_size'='4096', 'logical_sector_size'='512'; ALTER DISKGROUP data2 SET ATTRIBUTE 'compatible.asm' = '12.2', 'compatible.rdbms' = '12.2'; ALTER DISKGROUP data2 SET ATTRIBUTE 'sector_size'='4096', 'logical_sector_size'='4096';
Altering Disk Groups
Managing volumes with ALTER DISKGROUP VOLUME statements
SQL> ALTER DISKGROUP data ADD VOLUME volume1 SIZE 10G; Diskgroup altered. SQL> ALTER DISKGROUP data RESIZE VOLUME volume1 SIZE 15G; Diskgroup altered. SQL> ALTER DISKGROUP data DISABLE VOLUME volume1; Diskgroup altered. SQL> ALTER DISKGROUP data ENABLE VOLUME volume1; Diskgroup altered. SQL> ALTER DISKGROUP ALL DISABLE VOLUME ALL; Diskgroup altered. SQL> ALTER DISKGROUP data DROP VOLUME volume1; Diskgroup altered.
Using the ALTER DISKGROUP SQL Statement to Add Disks to a Disk Group
The SQL examples in this topic demonstrate the interactions of disk discovery with the ADD
DISK
operation. Assume that disk discovery identifies the following disks in /devices
directory:
Copy/devices/diska1 -- member of data1 /devices/diska2 -- member of data1 /devices/diska3 -- member of data1 /devices/diska4 -- member of data1 /devices/diska5 -- candidate disk /devices/diska6 -- candidate disk /devices/diska7 -- candidate disk /devices/diska8 -- candidate disk /devices/diskb1 -- member of data1 /devices/diskb2 -- member of data1 /devices/diskb3 -- member of data1 /devices/diskb4 -- member of data2 /devices/diskc1 -- member of data2 /devices/diskc2 -- member of data2 /devices/diskc3 -- member of data3 /devices/diskc4 -- candidate disk /devices/diskd1 -- candidate disk /devices/diskd2 -- candidate disk /devices/diskd3 -- candidate disk /devices/diskd4 -- candidate disk /devices/diskd5 -- candidate disk /devices/diskd6 -- candidate disk /devices/diskd7 -- candidate disk /devices/diskd8 -- candidate disk
You can query the V$ASM_DISK
view to display the status of Oracle ASM disks.
The following statement would fail because /devices/diska1
through /devices/diska4
currently belong to the disk group data1
.
ALTER DISKGROUP data1 ADD DISK '/devices/diska*';
The following statement successfully adds disks /devices/diska5
and /devices/diska6
to data1
. Because no FAILGROUP
clauses are included in the ALTER DISKGROUP
statement, each disk is assigned to its own failure group. The NAME
clauses assign names to the disks, otherwise they would have been assigned system-generated names.
ALTER DISKGROUP data1 ADD DISK '/devices/diska5' NAME diska5, '/devices/diska6' NAME diska6;
When specifying a failure group, you can specify the type (regular or quorum) as well as the name. The failure group type value defaults to regular. You must include QUORUM
FAILGROUP
clause to specify a quorum failure group. The following statement successfully adds disks /devices/diska7
and /devices/diska8
to data1
using the FAILGROUP
clause to specify a failure group.
ALTER DISKGROUP data1 ADD FAILGROUP fg_diska78 DISK '/devices/diska7' NAME diska7, '/devices/diska8' NAME diska8;
The following statement would fail because the search string matches disks that are contained in other disk groups. Specifically, /devices/diska4
belongs to disk group data1
and /devices/diskb4
belongs to disk group data2
.
ALTER DISKGROUP data1 ADD DISK '/devices/disk*4';
The following statement would successfully add /devices/diskd1
through /devices/diskd8
to disk group data1
. This statement runs with a rebalance power of 5, and does not return until the rebalance operation is complete.
ALTER DISKGROUP data1 ADD DISK '/devices/diskd*' REBALANCE POWER 5 WAIT;
If /devices/diskc3
was previously a member of a disk group that no longer exists, then you could use the FORCE
option to add the disk as a member of another disk group. For example, the following use of the FORCE
clause enables /devices/diskc3
to be added to data2
, even though it is a current member of data3
. For this statement to succeed, data3
cannot be mounted.
ALTER DISKGROUP data2 ADD DISK '/devices/diskc3' FORCE;
Replacing Disks in Disk Groups
A disk or multiple disks in a disk group can be replaced, rather than dropped and added back.
The single replace operation is more efficient than dropping and adding disks. This operation is especially useful when disks are missing or damaged.
For example, you can issue the following statement to replace the diskc7
disk with another disk identified by the /devices/diskc18
path.
SQL> ALTER DISKGROUP data2 REPLACE DISK diskc7 WITH '/devices/diskc18' POWER 3;
The power option operates the same as the power option for the ALTER
DISKGROUP
REBALANCE
statement, except that the power option cannot be set to 0
.
The ALTER
DISKGROUP
SQL statement with the REPLACE
clause includes a WAIT
or NOWAIT
option, plus the FORCE
option.
Renaming Disks in Disk Groups
For example, you can rename disks as follows:
SQL> ALTER DISKGROUP fra2 MOUNT RESTRICTED; SQL> ALTER DISKGROUP fra2 RENAME DISK 'FRA1_0001' TO 'FRA2_0001', 'FRA1_0002' TO 'FRA2_0002';
For NORMAL
, HIGH
, and FLEX
redundancy disk groups, you can associate a site name using ALTER
DISKGROUP
RENAME
DISK
with the SITE
clause. For example:
SQL> ALTER DISKGROUP data1 RENAME DISK 'DATA1_0001' SITE SITE1;
For an EXTERNAL
redundancy disk group, you can use ALTER
DISKGROUP
RENAME
DISK
with the FAILGROUP
clause to specify a failure group for a disk. For example:
SQL> ALTER DISKGROUP external1 RENAME DISK 'EXTERNAL1_0001' FAILGROUP FG_EXT1_0001;
The SITE
and FAILGROUP
clauses cannot be used together in the same SQL ALTER
DISKGROUP
RENAME
statement.
Dropping Disks from Disk Groups
Dropping disks from disk groups
ALTER DISKGROUP data1 DROP DISK diska5; ALTER DISKGROUP data1 DROP DISK diska5 ADD FAILGROUP failgrp1 DISK '/devices/diska9' NAME diska9;
Resizing Disks in Disk Groups
The RESIZE
clause of ALTER
DISKGROUP
enables you to resize disks in a disk group.
Resizing disks in disk groups
ALTER DISKGROUP data1 RESIZE ALL SIZE 100G;
Undropping Disks in Disk Groups
Undropping disks in disk groups
ALTER DISKGROUP data1 UNDROP DISKS;
Manually Rebalancing Disk Groups
You can manually rebalance the files in a disk group using the REBALANCE
clause of the ALTER
DISKGROUP
statement.
ALTER DISKGROUP data2 REBALANCE MODIFY POWER 10;
The the following SQL statement modifies the power setting to the default value.
ALTER DISKGROUP data2 REBALANCE MODIFY POWER;
When you rebalance a disk group, you have the option choosing the following phase options using the WITH
or WITHOUT
keywords, except where noted:
RESTORE
TheRESTORE
phase includesRESYNC
,RESILVER
, andREBUILD
operations. TheRESTORE
phase is always run by default and cannot be excluded.RESYNC
This operation synchronizes the stale extents on the disks that are being brought online.RESILVER
This operation is specific only to Exadata systems. During this phase, data is copied from one mirror to the mirror with stale data.REBUILD
This operation restores the redundancy of forcing disks only. Forcing disks are those disks that have been dropped with the force option.
BALANCE
This phase restores redundancy of all the disks in the disk group, including file groups, and also balances extents on Oracle ASM disks.PREPARE
This phase completes the work corresponding to the prepare SQL operation. This phase is enabled only forFLEX
orEXTENDED
redundancy disk groups.COMPATIBLE.ASM
must be set to12.2
or higher.COMPACT
This phase defragments and compacts extents across Oracle ASM disks.
The rebalance operation executes the phases in the optimal order. If none of the phases are specified with the ALTER DISKGROUP...REBALANCE
SQL statement, then the behavior remains the same as the rebalance operation previous to the Oracle ASM 12.2 release during which all rebalance phases are run.
The following examples show the use of the phase options with ALTER DISKGROUP...REBALANCE
:
ALTER DISKGROUP data2 REBALANCE WITH BALANCE COMPACT; ALTER DISKGROUP data3 REBALANCE WITHOUT BALANCE;
Manually rebalancing a disk group
ALTER DISKGROUP data2 REBALANCE RESTORE POWER 5 WAIT;
The PASS
column of V$ASM_OPERATION
is updated for resync and rebalance operations. The contents of the column can be RESYNC
, REBALANCE
, or COMPACT
. For example, the following SQL query shows values in the PASS
column during a rebalance operation.
SQL> SELECT GROUP_NUMBER, PASS, STATE FROM V$ASM_OPERATION; GROUP_NUMBER PASS STAT ------------ --------- ---- 2 RESYNC WAIT 2 REBALANCE WAIT 2 COMPACT WAIT
Scrubbing Disk Groups
Oracle ASM disk scrubbing improves availability and reliability by searching for data that may be less likely to be read. Disk scrubbing checks logical data corruptions and repairs them automatically in normal and high redundancy disks groups. The scrubbing process repairs logical corruptions using the mirror disks. Disk scrubbing can be combined with disk group rebalancing to reduce I/O resources. The disk scrubbing process has minimal impact to the regular I/O in production systems.
SQL> ALTER DISKGROUP data SCRUB POWER LOW;
SQL> ALTER DISKGROUP data SCRUB FILE '+DATA/ORCL/DATAFILE/example.266.806582193'
REPAIR POWER HIGH FORCE;
SQL> ALTER DISKGROUP data SCRUB DISK DATA_0005 REPAIR POWER HIGH FORCE;
Oracle ASM Disk Discovery
Disk discovery is the mechanism used to find the operating system names for disks Oracle ASM can access.
Querying V$ASM_DISK for header status
SQL> SELECT name, header_status, path FROM V$ASM_DISK WHERE path LIKE '/devices/disk0%'; NAME HEADER_STATUS PATH --------- ------------- --------------------- FORMER /devices/disk02 FORMER /devices/disk01 CANDIDATE /devices/disk07 DISK06 MEMBER /devices/disk06 DISK05 MEMBER /devices/disk05 DISK04 MEMBER /devices/disk04 DISK03 MEMBER /devices/disk03 7 rows selected.
Managing Capacity in Disk Groups
When Oracle ASM provides redundancy, such as when you create a disk group with NORMAL
or HIGH
redundancy, you must have sufficient capacity in each disk group to manage a re-creation of data that is lost after a failure of one or two failure groups. After one or more disks fail, the process of restoring redundancy for all data requires space from the surviving disks in the disk group. If not enough space remains, then some files might end up with reduced redundancy.
The results from the following query show capacity metrics for a normal redundancy disk group that consists of six 1 GB (1024 MB) disks, each in its own failure group:
SQL> SELECT name, type, total_mb, free_mb, required_mirror_free_mb, usable_file_mb FROM V$ASM_DISKGROUP; NAME TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB ------------ ------ ---------- ---------- ----------------------- -------------- DATA NORMAL 6144 3768 1024 1372
Using CREATE DISKGROUP with Compatibility Attributes
The following example creates a normal redundancy disk group data1
with the Oracle ASM compatibility set to 19.0
and the RDBMS compatibility set to the default (the COMPATIBLE.RDBMS
default is less than or equal to 19.0
):
CREATE DISKGROUP data1 DISK '/dev/sd*' ATTRIBUTE 'compatible.asm' = '19.0';
The following example creates a normal redundancy disk group data2
with the ASM, RDBMS, and ADVM compatibility set to 19.0
:
CREATE DISKGROUP data2 DISK '/dev/sd*' ATTRIBUTE 'compatible.asm' = '19.0', 'compatible.rdbms' = '19.0', 'compatible.advm' = '19.0';
Using ALTER DISKGROUP with Compatibility Attributes
The following example advances the Oracle ASM compatibility for disk group data3
to 19.0
. An Oracle ASM instance must be at Oracle ASM 19c or higher to access the data3
disk group.
ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.asm' = '19.0';
The following example advances the COMPATIBLE.RDBMS
and COMPATIBLE.ADVM
compatibility attributes of the disk group data3
to 10.0
. This example assumes that the value of COMPATIBLE.ASM
is set to 19.0
.
ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.rdbms' = '19.0', ALTER DISKGROUP data3 SET ATTRIBUTE 'compatible.advm' = '19.0';
Maintaining Disk Groups
The following SQL statement dismounts all disk groups that are currently mounted to the Oracle ASM instance:
ALTER DISKGROUP ALL DISMOUNT;
The following SQL statement mounts disk group data1
:
ALTER DISKGROUP data1 MOUNT;
The following example shows how to use the FORCE
option to force the mount of the data1
disk group:
SQL> ALTER DISKGROUP data1 MOUNT FORCE;
The following example statement checks for consistency in the metadata for all disks in the data1
disk group:
ALTER DISKGROUP data1 CHECK ALL;
The following statement deletes data1
:
DROP DISKGROUP data1;
This command enables you to remove the headers on disks that belong to a disk group that cannot be mounted by any Oracle ASM instances as shown in the following example:
SQL> DROP DISKGROUP data1 FORCE;
For More Information check Oracle Help Center: