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

Troubleshooting Guide: Error 5525 – FILESTREAM Log Filegroup READONLY/READWRITE Property Cannot Be Modified

Applies to: Microsoft SQL Server 2025 | Windows Server 2025 / Windows 11


Why This Error Happens

Error 5525 occurs because SQL Server does not allow the READONLY or READWRITE property to be explicitly set on a filegroup that has been designated as the FILESTREAM log filegroup. This filegroup is internally managed by the Database Engine to track FILESTREAM data operations, and its read/write state is tied directly to the state of the PRIMARY filegroup and the database itself rather than being independently configurable. Attempting to run ALTER DATABASE ... MODIFY FILEGROUP directly against this special filegroup triggers the error because the engine blocks manual state changes to protect transactional consistency of FILESTREAM data.


Step-by-Step Resolution Guide

Step 1: Identify the FILESTREAM Filegroup in Question

  • Run the following query to confirm which filegroup is marked as the FILESTREAM log/data filegroup:
  SELECT name, type_desc, is_default, is_read_only 
  FROM sys.filegroups;
  • Confirm the type_desc returns FILESTREAM_DATA_FILEGROUP — this confirms you are targeting a restricted filegroup.

Step 2: Change the Read/Write State at the Database Level Instead

  • Do not attempt to modify the individual FILESTREAM filegroup directly.
  • Instead, set the read-only state at the full database level, which will cascade correctly to FILESTREAM containers:
  ALTER DATABASE [YourDatabaseName] SET READ_ONLY;
  • To revert, use:
  ALTER DATABASE [YourDatabaseName] SET READ_WRITE;

Step 3: Verify No Active Connections Are Blocking the Change

  • Ensure no open transactions or active sessions are using FILESTREAM data, as this can cause the ALTER DATABASE command to hang or fail silently.
  • Run:
  SELECT session_id, status, last_request_start_time 
  FROM sys.dm_exec_sessions 
  WHERE database_id = DB_ID('YourDatabaseName');
  • Kill blocking sessions if necessary using KILL <session_id>.

Step 4: Restart the SQL Server FILESTREAM Service (If State Remains Stuck)

  • Open Services.msc on Windows Server 2025 / Windows 11.
  • Restart the SQL Server (MSSQLSERVER) service to force FILESTREAM subsystem re-initialization.
  • Re-run the ALTER DATABASE command from Step 2 after the service comes back online.

Alternative or Verification Steps

  • Verify the fix by re-querying sys.databases and checking the is_read_only column matches your intended state (1 for read-only, 0 for read-write).
  • If the database still refuses to change state, detach and re-attach the database, then reapply the ALTER DATABASE command, as a stale metadata cache on the FILESTREAM container can sometimes cause Error 5525 to persist.