This is because you can't move files while they're being accessed and taking the database offline stops the files from being used by the SQL Server application. Detach/Attach was already described, but it is not nearly this complex.Change the file locations with an Note, you do not need to declare the old location in this command.
Not my solution, I was looking for this solution myself and found it very useful for our production environment.
Thorfinn I am not sure that this is the best way (I would welcome any comments to tell me how it is not), but it's very simple (and quick if you have a small database): First, backup the database to a file.
Dejan Nakarada-Kordic has an explanation scripts for this method here: https:// The short version is that you add another database file at the new location, and then use DBCC Shrinkfile, with option EMPTYFILE to move the data from the old file to the new file.
When this is done you can remove the old data file.
In the Existing parameters box, select the –l parameter to move the master log file. In the Specify a startup parameter box, change the parameter to the new path of the master database.