Categories Tags

Relocating the TEMPDB

Today, I realized that I had accidentally placed the TEMPDB on the wrong disk drive. At first I thought that I may need to re-install SQL Server 2012 because it is a system database. But, luckily you do not!

All I ended up having to do is the following:

  1. Run this script:

USE master


ALTER DATABASE TempDB MODIFY FILE (NAME = tempdev, FILENAME = 'd:\data\tempdb.mdf')


ALTER DATABASE TempDB MODIFY FILE (NAME = templog, FILENAME = 'e:\data\templog.ldf')

  1. Restart SQL Server

And BAM. The TEMPDB has been relocated for you J


Posted in sql-server