Sql-server – How to restore a database using mdf and ldf files in SQL Server 2008

sql-server-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 to look for?
  3. Steps and/or or best practices to restore that database into a new machine.

Thanks for your help in advance.

Best Answer

1) 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

OR

You may have to run a 'DBCC CHECKDB()' statement against the newly attached database

2) You can copy the .mdf and .ldf files to a different server and just Attach them. https://msdn.microsoft.com/en-us/library/ms190209.aspx

You will lose any server-wide logins created at the instance level but you will retain your database users.