Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching a MDF

Status
Not open for further replies.

ServerHead

Programmer
Jul 5, 2002
7
IN
The MDF file that I am trying to attach is from a different server and also the database was probably not detached before making a file copy. The sp_attach_db and sp_attach_db_single_file are both terminating with error "The header for file 'D:\Data\MyDB_Data.MDF' is not a valid database file header. The PageAudit property is incorrect."
The database was working as such on the original server.
I am trying the attach as sa and don't know if the replication was on.
If anyone can tell me the solution or even point me to it, it will be great.
 
If the database was not detached, it is likely corrupted and you won't be able to use the MDF file you have. You can detach the database and copy it again or BACKUP the database on the first server and restore it on the second.
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Thanks for quick response.
Is there anyway a corrupt mdf file can be recoverd? Any method or utility that you know of?
The problem is that original server is out of action, therefore, taking a backup or even detach is totally out of question.
 
I've not used any recovery utility or service. Unless someone else provides an answer, you should do a web search for "sql server database recovery" or similar words. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Hello

If you still have the original contents of the Data directory of the first server, you can copy whole directoy in the new server (backing up the original first). When you'll start the server, it won't notice someone stolen his databases and put another ones back.

I did that once and I was able to detach the database and reattach it after that. Grigore Dolghin
Class Software
Bucharest, Romania
 
The best way to do a recovery would be to use the latest backup files.

Under SQL 2000 there is a restore command that use restore with MOVE option. This command does not require to have a previous database created. It will recreate the database for you with the same information you use to have.

I use that command on a regular basis to test my backup.

Depending how big the backup file is it can be a fast recovery. Once done you will need to recreate the users that usually log on that database in SQL server, but only if you are using SQL authentication.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top