Attaching a Database
This topic describes how to attach a database by using dbForge Studio for SQL Server. You can use this feature to copy, move, or upgrade a SQL Server database.
Attaching a database
You can attach a copied or detached SQL Server database. When you attach a database, all data files (MDF and NDF files) must be available. If any data file has a different path from when the database was first created or last attached, you must specify the current path of the file.
You can’t attach a database in the following cases:
- A database created by a more recent version of SQL Server cannot be attached in earlier versions.
- Attempting to attach a database that has not been detached will return an error.
- Trying to select a database that is already attached generates an error.
To attach a database:
- Use Database Explorer to connect to the instance of the SQL Server database engine and then expand the instance.
- Right-click the instance, and then click Attach Database.
- In the Attach Database dialog box, click the Add button to specify the database to be attached.
- In the Browse For Folder dialog box, select the disk drive where the database resides and expand the directory tree to find and select the .mdf file of the database. Note, you can select several *.mdf files to attach.
- Optionally, specify a different name for the database to attach as.
- Optionally, you can select a different owner.
- Optionally, you can remove the selected file from the databases to attach grid by clicking the Remove button.
- Click OK.