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

Troubleshooting Guide: Error 3170 – “The STANDBY Filename Is Invalid”

Why This Error Happens

Error 3170 occurs when SQL Server cannot create or write to the undo file specified in a RESTORE ... WITH STANDBY = 'filepath' command. This is typically caused by an invalid or inaccessible directory path, insufficient NTFS permissions for the SQL Server service account, or the target folder not existing on the Windows Server 2025 / Windows 11 host. It can also occur if the path contains unsupported characters, references a mapped drive not visible to the service account, or points to a read-only or disconnected volume.

Step-by-Step Resolution Guide

Step 1: Verify the STANDBY File Path Exists

  • Open File Explorer or PowerShell and confirm the directory specified in the STANDBY = clause actually exists (e.g., C:\SQLStandby\).
  • If the folder is missing, create it manually:
  New-Item -Path "C:\SQLStandby" -ItemType Directory
  • Ensure the path does not point to a removable, disconnected, or mapped network drive that SQL Server’s service account cannot resolve.

Step 2: Check NTFS Permissions for the SQL Server Service Account

  • Identify the service account running SQL Server via SQL Server Configuration Manager.
  • Right-click the target folder (e.g., C:\SQLStandby) → Properties → Security tab.
  • Grant Full Control or at minimum Modify + Write permissions to the SQL Server service account (e.g., NT Service\MSSQLSERVER or a named instance like NT Service\MSSQL$INSTANCENAME).
  • Apply changes and restart the SQL Server service if permissions were just modified:
  Restart-Service -Name 'MSSQLSERVER'

Step 3: Correct the Syntax and Path Format in the RESTORE Command

  • Double-check the restore statement for typos, trailing slashes, or invalid characters in the filename.
  • Use a fully qualified local path rather than a relative or UNC path when possible:
  RESTORE DATABASE [YourDB]
  FROM DISK = 'D:\Backups\YourDB.bak'
  WITH STANDBY = 'C:\SQLStandby\YourDB_Undo.ldf', NORECOVERY;
  • If using a UNC path (e.g., \\FileServer\Share\), confirm the SQL Server service account has domain-level read/write access to that share.

Step 4: Validate Disk Space and Volume Health

  • Confirm the target volume has sufficient free disk space for the undo file to be created.
  • Run chkdsk on the volume if corruption or file-system errors are suspected:
  chkdsk C: /f
  • Reboot if prompted, then retry the restore operation.

Alternative or Verification Steps

  • After applying the fix, rerun the RESTORE ... WITH STANDBY command and confirm the operation completes without Error 3170, then verify the undo file (.ldf or .tuf) now appears in the target directory.
  • As an alternative, switch to WITH NORECOVERY instead of STANDBY if read-only access to the database between restores is not required — this bypasses the undo file requirement entirely.