Troubleshooting Guide: DBCC Compaction Phase Progress Message (Error 2548)
Why This Error Happens
This message is not a true error but an informational progress notification generated during a DBCC DBREINDEX, DBCC INDEXDEFRAG, or online index rebuild operation, reporting the percentage completion of the compaction phase. It typically surfaces as a concern when the compaction phase stalls or takes excessively long, which usually points to heavy fragmentation, insufficient tempdb space, blocking from concurrent transactions, or disk I/O bottlenecks on the underlying storage. On Windows Server 2025 / Windows 11 hosts, this can be exacerbated by antivirus real-time scanning on SQL data files or insufficient memory allocated to the SQL Server instance, causing excessive paging during the sort/compaction work.
Step-by-Step Resolution Guide
Step 1: Identify Blocking and Resource Contention
- Run
sp_whoisactiveor querysys.dm_exec_requeststo check if the index operation is being blocked by another session. - Check
sys.dm_os_waiting_tasksfor wait types likePAGEIOLATCH,LCK_M_*, orRESOURCE_SEMAPHORE, which indicate I/O or memory pressure. - If blocking is found, identify the blocking SPID using
DBCC INPUTBUFFER(<SPID>)and determine whether it is safe to terminate withKILL <SPID>.
Step 2: Verify and Expand tempdb Capacity
- Navigate to
Server Properties > Database Settingsin SSMS or querysys.master_filesto check currenttempdbfile sizes and autogrowth settings. - Ensure
tempdbdata files are pre-sized appropriately (e.g., several GB per file, with multiple files matching CPU core count up to 8) to avoid autogrowth stalls during compaction. - Example T-SQL to expand tempdb:
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, SIZE = 10240MB);
Step 3: Exclude SQL Server Files from Antivirus Scanning
- On Windows Server 2025 / Windows 11, open Windows Security > Virus & threat protection > Manage settings > Add or remove exclusions.
- Add exclusions for the SQL Server data, log, and tempdb directories, typically located at
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\. - Also exclude
sqlservr.exefrom theC:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\path from real-time process scanning.
Step 4: Rebuild the Index with Optimized Options
- Instead of a full offline rebuild, use the
ONLINE = ONoption (Enterprise/Developer edition) to minimize locking during compaction:
ALTER INDEX ALL ON dbo.YourTable REBUILD WITH (ONLINE = ON, MAXDOP = 4, SORT_IN_TEMPDB = ON);
- Adjust
MAXDOPto match available CPU cores and setSORT_IN_TEMPDB = ONto offload sort operations and speed up compaction.
Step 5: Validate Disk I/O Performance
- Use Windows Performance Monitor (
perfmon.exe) to track theAvg. Disk sec/Transfercounter on the volume hosting the data files. - If latency exceeds 20ms consistently, consider moving data/log files to faster storage (NVMe/SSD) or separating data, log, and tempdb onto different physical disks.
Alternative or Verification Steps
- After the rebuild completes, run
DBCC CHECKDB WITH NO_INFOMSGSand verifysys.dm_db_index_physical_statsto confirm fragmentation has been reduced below 10%. - If the compaction phase continues to hang indefinitely, consider dropping and recreating the index instead of rebuilding, as this bypasses the incremental compaction logic entirely for large heavily fragmented tables.