Hi, One of my developers had accidentally wiped out the data and when I tried to restore the database, it is complaining of the location of the file etc.
Can we do a complete restore from .MDF and .LDF files? Please let us know.
There is a way around it I have used before - although no-one will support it!
Make sure you have a safe copy of your mdf and ldf.
Create a new database of the same name, using the same mdf and ldf file names.
Shut down SQL Server
Replace the new mdf and ldfs with the files from step 1
Start SQL server
Originally posted by hmscott
Usually, restores are done from .BAK (complete backup) and .TRN (transaction log backup) files. These are the default file extensions for SQL maintenance plans.
Usually, you can't restore from the .MDF and .LDF files. The exception would be if you did an sp_detach_db, backed up the resulting files and then re-attached the files again.
Thank you, we have detached the database and tried sp_attach with .MDF (we did not have .LDF) and we were able to get the database in Read-only mode with the data. We have then exported the data to the original database and that took care of the problem. Thanks for all your help.