recover from mdf files

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.


Who is Participating?
Irwin SantosComputer Integration SpecialistCommented:
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.
Aneesh RetnakaranDatabase AdministratorCommented:
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'

Aneesh RetnakaranDatabase AdministratorCommented:
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.
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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
You cannot attach system databases and follow as suggested above to attach user databases. KBA;en-us;224071 fyi.

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.
But that is not a recommended way to recovery from a disaster, backup is always a saviour.
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.