SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

A Temporary Move

By Steve Jones, 2002/11/27

Total article views: 7093 | Views in the last 30 days: 37

A Temporary Move

Introduction

Recently I had to move a bunch of system databases on a server to have it conform to our standards. I last wrote about moving master to another drive and moving msdb to another drive. This time I am finishing the series with the last system database to move, tempdb.

Why would you move any system database? Well, I mentioned reasons in the other articles, but for tempdb the biggest reason is usually performance. By separating out tempdb from other databases, you can increase the throughput, especially if it moves to a separate physical drive.
The process turns out to be even simpler than moving msbd or master. Let's walk through this simple procedure. The first step is to open Query Analyzer and connect to your server. Once connected, you can run this script to get the names of the files used for tempdb.

use tempdb
go
sp_helpfile
go

You should see something like:

name    fileid filename                                                       filegroup  size
------- ------ -------------------------------------------------------------- ---------- -------
tempdev 1      C:\Program Files\Microsoft SQL Server\MSSQL\data\tempdb.mdf    PRIMARY    8192 KB
templog 2      C:\Program Files\Microsoft SQL Server\MSSQL\data\templog.ldf   NULL       768 KB
along with other information. Note the names of the files, usually tempdev and demplog by default. You need these names in the next statement, which will actually move the files. Suppose I wanted tempdb to move to a brand to t: drive with it's log on the u: drive. I could run the following:

use master
go
Alter database tempdb modify file (name = tempdev, filename = 't:\data\tempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'u:\data\templog.ldf')
go

At this point, the definition of tempdb is changed. However, since the database is rebuilt everytime SQL Server starts, there are no files to move. You stop and restart SQL Server and it will create tempdb in your new locations.

Read Part I - Move Your Master or part II - Moving MSDB

Conclusions

Once again, an easy process. Simple, but something that would require some research. Fortuneately, I've done that for you and hopefully this resource will be handy when you need it. If you have any comments or questions, please feel free to note them below using the "Your Opinion" button.

Steve Jones
©dkRanch.net November 2002


Return to Steve Jones Home

By Steve Jones, 2002/11/27

Total article views: 7093 | Views in the last 30 days: 37
Your response
 
 
Related tags
 
Like this? Try these...

Move Your Master

By Steve Jones | Category: Administering
| 8,977 reads

Moving MSDB

By Steve Jones | Category: Administering
| 11,461 reads
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com