To recover data from MDF files only, when the NDF files are lost/missing.
You can use SQL Database Recovery Tool Repairs
I had a database file (Diamond.mdf) which was corrupted and I was not able to attach into SQL Server DB and which contains most of the business data. I was no idea about the error and unable to recover the corrupted DB. I did so many manual mechanism to overcome this issue but unable to do.
- Select MDF file: Open Select Database dialog box by choosing Select
Database icon from File Menu. In Select Database dialog box, click
Browse.
- Open dialog box will appear. Browse and select the desired file and
then click Open and Select 'Include Deleted Records' check box to
recover deleted records (if found) during the repairing process.
- Open Select Database dialog box by choosing Select Database icon from
File Ribbon. From Search section, select the drive you want to search
for MDF files. Click OK.
- After the search is finished, a list of MS SQL Database files found
in the selected drive is shown. Select file you wish to repair from
this list and click Repair button to start the repairing process.
- After the search is finished, a list of MS SQL Database files found
in the selected drive is shown. Select file you wish to repair from
this list and click Repair button to start the repairing process.
- This will repair your corrupted mdf file and load the database object
on left side pane. In that, we can view all the tables, stored
procedure and all objects.
- After you complete the repairing process successfully, Stellar Repair
for MS SQL shows preview of corrupted database files. The left pane
displays list of items (Tables, Views, Synonyms, Defaults, Data Types
and more) in a tree like structure, upper right pane displays the
contents of the item selected in the tree view and bottom pane shows
message log. A sample screen is displayed below
- After the repairing process gets completed, click Save option from
File ribbon. Specify whether you want to save the repaired database
in MDF, CSV, HTML or XLS format by selecting the appropriate radio
button. Saving repaired database as MDF Saving repaired database as
CSV, HTML or XLS If you want to save your repaired database as an
MDF, you can either save your database as a New database or you can
insert the data to an existing Live database.
- To save the repaired database as a completely New database, follow
the steps mentioned below: Select New Database radio button. Enter
Server / Instance Name. Choose the Authentication method from the
drop down list for logging in to the server.
- If the authentication method selected is Windows Authentication, you
need not enter any user name and password. Enter the server user name
and password, if the selected authentication method is SQL Server
Authentication.
- Select a destination for saving the repaired MDF file. Click Save
button to save the repaired MS SQL Database file. A message is
displayed after the process is completed successfully.
- The repair was completely done and I was able to open the database
from SQL Server Db as below.
Note: This is not free tool.