How to attach a database using dbForge Studio for SQL Server

Last modified: July 11, 2025

This topic describes how to attach a database. You can also use this feature to copy, move, or upgrade a SQL Server database.

Prerequisites

  • When you’re moving a database to a different SQL Server instance, you must detach it from the current instance first. Otherwise, you’ll get an error.
  • Ensure all data files, such as MDF and NDF files, are available. Otherwise, the attach operation will fail.
  • If any data file is in a different location than when the database was initially created or last attached, you must specify its current path.

Attach a database

1. Connect to a server instance.

2. Open the Attach Database dialog by doing one of the following:

  • On the top menu, select Database > Tasks > Attach Database.
  • In Database Explorer, right-click the instance to which you want to attach a database and select Tasks > Attach Database.
  • On the Start Page, select Administration > Attach Database.

Attach Database

3. In the Browse Files dialog, choose the .mdf file of the required database, then click OK.

Warning

Trying to select a database that is already attached results in an error.

Browse files

4. Optional: To add multiple .mdf files:

4.1. In the Attach Database dialog, click Add.

4.2. In the Browse Files dialog, choose the .mdf file, then click OK.

4.3. Repeat these steps for each file you want to add.

Add multiple .mdf files

5. Optional: To set a different name for the database, double-click its name in Attach As and specify a new name.

Tip

To remove the selected file from the grid in the Attach Database dialog, click Remove.

6. To apply the changes, click OK.

The database gets the Status - Successful icon, indicating that the database has been attached.

7. To close the dialog, click Close.

Finish Attach

Watch this video to learn how to detach and attach a database in SQL Server.