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

Troubleshooting Guide: SQL Server Error 5555 — FILESTREAM Data Cannot Be Renamed

Why This Error Happens

Error 5555 typically occurs when SQL Server attempts to perform a rename operation on a FILESTREAM-enabled file or directory while the underlying file is locked by the OS, an antivirus scanner, or an open file handle from another process. This can also result from NTFS permission misconfigurations on the FILESTREAM data container, where the SQL Server service account lacks the necessary rename/write/modify rights. In some cases, filesystem corruption or an interrupted I/O operation on the FILESTREAM filegroup directory leaves orphaned file handles that block subsequent rename transactions.

Step-by-Step Resolution Guide

Step 1: Verify FILESTREAM Service and Instance Configuration

  • Open SQL Server Configuration Manager and confirm FILESTREAM is enabled for the instance (right-click the SQL Server service → Properties → FILESTREAM tab).
  • Ensure “Enable FILESTREAM for Transact-SQL access” and “Enable FILESTREAM for file I/O streaming access” are both checked.
  • Run the following T-SQL to confirm the instance-level setting matches:
  EXEC sp_configure 'filestream access level';
  • If mismatched, set it with EXEC sp_configure 'filestream access level', 2; RECONFIGURE;

Step 2: Check and Repair NTFS Permissions on the FILESTREAM Directory

  • Navigate to the FILESTREAM data container path (e.g., D:\SQLData\FileStreamStore\).
  • Right-click the folder → Properties → Security tab, and confirm the SQL Server service account (e.g., NT SERVICE\MSSQLSERVER) has Full Control.
  • Use PowerShell to grant permissions if missing:
  icacls "D:\SQLData\FileStreamStore" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" /T
  • Restart the SQL Server service after applying permission changes.

Step 3: Release Locked File Handles and Exclude AV Scanning

  • Use Process Explorer (Sysinternals) to search for open handles on the FILESTREAM directory and terminate any conflicting process locking the file.
  • Add the FILESTREAM data folder and the SQL Server .mdf/.ldf/FILESTREAM container paths to your antivirus exclusion list, since real-time scanning often locks files mid-rename.
  • On Windows Server 2025 Defender, run:
  Add-MpPreference -ExclusionPath "D:\SQLData\FileStreamStore"

Step 4: Check for Filesystem Corruption

  • Run chkdsk D: /f /r (replace D: with your FILESTREAM volume) during a maintenance window to repair underlying NTFS inconsistencies.
  • Restart the server if prompted, then validate the volume health via fsutil dirty query D:.

Step 5: Rebuild or Reassociate the FILESTREAM Filegroup (If Issue Persists)

  • If renaming still fails at the SQL level, detach the affected database, verify the FILESTREAM filegroup path integrity, then reattach it using CREATE DATABASE ... FOR ATTACH.
  • Validate FILESTREAM filegroup consistency with:
  DBCC CHECKFILEGROUP (N'FileStreamGroup');

Alternative or Verification Steps

  • After applying fixes, attempt the original rename/update operation again and confirm no Error 5555 is thrown in SQL Server Error Logs (SQL Server Logs via SSMS → Management → SQL Server Logs).
  • As an alternative, if the issue persists only on a specific table, export the FILESTREAM data via OPENROWSET(BULK...), drop and recreate the FILESTREAM column, then re-import the data to bypass the corrupted file reference.