获得tempdb的原始位置:
select [name],[physical_name] from sys.master_files where database_id=db_id(N'tempdb')
更改tempdb数据库位置
1、将原始tempdb.mdf和templog.ldf文件复制到目标位置,然后执行如下语句:
USE master
Go
ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'F:\tempdb\tempdb.mdf')
Go
ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'F:\tempdb\templog.ldf')
Go
2、重启sql server服务