
Below exercise was done with MSSQL Server 2008 R2.
1. Login with the administrator group user. Launch the MSSQL Server Management Studio. Expand the database tree. Right click on the database instance. Go to Tasks > Detach.

2. Verify the database name to detach and click OK to proceed.

3. Move all the data and log files.
4. Now, attach the database instance. Right click on Databases. Select Attach.

5. Click on Add and locate the .mdf file. The other data and log files will automatically added into database files. You may need to adjust the correct location of these data and log files. Once done, click OK to start the database creation. This is the most important part, so, ensure the data and log files are in good state which to avoid any corrupted data. Once completed, you will see the database instance name from the Databases tree.




