SQLServer temporary library file is too large tempdb database migration

Problem Description:

Recently the company here tempdb large library, several hundred GB of rhythm

However, when installing the database, tempdb preferably not on C drive is other data on the D drive disk

If not on the other letter below, we need to do a migration

Solution:

If tempdb in the C drive is moved to another disk location

Because tempdb is re-created each time the MSSQLSERVER service is started, there is no need to move the data and log files from the physical sense.

If the source is located tempdb out of disk space on the physical move to a larger space in the disk location.

Migration steps:

1. Determine the logical file names of the tempdb database and the current location on the disk.
SELECT name, physical_name
FROM sys.master_files
WHERE database_id = DB_ID('tempdb');
GO
2, use the ALTER DATABASE to change the location of each file
USE master;
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = tempdev, FILENAME = 'D:\Tempdb\tempdb.mdf');
GO
ALTER DATABASE tempdb 
MODIFY FILE (NAME = templog, FILENAME = 'D:\Tempdb\templog.ldf');
GO
3, stop and restart the SQL Server service

 

Guess you like

Origin www.cnblogs.com/Sungeek/p/11597095.html