How to restore a database using mdf and ldf files in Sql 2008


Asking for expert opinion. A very unfortunate event happened. One of our PCs crashed few days ago. That PC had SQL Server 2008 installed. Unfortunately no backup was running on that server. We sent the disk to a data recovery place and looks like they can recover  some of the mdf and ldf files. We are particularly interested in 1 particular database. My questions are:

 1. Is this possible to restore a particular  database using corresponding mdf and ldf files?
 2. Do we need to have any mdfs from the  system databases? Any other files we need to ask data recovery company t look for?
3. Steps and/or or best practices to restore that database into a new machine.

Thanks for your help in advance.
Who is Participating?
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.

Aneesh RetnakaranDatabase AdministratorCommented:
You can attach the database files to another instance if you have the mdf' and ldfs ( even with mdf you will be able to attach )
System database master contains the  user info, and msdb contains the jobs and other info;  if you couldn't recover these files, you need to add them manually

ssms -> rightclick database -> attach  ; choose the files and attach

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:
you may have to run a  'DBCC CHECKDB()' statement against the newly attached database
Brian CroweDatabase AdministratorCommented:
You can copy the .mdf and .ldf files to a different server and just Attach them.

You will lose any server-wide logins created at the instance level but you will retain your database users.
Scott PletcherSenior DBACommented:
1.  Yes.  If there are multiple mdf's, it's easiest to restore them all, but you should eventually be able to do partial restores as well.  If a db has only .ldf file, which is normal, then you can restore the db even if you don't have the .ldf file (assuming the .mdf(s) are undamaged).

2.  If you can recover the master db, that will make full recovery easier, but it's not absolutely required to restore the user dbs.

3.  Use a "CREATE DATABASE ... FOR ATTACH" statement for each db (attach is technically obsolete, you should use create for attach).
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.

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.