How to move the SQL tempDB database files

  MS SQL

Open SSMS (If you don’t know what is SSMS, you shouldn’t be doing this…)

Paste and execute this query, modifying it to your needs

USE master
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = tempdev, FILENAME = 'd:\data\tempdb.mdf')
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = templog, FILENAME = 'e:\logs\templog.ldf')
GO

Restart the MS SQLSERVER Services.

A new tempDB data and log files will be created in the newly specified location. You can deleted the original ones.

Do not forget, you must assign full control permission to NT SERVICE\MSSQLSERVER  on your new folder prior to moving the files

 

Leave a comment