Problems with product updates? Read more

How to move Microsoft SQL Server databases to a new location by using detach and attach functions in Microsoft SQL Server

  1. Open the Microsoft SQL Management Studio server and connect to the Microsoft SQL server where the database is located
  2. Locate the database you want to move the location of under the Databases node
  3. Right click the database and choose Properties
  4. Click the Files node of the Database Properties dialog
  5. Note the Path and Filename of both of the files (one will be a .MDF database file and one will be a .LDF transaction log file) and close the dialog
User-added image
  1. Make sure the GFI Software application that uses the database is no longer running (close the console and stop the services)
  2. Right click the database and choose Tasks > Take Offline
User-added image
  1. Next, right click the database and choose Tasks > Detach...
  2. Check the box to Drop Connections and click the OK button at the bottom
User-added image
  1. Move the database files to the drive and directory where you want to store them
  2. In the management studio, right click the Databases node and select Attach...
User-added image
  1. Click the Add... button, navigate to the directory you put the .MDF database file and select it (it will automatically add the .LDF transaction log file)
  2. Click OK and the database will be re-attached
User-added image


Notes:

  • This procedure can also be done using SQL statements. See the following Microsoft article: http://support.microsoft.com/kb/224071
  • Before attempting any database modifications, please ensure all appropriate GFI Software services are stopped, to ensure no data is lost