I am trying to change the location of mdf and ldf file from one disk drive to other disk drive due to storage limit.

Currently, the database that I am trying to move to other drive is in "Standby / Read-Only" mode.

But, my understanding is that, in order move mdf file and attach database, I need to change the mode to "regular" before moving.

Also, my understanding is that if I change the mode from "Standby / Read-Only" mode to something else, I cannot go back to restoring without restoring the backups again.

How do I go about doing it (attaching the "Standby / Read-Only" database after detaching)?

1 Answer 1


With the database in RESTORING state, run ALTER DATABASE ... MODIFY FILE to change where SQL Server will expect to find the database files. Then shut down SQL Server and move the files there. Shutting down SQL Server is an alternative to setting the database offline or detaching it as outlined in the docs Move User Databases, which can't be done in this case.

See eg: Steps to Move SQL Server Log Shipping Secondary Database Files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.