T The Triage ManualTechnical Guides for IT Emergencies
P2 · Windows Server

SQL Server Fails to Start After ALTER DATABASE Sets Invalid tempdb File Path

A mistyped file path in an ALTER DATABASE MODIFY FILE command for tempdb prevents SQL Server from locating its tempdb files at startup, causing the instance to fail to start. Standard recovery via single-user mode (-m) is ineffective because tempdb cannot be found before full initialisation completes. The resolution is to start sqlservr.exe directly as a foreground application with flags -c -f -T3608 to recover only the master database, then correct the tempdb path via SQLCMD before restarting the service normally.

Indicators

Likely causes

Diagnostic steps

  1. Attempt to start SQL Server in single-user mode: 'net start mssqlserver -m'. Observe whether the error confirms tempdb cannot be found, establishing the tempdb path as the root cause.
  2. Review the SQL Server Error Log at the default path: C:\Program Files\Microsoft SQL Server\MSSQL<version>.MSSQLSERVER\MSSQL\Log\ERRORLOG. Identify the exact invalid path SQL Server is attempting to use for tempdb files.
  3. If master is accessible independently (e.g., via a known-good instance), query the bad tempdb path: SELECT name, physical_name FROM sys.master_files WHERE database_id = 2; — note this will not work while the affected instance is down.
  4. Open an elevated command prompt and navigate to the instance BINN directory: cd "C:\Program Files\Microsoft SQL Server\MSSQL<version>.MSSQLSERVER\MSSQL\Binn"
  5. Start SQL Server as a foreground application in minimal configuration mode, recovering only master, using: sqlservr.exe -c -f -T3608. For a named instance append: -s InstanceName. Leave this window open and do not close it.
  6. Open a second elevated command prompt and connect via SQLCMD: sqlcmd -S . -E (or sqlcmd -S .\InstanceName -E for a named instance). Wait for the '1>' prompt before proceeding.
  7. Confirm the incorrect tempdb file paths currently registered in master: SELECT name, physical_name FROM sys.master_files WHERE database_id = 2; GO
  8. Verify the intended correct path exists on the filesystem before executing the fix. Use xp_fileexist or confirm via Windows Explorer that the target directory is present and accessible to the SQL Server service account.

Resolution path

Prevention

Tools

References

sql-servertempdbstartup-failurealter-databaserecoverytrace-flag-3608sqlservr.exeminimal-configurationsystem-databasesqlcmdmaster-databasefile-pathinstance-recovery