Latest

How to restore .MDF and .LDF Files in SQL Server

Itroduction:
In this article we will explore , How to restore .mdf and .ldf files in SQL server.


Recently i had an situation that my application database table records are deleted unexpectedly. Now  we need do restore the database from the backup files.

(usually we do back process for the database which will generate .mdf files and .ldf files.)

So now i have both the .mdf and .ldf files to restore /attach database.

STEP 1:

You can copy and paste both the files in to the appropriate folder that other sql db's are located. 

"C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA"

NOTE: This location will differ based on your SQL server installation.

Step 2:
Right click on database and Select Attach Database.



Step 3:
Click Add and choose the .mdf files from the pasted location and click ok .




Step 4:
Add the .mdf files and click ok .




Step 5:
Now the Database restored successfully as below.






Hope this article helps !!



Thanks for reading this article ! ! please leave your comments and suggestion about this article.

No comments