Monday, October 25, 2010

How to move tempdb location on SQL Server

Quick steps to move the temp table to a different hard drive. USE master;GO

ALTER
MODIFY FILE (NAME = tempdev, FILENAME = 'e:\dbroot\tempdb_sqlservernew.mdf');GO

ALTER
MODIFY FILE (NAME = templog, FILENAME = 'e:\dbroot\tempdb_sqlservernewlog.ldf');GO

Reason to do: To improve system/IO performance. Almost all the transactions like sorting, swifting and collation done by SQL Server uses this temporary table. Preferably it should be on a RAID drive.

DATABASE tempdb
DATABASE tempdb

Increase SQL Server Memory option

sp_configure 'show advanced options', 1
reconfiguresp_configure 'max server memory', '1000'