🖥️ Database Environment:
🔹 Operating System: HP-UX 11.31
🗄️ Database Environment: Oracle Real Application Clusters (RAC)
⚙️ Database Version: Oracle Database 19c Enterprise Edition (19.26)
🎯Introduction:Oracle ASM (Automatic Storage Management) plays a critical role in managing database storage by distributing database files across multiple disks within ASM Disk Groups. As part of regular database administration and storage maintenance activities, DBAs often need to remove existing ASM disks from a ASM disk group. This could be due to storage migration, disk replacement, capacity optimization, infrastructure changes, or storage decommissioning,etc. One of the important challenge during this activity is the time required to complete the ASM rebalance operation. When an ASM disk is dropped, Oracle ASM redistributes the extents residing on the disk being removed across the remaining disks in the disk group. Depending on the database size, storage configuration, redundancy level, and rebalance workload, this operation can take a considerable amount of time. Is there any way to improve or speed up the overall ASM rebalance operation? Let's understand this through a step-by-step simulation. 🎯Problem Statement:The customer recently performed an ASM disk removal activity at one of the Standby site, involving the removal of 80 ASM disks out of 400 disks, each with a capacity of 128 GB. To manage the activity, the ASM disks were dropped in batches of 8, resulting in a total of 10 batches. Each batch triggered an ASM rebalance operation, with the rebuild, rebalance, and compaction phase. During the activity, it was observed that the COMPACT phase was the major contributor to the overall elapsed time, taking more than 10 hours to complete per batch. As a result, the customer had to execute all three phases for every batch, significantly increasing the overall disk removal duration. The complete activity involving all 80 ASM disks took approx. three or more days to finish. Although the activity was successfully completed, the total elapsed time (3 or more days) was considerably high, resulting in an extended storage maintenance window. This raised an important performance optimization question. Can we eliminate the time consuming COMPACT phase during ASM disk removal and significantly reduce the overall rebalance elapsed time ? Did you know that Oracle ASM provides a WITHOUT COMPACT option that can help optimize the disk drop operation? What is COMPACT and how it works ? The COMPACT phase consolidates and rearranges extents on the disks that remain in the ASM disk group. Successfully dropped disks no longer participate, as their data has already been moved to the remaining disks. Using REBALANCE WITHOUT COMPACT skips this phase for each batch while allowing data evacuation and balancing to continue. When disks are removed in multiple batches, postponing compaction prevents the same reorganization process from being repeated after every batch. Instead, compaction runs once after all batches have completed and passed verification. This can reduce the overall maintenance time, depending on storage performance and workload. In this blog, we will explore how the WITHOUT COMPACT option works, how it differs from the default ASM disk drop operation, and how it can help to reduce the overall rebalance elapsed time. |
Prerequisites: - Oracle ASM 12.2 or later - SYSASM access Step 1: Login as Grid owner and set ORACLE_SID and GRID_HOME to connect to local ASM instance. $sqlplus / as sysasm SQL> set lines 300 pages 3000 SQL> select instance_name, host_name, version, status from v$instance; SQL> select group_number, name, state, type, compatibility, total_mb, free_mb, usable_file_mb, required_mirror_free_mb, offline_disks from v$asm_diskgroup where name ='&dg_name'; SQL> select group_number as dg_num from v$asm_diskgroup_stat where name = '&dg_name'; SQL> select count(*) as members_disks from v$asm_disk_stat where group_number = &dg_num and header_status = 'member'; SQL> show PARAMETER asm_power_limit Please note that the intended disk group must be in the MOUNTED state, with the expected number of member disks and no offline disks. If the disk group query returns no rows, stop the execution. Step 2: Before executing the first ASM disk drop command, capture and save the complete ASM disk statistics. Validate and map all 80 approved ASM disks against their respective storage WWID/LUN identities, ensuring the following details are documented for each disk: - ASM Disk Name and disk path - WWID Number - Disk Size - Failgroup SQL> col name for a24 SQL> col path for a70 SQL> col failgroup for a24 SQL> select name, path, udid, failgroup, total_mb, free_mb, header_status, mode_status, state, failgroup_type, voting_file, read_errs, write_errs from v$asm_disk where group_number = &DG_num order by name; Review per-disk free space and mirror headroom. Set the current eight disk names and saved discovery paths. Replace all values before every batch. SQL> SELECT name, path, failgroup, total_mb, free_mb, header_status, mode_status, state, failgroup_type, voting_file FROM v$asm_disk WHERE group_number = &DG_NO AND name IN ('&DSK1','&DSK2','&DSK3','&DSK4','&DSK5','&DSK6','&DSK7','&DSK8') ORDER BY name; Ensure exactly eight distinct, approved NAME/PATH pairs are identified, with all disks in MEMBER, ONLINE, and NORMAL status. Verify that all disks are of type REGULAR and confirm that there are no unreviewed dependencies on Voting Files or OCR. Check if any previous pending v$asm_operation if any. SQL> select inst_id, group_number, pass, state, error_code from gv$asm_operation where group_number = &dg_num order by inst_id, pass; Step 3: Now drop one batch and monitor progress. SQL> alter diskgroup &dg_name drop disk &dsk1,&dsk2,&dsk3,&dsk4,&dsk5,&dsk6,&dsk7,&dsk8 rebalance without compact power &pw_limit nowait; The NOWAIT just returns the control before completion and hence do not initiate second drop command. Let's monitor the v$asm_operation with below commands frequently to know the status op rebalance.. SQL> select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss'),inst_id,group_number,pass,state,power,actual,sofar,est_work,est_rate, est_minutes, error_code from gv$asm_operation where group_number = &dg_num order by inst_id, pass; SQL> select name,state,total_mb,free_mb,usable_file_mb,required_mirror_free_mb,offline_disks from v$asm_diskgroup_stat where group_number = &dg_num; SQL> select name,path,mode_status,state,header_status,read_errs, write_errs from v$asm_disk_stat where group_number=&dg_num and (mode_status <> 'online' or state <> 'normal' or read_errs > 0 or write_errs > 0) order by name; The states EST, RUN, and REAP indicate that the operation has unfinished work. DONE confirms completion of the current pass only. Treat EST_MINUTES as an estimated value; a zero value does not necessarily indicate that the entire operation is complete. Step 4: Let's verify the completion before the next batch. #Verify that all eight paths appear with HEADER_STATUS='FORMER'. A missing path returns no row and needs investigation. SQL> SELECT path, group_number, name, header_status FROM v$asm_disk WHERE path IN ('&P1', '&P2', '&P3', '&P4','&P5', '&P6', '&P7', '&P8') ORDER BY path; #Let's perform one more check to confirm the number of disks remaining in the specified disk group. SQL> SELECT COUNT(*) AS disk_count FROM v$asm_disk_stat WHERE group_number=&DG_NUM AND header_status='MEMBER'; Starting with 400 ASM disks, the expected count is 380 after dropping the first eight disks and 320 after dropping all 80 disks, assuming no other membership changes. The above count query checks the remaining disk membership, while the path query confirms that each disk in the completed batch has HEADER_STATUS='FORMER'. Step 5: Repeat step 3 and step 4 from batch 2 to batch 10, updating the disk names and paths for each batch. Complete and verify each batch before starting the next batch, and retain the identity records for all 80 disks. Unmap a disk only after confirming its HEADER_STATUS='FORMER'. Step 6 : Run the final compaction phase once after confirming that all 80 ASM disks have been dropped successfully. After all ten batches have completed successfully, verify that all 80 dropped disks have HEADER_STATUS='FORMER' and confirm the expected remaining disk count. Start the final compaction phase now. SQL> alter diskgroup &dg_name rebalance with compact power &pw_limit nowait; SQL> select inst_id, pass, state, power, actual, est_minutes, error_code from gv$asm_operation where group_number = &dg_no order by inst_id, pass; #Confirm that the disk group is MOUNTED, OFFLINE_DISKS is 0, and capacity meets the agreed free space and redundancy requirements. SQL> select name, state, type, total_mb, free_mb, required_mirror_free_mb, usable_file_mb, offline_disks from v$asm_diskgroup_stat where group_number = &dg_num; #Let's perform one more check to confirm the number of disks remaining in the specified disk group. SQL> SELECT COUNT(*) AS disk_count FROM v$asm_disk_stat WHERE group_number=&DG_NUM AND header_status='MEMBER'; 🏁Final verification checklist: - Verify that only the 80 approved ASM disks out of 400 were removed, with HEADER_STATUS='FORMER' recorded as evidence. - Confirm that 320 healthy disks remain with HEADER_STATUS='MEMBER'. - Confirm that final compaction has completed and investigate any ASM or database errors. - Provide the verified WWID/LUN list to the storage team for decommissioning. ❓ Step 4: Technical Questions and Answers: Q.1. Can we eliminate COMPACT during disk removal and reduce elapsed time? ✅Yes. You can exclude COMPACT from each ASM disk drop batch while allowing evacuation and balancing to continue. For multiple batches, performing compaction once at the end avoids repeated compaction work and can reduce overall activity elapsed time. The improvement depends on the storage and workload. Q.2. Does Oracle ASM provide a WITHOUT COMPACT option? ✅Yes. Oracle ASM 12.2 and later supports REBALANCE WITHOUT COMPACT. 🎯 Performance Improvement: Using REBALANCE WITHOUT COMPACT for each disk drop batch and performing compaction once at the end helped reduce the removal of 80 ASM disks from approx. three days to within one day an approx. 67% reduction in elapsed time, saving around two or more days. The disks were removed in ten sequential batches of eight, avoiding repeated compaction while allowing evacuation and balancing to complete for each batch. Starting with 400 disks, the expected remaining count is 320. This approach demonstrates how deferring compaction can improve maintenance efficiency. The improvement achieved will depend on the storage environment and workload. 🎉 Enjoy the troubleshooting journey! 📝 Stay tuned for more Oracle Database performance tuning case studies. 💬 Thanks for reading! Share your experiences, questions, and suggestions in the comments. |
Thanks for reading this post ! Please comment if you like this post ! Click on FOLLOW to get next blog updates !
📢Join Me on:


