How to fix Error 606 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 606 – Metadata Inconsistency (Filegroup ID Not Found)

Why This Error Happens

Error 606 occurs when SQL Server’s internal system catalog (sys.sysallocunits, sys.filegroups, or related metadata tables) references a filegroup ID that no longer exists for a given table. This typically happens due to database corruption caused by improper shutdowns, storage-level failures, or interrupted filegroup operations (such as a failed ALTER DATABASE ... REMOVE FILEGROUP command). It can also occur after a botched database restore, replication mismatch, or manual manipulation of system tables.

Step-by-Step Resolution Guide

Step 1: Run DBCC CHECKDB to Assess Damage

  • Open SQL Server Management Studio (SSMS) or sqlcmd on your Windows Server 2025 / Windows 11 host.
  • Execute: DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output for specific object IDs and filegroup IDs flagged as inconsistent.
  • Note whether the corruption is isolated to one table or spans multiple system catalog views.

Step 2: Validate Filegroup and Catalog Consistency

  • Run DBCC CHECKCATALOG ('YourDatabaseName'); to specifically check for orphaned metadata references.
  • Cross-reference the reported filegroup ID against SELECT * FROM sys.filegroups; to confirm it is genuinely missing.
  • Check sys.database_files to see if a data file tied to that filegroup was dropped or is offline.

Step 3: Restore From a Known-Good Backup

  • If corruption is confirmed and no repair options resolve it cleanly, restore the database from the most recent verified backup taken before the inconsistency appeared.
  • Use: RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE, RECOVERY;
  • Ensure the backup file path exists and the SQL Server service account has read permissions on that directory.

Step 4: Apply Emergency Repair as a Last Resort

  • If no backup is available, set the database to emergency mode: ALTER DATABASE YourDatabaseName SET EMERGENCY;
  • Run DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS; in single-user mode.
  • Understand this may drop the affected rows or objects tied to the invalid filegroup reference — treat this as a data-loss operation.

Step 5: Rebuild Filegroup Structure if Needed

  • If the filegroup was legitimately removed but references remain, manually script out the affected table and recreate it under a valid, existing filegroup.
  • Use sp_help 'TableName' to confirm current filegroup mapping before recreating objects.

Alternative or Verification Steps

  • After remediation, re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; and confirm zero allocation or consistency errors are returned.
  • If Error 606 persists after backup restoration, engage Microsoft Support with the DBCC output logs, as it may indicate deeper storage subsystem corruption (check Windows Event Viewer for related Disk or NTFS errors).