Wednesday, May 27, 2009

Moving Database Files Detach/Attach or ALTER DATABASE? - SQLServerCentral

 

At times it can be necessary to move the data and or log files from one location to another on the same SQL Server. There are two ways to go about doing this task, detaching the database from the SQL Server Instance, moving the files to the new location in the operating system, and then reattaching the database to the SQL Server Instance, and using ALTER DATABASE with the MODIFY FILE option to move the files through a metadata switch, taking the database offline, moving the file in the operating system and then bringing the database back online. Both accomplish the same task, but there are a number of reasons why the ALTER DATABASE method can make more sense for doing this kind of task.

Moving Database Files Detach/Attach or ALTER DATABASE? - SQLServerCentral

No comments: