Resolution: Modify the the NDF files and assign fix file sizes.
Important Considerations
-
You cannot remove a
tempdb
file while SQL Server is running. -
File changes to
tempdb
must be made viaALTER DATABASE
, and SQL Server must be restarted for the changes to take effect.
✅ Step-by-step Process to Modify .ndf
Files from tempdb
1. Identify the .ndf
Files
Run this query to list all tempdb files:
This will list .mdf
, .ldf
, and any additional .ndf
files.
2. Alter the tempdb
to Modify the .ndf
Files
You can modify each file using this command:
Repeat for each .ndf
file.
Note: If the file is in use, this command will fail. Since tempdb
is re-created every time SQL Server restarts, this command prepares the configuration for the next restart.
3. Restart SQL Server
After successfully executing the ALTER DATABASE
command(s), restart the SQL Server instance for the changes to take effect.
-
You can do this through SQL Server Configuration Manager or Services.msc.
4. Verify Removal
After restart, check again:
The .ndf
files should change the file size.
-----------------------------------------------------------------------------------------------------------
To reconfigure tempdb
for a 10-core SQL Server using 6 evenly sized data files (tempdev
, tempdb2
–tempdb6
), all placed in the same default directory.