Comments
 
posted on May 26th 2015, at 14:17
by lunarg
You can move the tempdb of a SQL Server instance to another location using T-SQL, but this requires a little bit of downtime: setting a new location will only take effect after a restart of the SQL Server instance.

First, retrieve the tempdb's current location and logical name:

Use tempdbGOSELECT name,filename FROM sys.sysfilesGO

This should give you two entries: one for the actual database, and one for the transaction log of tempdb. Now that we have the location and logical name, we can change it:

ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'T:\newdir\tempdb.mdf');GOALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'T:\newdir\templog.ldf');GO

Replace the p  ...
Add a new comment
 
Your name:
Your e-mail:
Your comment:
 
Basic BBcode is supported.
Captcha:
Type the letters and numbers as shown.
/get/captcha/1713872574
Not readable? Get another.
 
 
 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« Have you tried turning it off and on again? »
The IT Crowd