Before attaching the database
1 . Copy (two file e.g. the ‘database.MDF‘ file which contains the primary data, and the ‘database.LDF‘ file which logs) and
2. Paste "C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA" -according to your Microsoft SQL Server folder.
Now we are ready to attach them.
3. Open SQL Server Management Studio....Click on connect button and then expand that instance.
5. Click ADD button ..
6. Select your database for attach ...and click Ok button
7. and click Ok button
Database is now attached to the SQL instance. ......