SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files WHERE database_id = DB_ID(N'tempdb'); GO -- Stop SQL Server -- Copy files to new location -- Start SQL Server USE master; GO ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'E:\MSSQL\DATA\tempdb.mdf'); GO ALTER DATABASE tempdb MODIFY FILE (NAME = templog, FILENAME = 'E:\MSSQL\DATA\templog.ldf'); GO -- Restart SQL Server -- https://docs.microsoft.com/en-us/sql/relational-databases/databases/move-system-databases?view=sql-server-2017 -- https://www.mytechmantra.com/LearnSQLServer/How-to-Move-TempDB-to-New-Drive-in-SQL-Server/
Thứ Hai, 5 tháng 8, 2019
[T-SQL] Change Database Location
Đăng ký:
Đăng Nhận xét
(
Atom
)
Không có nhận xét nào :
Đăng nhận xét