Monday, May 19, 2014

Move TempDB files to different location

Use below query to move TempDB data and log files to some other location/drive:

ALTER DATABASE Database_Name MODIFY FILE ( NAME = Logical_Name, FILENAME = 'New_Location\File_Name' )

In above query Logical_Name you can get from below query:

SELECT db_name(dbid) AS DataBaseName, * FROM sys.sysaltfiles WHERE dbid = db_id('TempDB')


New_Location\File_Name is new path and file file for TempDB database.

After moving data and log files you had to restart SQL Server .

No comments:

Post a Comment