Friends who understand SQL Server 2005 databases may know that the tempdb system database is a global resource that can be used by all users connected to instances of SQL Server 2005. We sometimes change the location of the tempdb database to make it easy to operate, so how do we do that? In this article we will describe the process of this change.
Get the original location of tempdb:
SELECT [Name],[physical_name] from
sys.master_files
To change the tempdb database location:
1. Copy the original tempdb.mdf and templog.ldf files to the target location, and then execute the following statement:
Use master
go
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = ' F:\tempdb\tempdb.mdf ')
go
AL TER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = ' F:\tempdb\templog.ldf ')
2, restart the SQL Server service. The location of the tempdb database was changed successfully.
Knowledge about the tempdb database for SQL Server 2005 databases here, I hope to bring you a harvest!