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

Troubleshooting Guide: SQL Server Error 3150 — “Master Database Successfully Restored, Shutting Down”

Why This Error Happens

This message appears after a RESTORE operation targeting the master database completes successfully, and SQL Server intentionally shuts itself down because the master database cannot be hot-swapped while the instance is running. This is expected behavior, not a true failure, and requires the SQL Server service to be manually restarted to load the newly restored system database. The issue typically arises during disaster recovery procedures, migrations, or when restoring a master database backup from a different server or point in time.

Step-by-Step Resolution Guide

Step 1: Confirm the Shutdown Is Expected Behavior

  • Check the SQL Server Error Log (default path: C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for the exact message: “The master database has been successfully restored. Shutting down SQL Server.”
  • Verify this occurred immediately after a RESTORE DATABASE master FROM DISK = '...' command executed in single-user mode.
  • This confirms the restore itself succeeded and the shutdown is a designed safety mechanism, not corruption.

Step 2: Restart the SQL Server Service in Normal Mode

  • Open Services.msc on Windows Server 2025 / Windows 11, or use PowerShell:
  • Restart-Service -Name 'MSSQLSERVER' (or the named instance service, e.g., MSSQL$INSTANCENAME).
  • If the service was started with -m (single-user mode) via command line for the restore, remove that startup parameter before restarting to allow normal multi-user connections.
  • Confirm via SQL Server Configuration Manager that startup parameters under the Startup Parameters tab no longer include -m or -f unless intentionally required.

Step 3: Validate Service Account Permissions and File Paths

  • Ensure the SQL Server service account has full read/write permissions on the data and log directories (typically C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\).
  • Confirm the restored master.mdf and mastlog.ldf files are not marked read-only or blocked by Windows file security (right-click → Properties → Unblock, if restored from a network/UNC source).
  • If permissions were recently changed, reapply the NT Service\MSSQLSERVER (or equivalent named instance account) ACLs using icacls to the DATA folder.

Step 4: Check for Port or Resource Conflicts Preventing Restart

  • Use netstat -ano | findstr 1433 to confirm no conflicting process is holding the SQL Server TCP port after shutdown.
  • Review Windows Event Viewer (Application log) for any Event ID 17826 or 17120 indicating the service failed to bind or initialize on restart.
  • Kill any orphaned sqlservr.exe process via Task Manager or taskkill /F /IM sqlservr.exe if the service fails to release the port cleanly.

Alternative or Verification Steps

  • After restarting the service, run SELECT @@VERSION; and SELECT name, state_desc FROM sys.databases; in SSMS or sqlcmd to confirm the instance is online and master shows an ONLINE state.
  • If the service repeatedly fails to start post-restore, start SQL Server in single-user mode via command line (sqlservr.exe -c -m -T3608) to isolate startup errors and inspect the Error Log before attempting a full restart.