Objective
To move the SQL database .mdf and .ldf files to another drive on the server.

Environment
Primary Product OS : Windows 2012 Server
Primary Product Module : Microsoft SQL 2012

Procedure

  1. Launch Microsoft’s SQL Server Management Studio.
  2. Login to the SQL instance with an account that has the SysAdmin server role.
  3. Expand the folder labeled “Databases”
  4. Right click the database that needs the files to be moved to another location.
  5. Select “Properties”.
  6. In the Database Properties window, in the Select a page pane, click “Files”.
  7. “Write down” the paths and filenames that are for the database.
  8. Click “OK”.
  9. Right click the database that needs the files to be moved to another location.
  10. Select “Tasks => Detach…”.
  11. In the Detach Database window, check the box “Drop Connections”.
  12. Click “OK”.
  13. Launch Windows Explorer.
  14. Browse to the path you wrote down in step 7.
  15. “Move” the database’s files to the new location.
  16. “Write down” the paths where you moved the files to.
  17. Return to the Microsoft’s SQL Server Management Studio.
  18. Right click the folder labeled “Databases”
  19. Select “Attach…”.
  20. In the Attach Databases window, click “Add”.
  21. Browse to the path you wrote down in step 16.
  22. Select the .mdf filename for the database.
  23. Click “OK”.
  24. If the other files are not found, click the ellipsis next to the filename that is not found.
  25. In the Locate Database Files window, “browse” to the location of the file for the database that you wrote down in step 16.
  26. Select the file.
  27. Click “OK”.
  28. In the Attach Databases window, click “OK”.