How to restore MSSQL DB with .MDF and .LDF files?


I just have 2 files a.MDF and a.LDF.
How to restore MSSQL DB with a.MDF and a.LDF files?
If I create a new DB named 'a' , it shows DB already exist and cannot create a new one.

Who is Participating?
If you have .mdf and .ldf files:
1. Copy those files to apropriate location for example Data catalog under MS SQL instance folders
2. run management stuido
3. right click databases
4. atach databe
5. show location of mdf file
6. click OK

If you have database with the same name remove it first.

Now you have your database running
You might have problem with security (database users) but you database is working.

Best Regards
The above will work assuming you dont already have files in there with the same name. If this is the case; rename them but keep the extensions and they try the above steps again.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.