Project

General

Profile

Перенос файлов баз данных (*mdf и *ldf) на другой диск » System_DB_files_moving.sql

Stanislav Serednitskiy, 22/03/2018 18:49

 
-- ####################################################################
-- Script for changing paths to physical files (mdf & ldf)
-- of the system databases (exept master).
-- Just change "D:\mdb\sys_db" to your preffered path in all strings.
-- Don`t forget to restart SQL Server proccess after execution.
-- ####################################################################

USE master;
GO

ALTER DATABASE msdb

MODIFY FILE (name = 'MSDBDATA', filename = 'D:\mdb\sys_db\MSDBDATA.mdf')

ALTER DATABASE msdb

MODIFY FILE (name = 'MSDBLOG', filename = 'D:\mdb\sys_db\MSDBLOG.ldf')

ALTER DATABASE model

MODIFY FILE (name = 'modeldev', filename = 'D:\mdb\sys_db\model.mdf')

ALTER DATABASE model

MODIFY FILE (name = 'modellog', filename = 'D:\mdb\sys_db\modellog.ldf')

ALTER DATABASE tempdb

MODIFY FILE (name = 'tempdev', filename = 'D:\mdb\sys_db\tempdb.mdf')

ALTER DATABASE tempdb

MODIFY FILE (name = 'templog', filename = 'D:\mdb\sys_db\templog.ldf')
(5-5/7)
Add picture from clipboard (Maximum size: 742 MB)