How to move user database from one drive to another drive

Опубликовано: 23 Февраль 2026
на канале: Solved Pages
561
14

In this video I have explained how to move user database from one drive to another drive.

--How to move the database from one drive to another drive

--1. Detach and attach
--2. by putting the database offline


--1. sp_helpfile to get the file info
--2. Detach the database
--3. move the files from old drive to new drive manually
--4. Attach the database.

--2. by putting the database offline.
--Run the alter query
--Put the database offline
--move the files from old drive to new drive
--bring the database online.
--sp_Helpfile

ALTER DATABASE TEST
MODIFY FILE(NAME =TEST, FILENAME = 'E:\move databases\TEST.MDF')
ALTER DATABASE TEST
MODIFY FILE(NAME = TEST_LOG, FILENAME='E:\move databases\TEST_lOG.LDF')