Its very easy and simple , Just sharing you the steps without so much theories
Why we are moving it , when its in C Drive or SQL Data Drive it will cause IO issues , so that we are moving TempDB files into different location
Step 1: Check Current TempDB Files Location
Run the following query:
USE tempdb;EXEC sp_helpfile;
Step 2: Plan New Location
- Create a new folder on the desired drive (e.g., D:\SQLData\TempDB).
- Ensure SQL Server service account has Full Control on that folder.
Step 3: Modify TempDB File Paths
Run these commands (adjust paths as needed):
USE master;ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME ='D:\SQLData\TempDB\tempdb.mdf');ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME ='D:\SQLData\TempDB\templog.ldf');
Repeat for additional files if they exist.
Step 4: Restart SQL Server Service
Stop and Start the SQL Server instance. Restart is mandatory for changes to take effect.
Step 5: Verify New Location
USE tempdb;EXEC sp_helpfile;
This should show the new paths.
Step 6: Clean Up Old Files
After SQL Server restarts successfully and TempDB is created in the new location, manually delete
the old tempdb files from the old drive.
0 comments:
Post a Comment