SQL Move TempDB

I always forget the code to do this because I do it so rarely.  If you want to move the location of TempDB for SQL Server do this:

 USE master
GO
ALTER DATABASE
tempdb
MODIFY FILE (NAME = tempdev, FILENAME = '{new location}\tempdb.mdf')
GO
ALTER DATABASE
tempdb
MODIFY FILE (NAME = templog, FILENAME = '{new location}\templog.ldf')
GO


Then restart the SQL Server services.

0 comments:

Post a Comment