recover from mdf files

Posted on 2006-04-14
Last Modified: 2012-05-05
i have SQL cluster server which failed because of hardware.
i couldnt rebuild the master even with rebuild.exe
so i had to delete the sql cluster and create again
i have the only mdf and ldf files of the old server.
is there a way to recover the master and other database from mdf and ldf and post to the new server.

any help will be highly appreciated.


Question by:Stavros26
    LVL 30

    Accepted Solution

    What I have done in the past was copy the databases into the MDF/LDF folders..and voila it worked!

    But I'm not sure about the master....  if this is a fresh install...backup would be prudent before you apply my voodoo fix.
    LVL 75

    Assisted Solution

    by:Aneesh Retnakaran
    Hi Stavros26,

    Do u have the  backup of the master database

    1. Stop MSSQLServer and SQLServerAgent services.
    2. From a command prompt, enter this command

    sqlservr.exe -m

    3. then run the following script
    USE master


         FROM DISK = ''c:\path\backup\master.bak'

    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    Moving the master database
    1. Change the path for the master data and log files in SQL Server Enterprise Manager.

    Note You may also change the location of the error log here.
    2. Right-click the SQL Server in Enterprise Manager and then click Properties.
    3. Click Startup Parameters to see the following entries:-dD:\MSSQL7\data\master.mdf
    -d is the fully qualified path for the master database data file.

    -e is the fully qualified path for the error log file.

    -l is the fully qualified path for the master database log file.
    4. Change these values as follows: a.  Remove the current entries for the Master.mdf and Mastlog.ldf files.
    b.  Add new entries specifying the new location:-dE:\SQLDATA\master.mdf
    5. Stop SQL Server.
    6. Copy the Master.mdf and Mastlog.ldf files to the new location (E:\Sqldata).
    7. Restart SQL Server.
    LVL 28

    Assisted Solution

    do fresh installation of your sql server on the cluster.

    1.stop the sql server services
    2.replace the new mdf and ldf files with the old one you have
    3.start the sql server services

    Expert Comment

    You cannot attach system databases and follow as suggested above to attach user databases. KBA;en-us;224071 fyi.

    LVL 28

    Expert Comment

    hi SatyaSKJ ,
    you can do it provided that all the configuration of the server is same. it have tried it and it worked for me.
     it is similar to restoring backup.
    and if the current installation of sql server is same as what you had before you can simply replace the files and it will work.
    One more thing no need for sp_attach or detach just replace files.

    Expert Comment

    But that is not a recommended way to recovery from a disaster, backup is always a saviour.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
    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.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    779 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

    15 Experts available now in Live!

    Get 1:1 Help Now