How to move Tempdb data and Log Files - SQL Server DBA Tutorial

In this video you will learn how to move Tempdb data and log files from current location to new location. It also demonstrates step by step process of how to find current location of Tempdb Files, How to move Tempdb Files to new location using T-SQL Script and what is required for sql server to use new tempdb file location. How to restart SQL Server Services.

Script used in the video to Move TempDB Data and Log Files

-- Current location of Tempdb
SELECT name, physical_name AS CurrentLocation
FROM sys.master_files
WHERE database_id = DB_ID(N'tempdb');
GO

--Move Tempdb Files
USE master
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = tempdev, FILENAME = 'C:\SQLSysBackup\tempdb.mdf') -- New Location DataFile
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = templog, FILENAME = 'C:\SQLSysBackup\templog.ldf')--New Location LogFile
GO


How to move Tempdb data and Log Files - SQL Server DBA Tutorial