When database clients delete data, ASM is aware of the additional free space; however, the storage system is not. The storage extents that are based on the deleted data remain allocated. You can reclaim the storage extents by:
Oracle ASM Filter Driver online storage reclamation provides a way to reclaim the storage space of deleted data while the ASM disk group remains online and active.
ASM Filter Driver (AFD) is a kernel module that resides in the I/O path of the Oracle ASM disks. It is available as of Grid Infrastructure release 12.
AFD has many advantages over ASM. These advantages include the ability to:
The protection is disabled only when the AFD labels are removed from the devices.
ASM is efficient in reusing deleted space. For example, if data files are deleted and new files of similar capacity are created, there is no need to reclaim the deleted storage space. ASM simply reuses it.
If a large data set is deleted in ASM, such as a legacy database or copies of the database that consumed large capacity, it is an opportunity to reclaim this storage in the array and make it available to other applications.
During ASM storage reclamation, ASM first performs a manual rebalance, which defrags (compacts) the ASM disk group by moving ASM extents to gaps created by the deleted data. When the ASM disk group is compacted, its High Water Mark (HWM) is updated based on its new allocated capacity. Next, ASM sends SCSI unmap commands to the storage system to reclaim the space above the new HWM. The reclamation is efficient and fast.
To use AFD storage reclamation, the ASM disk group must have a 12.1 (or later) compatibility setting.
To enable AFD storage reclamation, give the ASM disk group the THIN attribute by using the following command:
ALTER DISKGROUP <NAME> SET ATTRIBUTE 'THIN_PROVISIONED'='TRUE';
After this you can reclaim the ASM disk group storage any number of times, using the following command:
ALTER DISKGROUP <NAME> REBALANCE WAIT;
The WAIT option enables the user to receive the prompt only when the operation completes.
The following example illustrates the value of AFD online storage reclamation.
We start with an empty ASM disk group to illustrate the capacity reduction. (In a real world deployment, the ASM disk group will not be empty.)
ALTER DISKGROUP TEST SET ATTRIBUTE 'THIN_PROVISIONED'='TRUE';
CREATE BIGFILE TABLESPACE TP1 DATAFILE '+TEST' size 300G ONLINE;
While a new data file is created, Oracle initializes the space and it is allocated in the storage system.
DROP TABLESPACE TP1 INCLUDING CONTENTS AND DATAFILES;
At the storage level, no space is released yet, as shown in the following figure:
Figure 28. PowerMax storage group before AFD reclamation
ALTER DISKGROUP TEST REBALANCE WAIT;
The following figure shows that other than the small ASM metadata (because we started with an empty ASM disk group), no space is consumed.
Figure 29. PowerMax storage group after AFD reclamation