Friday, September 10, 2010

Move the Tempdb database to new location

Move the tempdb database to new location to speed up the system

-- Find out the current default location of the tempdb database when you installed in SQL 2005
sp_helpdb tempdb

tempdev 1 E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\tempdb.mdf
templog 2 E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\templog.ldf


-- Move to new location for fastest disk
USE master
go

ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'E:\MSSQL\Data\tempdb.mdf')
go

ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'E:\MSSQL\Data\templog.ldf')
go