Troubleshooting Guide: Error 2555 in Microsoft SQL Server 2025
Why This Error Happens
Error 2555 occurs when SQL Server’s DBCC SHRINKFILE operation with the EMPTYFILE option attempts to relocate all data pages from a file but cannot find sufficient contiguous or available space in the remaining files within the same filegroup. This typically happens because the target filegroup is nearly full, contains non-movable data such as LOB or text/image data that cannot be relocated via standard page migration, or the destination files have reached their configured growth limits. Additionally, if the file contains forwarded rows, indexed views, or system-reserved pages, SQL Server may be unable to complete the migration even when free space appears available on disk.
Step-by-Step Resolution Guide
Step 1: Check Available Space in the Filegroup
- Run the following query to inspect space usage across all files in the affected filegroup:
SELECT
fg.name AS FilegroupName,
f.name AS FileName,
f.size/128.0 AS SizeMB,
f.max_size,
(f.size/128.0 - CAST(FILEPROPERTY(f.name, 'SpaceUsed') AS INT)/128.0) AS FreeSpaceMB
FROM sys.filegroups fg
JOIN sys.database_files f ON fg.data_space_id = f.data_space_id;
- Confirm that remaining files in the filegroup have enough free space to absorb the data being emptied out.
- If space is insufficient, add a new data file to the same filegroup using
ALTER DATABASE [YourDB] ADD FILE.
Step 2: Identify Non-Movable or LOB Data
- Query
sys.allocation_unitsandsys.partitionsto check for LOBDATA or ROWOVERFLOW_DATA pages tied to the file you are emptying:
SELECT OBJECT_NAME(p.object_id), au.type_desc
FROM sys.partitions p
JOIN sys.allocation_units au ON p.partition_id = au.container_id
WHERE au.type_desc IN ('LOB_DATA', 'ROW_OVERFLOW_DATA');
- If large object data exists, consider rebuilding the associated indexes with a different filegroup target before retrying the shrink.
- Use
ALTER INDEX ALL ON [TableName] REBUILD WITH (ONLINE = ON)to force data migration manually.
Step 3: Increase File Growth Limits and Retry Operation
- Navigate to SQL Server Management Studio (SSMS) and open Database Properties > Files.
- Change the Autogrowth/Maxsize setting for remaining files in the filegroup from a fixed limit to Unrestricted Growth.
- Re-run the shrink command in smaller increments to avoid timeout or log overflow:
DBCC SHRINKFILE (N'YourFileName', EMPTYFILE);
Step 4: Validate Disk and Storage Health
- On Windows Server 2025 / Windows 11, open Event Viewer and check the System logs for disk-related Event IDs (e.g., 153 or 129) which may indicate underlying I/O bottlenecks.
- Verify that the physical drive hosting the
.mdf/.ndffiles has enough raw disk space usingGet-PSDrivein PowerShell. - Ensure no file system-level corruption exists by running
chkdsk /fon the volume (requires a reboot if the volume is in use).
Alternative or Verification Steps
- After rebuilding indexes and expanding file growth settings, re-run
DBCC SHRINKFILE (N'YourFileName', EMPTYFILE)and confirm it completes without Error 2555. - If the error persists, as an alternative, mark the file as read-only temporarily, export the remaining data via
bcporSSIS, then recreate the filegroup structure cleanly to avoid migrating fragmented or non-movable data.