SQL Server 2008 Tempdb 数据库迁移
1.首先检查数据文件位置及名称
SELECT name,physical_name FROM sys.database_files
2.迁移
USE master;
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'E:\MSSQL\tempdb.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev02, FILENAME = 'E:\MSSQL\tempdb02.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev03, FILENAME = 'E:\MSSQL\tempdb03.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'E:\MSSQL\templog.ldf');
GO
语句执行成功后会提示下次重启生效。
重启后执行 SELECT name,physical_name FROM sys.database_files 验证即可。