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

Troubleshooting Guide: SQL Server Error 3108

Why This Error Happens

Error 3108 occurs because SQL Server requires the master database to be restored while running in single-user mode, and this condition has not been met. This typically happens when the SQL Server service is running normally (multi-user mode) or when another connection (including the one issuing the RESTORE command, if not configured correctly) is consuming the single available connection slot. Since master holds critical system metadata, SQL Server enforces this restriction to prevent corruption during the restore process.

Step-by-Step Resolution Guide

Step 1: Stop the SQL Server Service

  • Open SQL Server Configuration Manager on Windows Server 2025 / Windows 11.
  • Navigate to SQL Server Services, right-click your instance (e.g., MSSQLSERVER), and select Stop.
  • Ensure SQL Server Agent is also stopped to prevent background connections.

Step 2: Start SQL Server in Single-User Mode

  • Open Command Prompt as Administrator.
  • Navigate to the SQL Server binary directory, typically:
    C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\
  • Start the instance manually with the -m flag:
    sqlservr.exe -m -s "MSSQLSERVER"
  • This forces SQL Server into single-user mode, restricting connections to one.

Step 3: Connect Using SQLCMD (Not SSMS)

  • Open a second Command Prompt window (leave the single-user instance running in the first).
  • Connect via command-line tool to guarantee you consume the single available slot correctly:
    sqlcmd -S localhost -E
  • Avoid using SQL Server Management Studio initially, as it often opens multiple background connections (like IntelliSense) that trigger Error 3108.

Step 4: Execute the Restore Command

  • Run the restore command pointing to your valid backup file path:
    RESTORE DATABASE master FROM DISK = 'C:\Backups\master.bak' WITH REPLACE;
  • Press Enter and allow the server to shut down automatically to complete the restore.

Step 5: Restart the Service Normally

  • Close the command prompt windows used for the single-user session.
  • Go back to SQL Server Configuration Manager and Start the SQL Server service normally to exit single-user mode.

Alternative or Verification Steps

  • Verification: Check the SQL Server Error Log (located in the Log folder of your instance directory) to confirm the message “Recovery is complete” appears without further 3108 errors.
  • Alternative: If sqlcmd still fails to connect due to lingering background processes (like SQL Server Agent), use Task Manager to manually kill any sqlservr.exe or sqlagent.exe processes before restarting the single-user instance in Step 2.