Description:
You can attach a copied or detached SQL Server database. When you attach a SQL Server database that contains full-text catalog files onto a SQL Server server instance, the catalog files are attached from their previous location along with the other database files.
After detaching a SQL Server database, you can reattach it to the same or another instance of SQL Server. Attaching a database places it in exactly the same state that it was in when it was detached.
Note: We recommend that you do not attach or restore databases from unknown or untrusted sources.
Solution:
To attach a database:
- Connect to an instance of the Microsoft SQL Server Database Engine in SQL Server Management Studio Object Explorer.
- Expand the instance.
- Right-click Databases and click Attach.
The Attach Databases dialog opens.
- Click Add.
The specified database is attached.
- Select the disk drive where the database resides in the Locate Database Files dialog.
- Expand the directory tree to find and select the .mdf file of the database.
- Example:
D:\SQLDataFiles\CASRMCentralDB.mdf
Important! Trying to select a database that is already attached generates an error.
- Enter the name in the Attach as column of the Attach Databases dialog.
A different name is specified for the database.
- Select a different entry in the Owner column.
The owner of the database is changed.
- Click OK.
The database is now reattached.
Note: A newly attached database is not displayed in the Databases node of Object Explorer until the view is refreshed. You can refresh the view at any time.