Attaching SQL Server databases

This section describes how to attach a database in SQL Server by using SQL Server Management Studio. Only one database can be attached at a time.

Attaching a database requires any of the following permissions: CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY DATABASE. Normally, these permissions are granted to the sysadmin role of the instance.

To attach a database

  1. Run Microsoft SQL Server Management Studio.
  2. Connect to the required SQL Server instance, and then expand the instance.
  3. Right click Databases and click Attach.
  4. Click Add.
  5. In the Locate Database Files dialog box, find and select the .mdf file of the database.
  6. In the Database Details section, make sure that the rest of database files (.ndf and .ldf files) are found.

    Details. SQL Server database files may not be found automatically, if:

  7. When all of the files are found, click OK.