Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Restoring SQL Server databases from .mdf files

Author  Topic 

Cedtech23
Starting Member

4 Posts

Posted - 2006-02-14 : 00:05:44
I recently was given control of an SQL server that stop working.
We had no past backups of the database and the only file we had was the .mdf
I decided to install a fresh version of SQL 2000 on another server and created a database using enterprise manager with the same name as my database called SWATraining

I then stop the sql server

the first thing that I notice is that the .mdf that enterprise manager created had _DATA at the end of the name. Thus I renamed the the orginal .mdf SWATraining_Data and

copied it to the
C:\program files\microsoft sql server\mssql\data
when I started SQL the database was greyed out and had (suspect)labeled

How can I recover the database when the only file I have is the .mdf file??


I even tried

sp_attach_single_file_db @dbname = 'SWATraining',
@physname = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\SWATraining.mdf'

but reason this error

Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\SWATraining.mdf' is not a valid database file header. The FILE SIZE property is incorrect.

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-02-14 : 00:46:56
You are almost certainly SOL. The only thing you can do is called microsoft PSS for help. Whatever you do, do not do anything to the original copy of the .MDF file.

btw, this is why backups are important.



-ec



Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-02-14 : 00:47:40
try the original file instead and see if it works for you

--------------------
keeping it simple...
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-02-14 : 03:25:45
quote:
Originally posted by jen

try the original file instead and see if it works for you

--------------------
keeping it simple...




YOU MUST NOT TOUCH THE ORIGINAL FILE. Make another copy of it, but whatever you do, do not try to open that original file.

Your only shot at recovering anything is having microsoft PSS take a look at that file. I would be opening up a Sev 1 ticket right now if I were you.


-ec
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-02-14 : 03:30:44
what i meant is to copy the original file as is without renaming it,
coz he renamed the file, which may be causing the header error

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -