Recently, when I was working on a database, I found that the disk space is often insufficient due to the large size of tempdb. To solve this problem, we use a solution to move tempdb to a new location.
The procedure is as follows;
1. Check the logical name and location of tempdb. You can use the following statement:
SELECT name, physical_name
FROM sys. master_files
WHERE database_id = DB_ID ('tempdb ');
2. Suspend the database service.
3. Copy the original tempdb file to the new location (the original file location can be obtained through the above query ).
3. Start the database service after the copy is completed.
4. Run the following command: USE master;
GO
Alter database tempdb
Modify file (NAME = tempdev, FILENAME = 'e: \ tempdb. mdf ');
GO
Alter database tempdb
Modify file (NAME = templog, FILENAME = 'e: \ tempdb \ templog. ldf ');
GO
Here, name = tempdev and templog are the logical names of tempdb, and FileName = 'e: \ temdb \ tempdb. mdf 'is the new location of tempdb.
5. Check whether tempdb is successfully moved.
SELECT name, physical_name
FROM sys. master_files
WHERE database_id = DB_ID ('tempdb ');
Original article addressHttp://www.cnblogs.com/steven-zhou-2005/archive/2006/08/09/472042.html