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

Troubleshooting Guide: Error 5124 in Microsoft SQL Server 2025

Why This Error Happens

Error 5124 occurs when SQL Server detects a mismatch between the file header of a full-text catalog file and the metadata recorded for it in the database. This typically happens due to disk-level corruption, an improper shutdown during a write operation, or a full-text catalog file being restored or copied from a different database without its corresponding data files. It can also surface if antivirus or backup software locked or modified the catalog file while SQL Server had it open, leading to header desynchronization.

Step-by-Step Resolution Guide

Step 1: Verify the Scope of Corruption

  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm whether corruption is isolated to the full-text catalog or extends to core data files.
  • Check the SQL Server Error Log (Management > SQL Server Logs) for correlating I/O or disk errors around the same timestamp as Error 5124.
  • Identify the exact catalog file path referenced in the error, typically located under C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\FTData\.

Step 2: Rebuild the Full-Text Catalog

  • Open SSMS and navigate to Database > Storage > Full Text Catalogs.
  • Right-click the affected catalog and select Rebuild (this is non-destructive to your base tables, only full-text indexes are regenerated).
  • Alternatively, run the T-SQL command:
ALTER FULLTEXT CATALOG YourCatalogName REBUILD;
  • Repopulate the index afterward with:
ALTER FULLTEXT CATALOG YourCatalogName START FULL POPULATION;

Step 3: Restore From a Known Good Backup (If Rebuild Fails)

  • If the rebuild fails or the underlying database file itself is flagged as mismatched, restore the full database (including the full-text catalog) from the last known good backup.
  • Use RESTORE DATABASE YourDatabaseName FROM DISK = 'D:\Backups\YourDatabaseName.bak' WITH REPLACE, RECOVERY;
  • Ensure you are restoring the entire database, not just the catalog files individually, since full-text catalogs are tightly bound to internal GUIDs within the database.

Step 4: Exclude SQL Server Directories From Antivirus/Backup Locks

  • Add exclusions in Windows Defender or your third-party AV for the MSSQL\DATA and MSSQL\FTData folders.
  • Navigate to Windows Security > Virus & Threat Protection > Exclusions and add the full SQL Server instance directory.
  • Restart the SQL Server service via services.msc or Restart-Service MSSQLSERVER in PowerShell to clear any stale file handles.

Alternative or Verification Steps

  • After rebuilding or restoring, run a test full-text query (e.g., SELECT * FROM YourTable WHERE CONTAINS(YourColumn, 'testword');) to confirm the catalog is operational and returning results.
  • If the error persists, run DBCC CHECKDB with the REPAIR_ALLOW_DATA_LOSS option only as a last resort on a copy of the database, and always validate against a backup before applying destructive repairs.