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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.