Link to home
Start Free TrialLog in
Avatar of bjennings
bjennings

asked on

Sql Server 2012 - Moving multiple tempdb files to a different Partition

Hello Everyone,

Our tempdb is made up of 16 different files.  I need to move the tempdb to a different partition.  I found the script below to move the tempdb, but I was not sure how to move all the multiple files.  Should I add every file tempdev1, tempdev2, tempdev3...etc... to this script?

Thanks,

Bill

use master
go
Alter database tempdb modify file (name = tempdev, filename = 'F:\program files\microsoft SQL server\tempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'F:\program files\microsoft SQL server\templog.ldf')
go
ASKER CERTIFIED SOLUTION
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, you need to specify a separate command for every file.  Then, when SQL Server cycles (stops and restarts), the tempdb files will be created in the new location.  The old tempdb files will still be in the original location, you will have to delete them yourself.

Btw, 16 is very likely too many tempdb data files.  You need to review that as well.
Avatar of bjennings
bjennings

ASKER

Thank you so much!