Question Locked

How to Restore SQL Database from MDF file

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Hello, Can anyone tell how to restore SQL server database if in case my MDF file got corrupted?

4 replies

by anniebr

First Put the .mdf and .ldf file in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\ folder

Then go to SQL software, Right-click “Databases” and click the “Attach” option to open the Attach Databases dialog box

Click the “Add” button to open and Locate Database Files From C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\folder

Click the "OK" button. SQL Server Management Studio loads the database from the.MDF file.

If this method failed then you can also try Stellar Repair for MS SQL.
To know more - https://www.stellarinfo.com/sql-recovery.php

by Callcenter171

1. Open SSMS and go to "Object Explorer".

2. Right-click the database you need to restore and select "Attach". Click the "Add" button when "Attach Database" Windows appears.

3. Browse the location of MDF file and select it. Then, click "OK". And SQL Server Management Studio will restore the database from the MDF file.

This discussion is closed to new replies.