I know you don't want to hear this but i am not a DBA, but I am responsible for a 2016 SQL server. From time to time I need to do some DBA work.
This time I need to move the tempdb (mdf, ndf, and ldf files) to another volume.
When i run the alter database query do i need to specify the ndf files in the query? Or do those move automatically because they are part of the file group?
Being each of the ndfs have logical names, I am thinking I need to, but just want to be certain.
I know I need to specify the LDF files.
These are all the files we have associated with the TEMPDB:
tempdev C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb.mdftemplog C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\templog.ldftemp2 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_2.ndftemp3 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_3.ndftemp4 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_4.ndftemp5 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_5.ndftemp6 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_6.ndftemp7 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_7.ndftemp8 C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb_mssql_8.ndf
Thanks for the help!
-Evan
Best Answer
ALTER DATABASE
can be used to do many things. In order to move the file you'll want to useMODIFY FILE
to move your files to the specified location. This goes for mdf, ndf, ldf. Erik Darling blogged about this a while back and gave some examples.From the docs: