Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm attempting to restore a SQL Server 2012 .BAK file to my local server. I've successfully restored this .BAK file before. However now, when I try, I get the following error:

RESTORE detected an error on page (0:0) in database 'databasename' as read from the backup set.

Running the following command works:

RESTORE HEADERONLY FROM DISK = 'D:\database.bak'

However, running the following:

RESTORE VERIFYONLY FROM DISK = 'D:\database.bak'

Returns the following error:

Msg 3203, Level 16, State 1, Line 1
Read on "D:\database.bak" failed: 13(The data is invalid.)
Msg 3013, Level 16, State 1, Line 1
VERIFY DATABASE is terminating abnormally.

I downloaded the .BAK file from an FTP server again this morning and got the same error. I asked someone else with access to the same backup file and they can restore it with no issues at all. Any ideas?

share|improve this question

1 Answer 1

Check that you are downloading with binary transfer mode using FTP. Most clients will try to autodetect, then fall back to binary. .bak may not be recognized as binary, and may therefore have all \n's translated to \r\n, corrupting the data.

If that is not the case, make sure the server version you are attempting to restore with is newer or equal to the server version the original backup was taken with. See SELECT @@VERSION for an easy to compare check.

Beyond that, assuming the original backup works fine elsewhere, do a binary checksum of both files... perhaps some disk error or other transfer is causing corruption. You can use ficv.exe -add c:\database.bak or a similar utility to calculate the checksum.

It is also possible to take a good backup of a corrupt database. The original database could be corrupt - I don't know why it would have restored successfully elsewhere, but it could happen. You can verify the original database by running DBCC CHECKDB('DatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS on the server the backup was taken on.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.