6
4

1 回答 1

8

This can be done in the server properties.

enter image description here

  1. Right click on your server instance
  2. Click "Properties"
  3. Click "Database Settings"
  4. Change "Log" to whatever path you want (including alternate HDD)

EDIT

I misunderstood the above question... I suppose I should learn to read. The above instructions show how to move the LOG DB to a different hard drive.

The instructions found HERE will show you how to move the TempDB

Open Query Analyzer and connect to your server. Run this script to get the names of the files used for TempDB.

USE TempDB
GO
EXEC sp_helpfile
GO

Results will be something like:

| name     | fileid  | filename                                                | filegroup  | size     |
|----------|---------|---------------------------------------------------------|------------|----------|
| tempdev  | 1       | C:Program FilesMicrosoft SQLServerMSSQLdatatempdb.mdf   | PRIMARY    | 16000 KB |
| templog  | 2       | C:Program FilesMicrosoft SQL ServerMSSQLdatatemplog.ldf | NULL       | 1024 KB  |

Along with other information related to the database. The names of the files are usually tempdev and demplog by default. These names will be used in next statement. Run following code, to move mdf and ldf files.

USE master
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = tempdev, FILENAME = 'd:datatempdb.mdf')
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = templog, FILENAME = 'e:datatemplog.ldf')
GO

The definition of the TempDB is changed. However, no changes are made to TempDB till SQL Server restarts. Please stop and restart SQL Server and it will create TempDB files in new locations.

于 2011-05-07T02:24:51.973 回答