تغییر مسیر بانک tempdb
يكشنبه, ۶ تیر ۱۳۹۵، ۱۱:۱۱ ق.ظ
A. Moving the tempdb database
The following example moves the tempdb
data and log files to a new location as part of a planned relocation.
![]() |
---|
|
-
Determine the logical file names of the
tempdb
database and their current location on the disk.SELECT name, physical_name AS CurrentLocation FROM sys.master_files WHERE database_id = DB_ID(N'tempdb'); GO
-
Change the location of each file by using
ALTER DATABASE
.USE master; GO ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'E:\SQLData\tempdb.mdf'); GO ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'F:\SQLLog\templog.ldf'); GO
Stop and restart the instance of SQL Server.
-
Verify the file change.
SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files WHERE database_id = DB_ID(N'tempdb');
Delete the
tempdb.mdf
andtemplog.ldf
files from the original location.
Moving the tempdb database
۹۵/۰۴/۰۶