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

Troubleshooting Guide: Error 5516 – FILESTREAM Log Filegroup Referenced by Multiple Data Filegroups

Why This Error Happens

This error occurs because SQL Server 2025 enforces a strict one-to-one relationship between a FILESTREAM data filegroup and its associated log filegroup. It is typically triggered when a database creation or restore script mistakenly assigns the same FILESTREAM filegroup name to two different data filegroups, or when a database migration process duplicates filegroup metadata without updating the internal references. Corrupted system catalog views (such as sys.filegroups) following an improper backup restoration can also cause this conflict to surface.

Step-by-Step Resolution Guide

Step 1: Audit the Current Filegroup Structure

  • Open SQL Server Management Studio (SSMS) and connect to the instance running on Windows Server 2025.
  • Run the following query to inspect existing filegroups: SELECT name, type_desc, is_default FROM sys.filegroups;
  • Identify if two “FILESTREAM_DATA” type filegroups are pointing to the same log filegroup name.

Step 2: Correct the T-SQL Script or Restore Logic

  • Locate the CREATE DATABASE or ALTER DATABASE script responsible for the error.
  • Ensure every ADD FILEGROUP command for FILESTREAM data uses a unique, distinct name (e.g., FileStreamGroup1, FileStreamGroup2).
  • Verify that the CONTAINS FILESTREAM clause is not duplicated across multiple ADD FILEGROUP statements referencing the same log path.

Step 3: Drop and Recreate the Conflicting Filegroup

  • If the duplication already exists in a live database, run ALTER DATABASE [YourDB] REMOVE FILEGROUP [DuplicateGroupName]; to clear the conflict.
  • Re-create the filegroup with a unique identifier using ALTER DATABASE [YourDB] ADD FILEGROUP [UniqueFileStreamGroup] CONTAINS FILESTREAM;.
  • Restart the SQL Server service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER to clear any cached metadata locks.

Step 4: Validate File Paths in Windows Server 2025

  • Check the physical directory structure (e.g., C:\SQLData\FileStream\) to ensure no manual folder duplication is causing the engine to misread the filegroup association.
  • Confirm that NTFS permissions for the SQL Server service account allow unique write access to each specific FILESTREAM folder.

Alternative or Verification Steps

  • Verification: Re-run the sys.database_files query to confirm that the type_desc column shows FILESTREAM only once per unique filegroup pairing before attempting to bring the database online.
  • Alternative: If the error persists after script correction, detach the database, manually inspect the .mdf header using a hex editor for orphaned pointers, and perform a clean CREATE DATABASE followed by a data-only migration via BCP or SSIS to bypass the corrupted metadata entirely.