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

Troubleshooting Guide: SQL Server Error 5524 — Default FILESTREAM Filegroup Cannot Be Removed

Why This Error Happens

Error 5524 occurs because SQL Server 2025 requires at least one FILESTREAM data filegroup to exist in the database as long as the database is marked as using FILESTREAM storage. When you attempt to drop or alter the default FILESTREAM filegroup while it is the only one remaining, SQL Server blocks the operation to prevent orphaning FILESTREAM data that may still be referenced by table columns or metadata. This typically happens when administrators try to reorganize storage topology without first migrating or removing dependent FILESTREAM objects.

Step-by-Step Resolution Guide

Step 1: Verify FILESTREAM Dependencies

  • Open SQL Server Management Studio (SSMS) and connect to the instance running on Windows Server 2025 or Windows 11.
  • Run the following query to check for tables using FILESTREAM columns:
  SELECT t.name AS TableName, c.name AS ColumnName
  FROM sys.tables t
  JOIN sys.columns c ON t.object_id = c.object_id
  WHERE c.is_filestream = 1;
  • If results are returned, you must remove or migrate these columns before the filegroup can be dropped.

Step 2: Create a New FILESTREAM Filegroup (If Needed)

  • If your goal is to reorganize storage rather than eliminate FILESTREAM entirely, add a new filegroup first:
  ALTER DATABASE [YourDB]
  ADD FILEGROUP FileStreamGroup2 CONTAINS FILESTREAM;
  • Add a file to the new filegroup pointing to a valid path, e.g., D:\SQLData\FileStreamData2.
  • Migrate any FILESTREAM data to the new filegroup using ALTER TABLE ... SWITCH or by rebuilding affected tables.

Step 3: Remove FILESTREAM Column References

  • Drop or alter any columns still referencing the default FILESTREAM filegroup:
  ALTER TABLE dbo.YourTable
  DROP COLUMN YourFileStreamColumn;
  • Confirm no FILETABLE objects exist that depend on the filegroup by querying sys.filetables.

Step 4: Drop the Original Default Filegroup

  • Once all dependencies are cleared and a secondary filegroup exists, remove the original default filegroup:
  ALTER DATABASE [YourDB]
  REMOVE FILEGROUP FileStreamGroupOriginal;
  • Ensure this is not flagged as the “last” FILESTREAM filegroup before execution, or the 5524 error will persist.

Step 5: Restart SQL Server Service

  • Open Services.msc on Windows Server 2025/Windows 11.
  • Restart the SQL Server (MSSQLSERVER) service to clear cached metadata locks related to FILESTREAM configuration.

Alternative or Verification Steps

  • Verify the fix by running sys.filegroups and confirming the old filegroup no longer appears in the result set while FILESTREAM functionality remains intact on the new filegroup.
  • If the error persists, back up the database, drop FILESTREAM entirely via ALTER DATABASE ... REMOVE FILESTREAM, and reconfigure it from scratch using a single, clean filegroup definition.