In
order to check the details about the SQL Server TempDB database MDF and LDF
files, we can use the following command:
USE tempdb
EXEC sp_helpfile
GO
This
will return details about SQL Server TempDB MDF and LDF files as given in the
below screenshot:
The details are the default values that are used by SQL Server for the TempDB, in case we have not changed at the time of installation. In case we want to change the path and file name, we can use the following command:
USE master
GO
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\tempdb_new.mdf')
GO
ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\templog_new.ldf')
GO
The
above will change the path and names of the TempDB MDF and LDF files. But in
order to actually come in effect, we need to restart the SQL Server Service.
Happy Coding!!!
Comments