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

Posted on 2008-11-18
Last Modified: 2012-05-05

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.

Question by:techques
    LVL 11

    Accepted Solution

    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
    LVL 13

    Expert Comment

    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.


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now