Wednesday, March 21, 2012

How can I move/import .MDF file to another machine ?

Our SQL Server machine just crashed, but I can get to the .MDF file (not a
backup file). If I have the .MDF file of a SQL Server database, can I import
this file to another SQL Server and look at it at the new machine ?
Thanks.
If the SQL Server crashed in a weird state, you MIGHT be able to recover the
file.
Copy the MDF and LDF files to the other machine, and try attaching them.
(Look at sp_attach_db in Books Online).
If that fails, you can try just the MDF file, using sp_attach_single_file_db
(also documented in books online).
If that also fails, then you might have just learned the value of backups.
Better late than never. :-)
http://www.aspfaq.com/
(Reverse address to reply.)
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> Our SQL Server machine just crashed, but I can get to the .MDF file (not a
> backup file). If I have the .MDF file of a SQL Server database, can I
import
> this file to another SQL Server and look at it at the new machine ?
> Thanks.
|||Thank you.
I do not have the LDF file, and when I tried sp_attach_single_file_db
I got an error saying something like the MDF file does not have the right
format, or something like that.
I already recommend them to backup next time.
Thank you for your help.
"Aaron [SQL Server MVP]" wrote:

> If the SQL Server crashed in a weird state, you MIGHT be able to recover the
> file.
> Copy the MDF and LDF files to the other machine, and try attaching them.
> (Look at sp_attach_db in Books Online).
> If that fails, you can try just the MDF file, using sp_attach_single_file_db
> (also documented in books online).
> If that also fails, then you might have just learned the value of backups.
> Better late than never. :-)
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
> news:79A8EE21-766E-4172-A5BE-E395C66BCBB5@.microsoft.com...
> import
>
>
|||See if this helps:
http://www.sqlservercentral.com/scri...p?scriptid=599
Restoring a .mdf
This is why Backups are so important.
Andrew J. Kelly SQL MVP
"Paul fpvt2" <Paulfpvt2@.discussions.microsoft.com> wrote in message
news:7E0625EA-A06C-49B4-833A-232C4B11DAC5@.microsoft.com...[vbcol=seagreen]
> Thank you.
> I do not have the LDF file, and when I tried sp_attach_single_file_db
> I got an error saying something like the MDF file does not have the right
> format, or something like that.
> I already recommend them to backup next time.
> Thank you for your help.
> "Aaron [SQL Server MVP]" wrote:

No comments:

Post a Comment