Sunday, July 20, 2008

HawkeSoft SQL Tips and Tricks - Part 5 - Move tempdb's Data and Log Files

A common oversite when setting up SQL Server is to leave the system database's data and log files on the system (C:) drive. These databases generally stay at a small size except for one, tempdb. tempdb can grow quickly and unexpectedly, bringing your server down before you know it. To easily move tempdb's files to a safer, larger drive simply customize the code below. (SQL Server 2000/2005)

ALTER DATABASE tempdb MODIFY FILE (name=tempdev, filename='D:\MSSQL\Data\tempdb.mdf')

ALTER DATABASE tempdb MODIFY FILE (name=templog, filename='D:\MSSQL\Data\templog.ldf')

No comments: