0

I have got two files, test.mdf and test.ldf, with sizes around 200 Mb and 200 MB.

I restore the database using "Attach Databases" options, all is ok, but I found that there are a lot of missing rows in some tables.

What can I do?

I have all files from previous windows installation, I read that mdf has got uncommited changes, where are those changes in the files?

1 Answers1

1

Any rows you'd be missing would have been inserted into the original instance of the database after you copied the MDF / LDF files (or after whichever copy of the MDF / LDF files you've located since you're saying you're missing over months of data and this happened after a crash). So it depends on when that version of the MDF / LDF was last modified / copied.

If you have Full Backups and Transaction Log Backups setup on the original database, you can use a backup restore to get as close as the frequency that you Transaction Log Backups run (e.g. 5 minutes granularity if that's what you schedule them for). And then if for some reason you don't restore it right away and the next Transaction Log Backup(s) run, you can always add the new Transaction Log Backups to your list of backups to restore to keep you current.

Or you can even restore all the backups you have with the NORECOVERY option (which will leave it in the recovering state) if you don't plan to bring it online right away but do want to keep it current to the original database. Then as more Transaction Log Backups are created on the original database, you can use those backup files to roll forward the copy of the database until it's at a point for which you want to bring it online. Once brought online, no more Transaction Log Backups can be applied without doing another full restore from all the previous backups to the nearest Full Backup.

J.D.
  • 40,776
  • 12
  • 62
  • 141