SQL 恢复数据库 — 错误 RESTORE HEADERONLY 异常终止。

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3037682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 06:33:12  来源:igfitidea点击:

Restore DB — Error RESTORE HEADERONLY is terminating abnormally.

sqlsql-serverrestore

提问by Jordon Willis

I have taken backup of SQL Server 2008 DB on server, and download them to local environment.

我已经在服务器上备份了 SQL Server 2008 DB,并将它们下载到本地环境。

I am trying to restore that database and it is keep on giving me following error.

我正在尝试恢复该数据库,但它一直给我以下错误。


An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------ ADDITIONAL INFORMATION:

The media family on device 'C:\go4sharepoint_1384_8481.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476


执行 Transact-SQL 语句或批处理时发生异常。(Microsoft.SqlServer.ConnectionInfo)

- - - - - - - - - - - - - - - 附加信息:

设备“C:\go4sharepoint_1384_8481.bak”上的媒体系列格式不正确。SQL Server 无法处理此媒体系列。RESTORE HEADERONLY 异常终止。(Microsoft SQL Server,错误:3241)

如需帮助,请单击:http: //go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476

I have tried to create a temp DB on server and tried to restore the same backup file and that works. I have also tried no. of times downloading file from server to local pc using different options on Filezila (Auto, Binary)

我试图在服务器上创建一个临时数据库,并尝试恢复相同的备份文件并且有效。我也试过没有。使用 Filezila 上的不同选项(自动、二进制)将文件从服务器下载到本地 PC 的次数

But its not working. After that I tried to execute following command on server.

但它不起作用。之后我尝试在服务器上执行以下命令。

BACKUP DATABASE go4sharepoint_1384_8481 
TO DISK=' C:\HostingSpaces\dbname_jun14_2010_new.bak' with FORMAT

It is giving me following error:

它给了我以下错误:

Msg 3201, Level 16, State 1, Line 1 Cannot open backup device 'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup\ C:\HostingSpaces\dbname_jun14_2010_new.bak'. Operating system error 123(The filename, directory name, or volume label syntax is incorrect.). Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally.

消息 3201,级别 16,状态 1,第 1 行无法打开备份设备“c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup\C:\HostingSpaces\dbname_jun14_2010_new.bak”。操作系统错误 123(文件名、目录名或卷标语法不正确。)。消息 3013,级别 16,状态 1,第 1 行 BACKUP DATABASE 异常终止。

After researching I found the following 2 useful links:

经过研究,我发现了以下 2 个有用的链接:

  1. http://support.microsoft.com/kb/290787
  2. http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4d5836f6-be65-47a1-ad5d-c81caaf1044f
  1. http://support.microsoft.com/kb/290787
  2. http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4d5836f6-be65-47a1-ad5d-c81caaf1044f

But I am still not able to restore Database correctly.

但是我仍然无法正确恢复数据库。

Any help would be much appreciated. Thanks.

任何帮助将非常感激。谢谢。

采纳答案by Jordon Willis

You can check out this blog post. It had solved my problem.

你可以看看这篇博文。它已经解决了我的问题。

http://dotnetguts.blogspot.com/2010/06/restore-failed-for-server-restore.html

http://dotnetguts.blogspot.com/2010/06/restore-failed-for-server-restore.html

Select @@Version
It had given me following output Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6002: Service Pack 2)

选择@@Version
它给了我以下输出 Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 版权所有 (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6002: Service包 2)

You will need to re-install to a new named instance to ensure that you are using the new SQL Server version.

您将需要重新安装到新的命名实例以确保您使用的是新的 SQL Server 版本。

回答by Deepak

This type of error will come when you try to upload backup data from a higher version to lower version. Like you have backup of SQL server 2008 and you trying to upload data into SQL server 2005 then you will get this kind of error. Please try to upload in a higher version.

当您尝试将备份数据从较高版本上传到较低版本时,会出现此类错误。就像您备份了 SQL Server 2008 并且您尝试将数据上传到 SQL Server 2005 一样,您将收到此类错误。请尝试上传更高版本。

回答by user2566365

I ran into this issue and my problem was a bit more involved... Originally I was trying to restore a SQL Server 2000 backup to SQL Server 2012. Of course this didn't work cause SQL server 2012 only supports backups from 2005 and upwards .

我遇到了这个问题,我的问题有点复杂......最初我试图将 SQL Server 2000 备份还原到 SQL Server 2012。当然这不起作用,因为 SQL Server 2012 仅支持 2005 年及以上的备份.

So, I restored the database on a SQL Server 2008 machine. Once this was done - I copied the database over to restore on SQL Server 2012 - and it failed with the following error

因此,我在 SQL Server 2008 机器上恢复了数据库。完成此操作后 - 我将数据库复制到 SQL Server 2012 上进行还原 - 但它失败并出现以下错误

The media family on device 'C:\XXXXXXXXXXX.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)

设备“C:\XXXXXXXXXXX.bak”上的媒体系列格式不正确。SQL Server 无法处理此媒体系列。RESTORE HEADERONLY 异常终止。(Microsoft SQL Server,错误:3241)

After a lot of research I found that I had skipped a step - I had to go back to the SQL Server 2008 machine and Right Click On the database(that I wanted to backup)> Properties > Options > Make sure compatibility level is set to SQL Server 2008. > Save

经过大量研究,我发现我跳过了一个步骤 - 我必须回到 SQL Server 2008 机器并右键单击数据库(我想备份)> 属性 > 选项 > 确保兼容性级别设置为SQL Server 2008。> 保存

And then re-create the backup - After this I was able to restore to SQL Server 2012.

然后重新创建备份 - 在此之后我能够恢复到 SQL Server 2012。

回答by MonsCamus

This error can be caused by the permissions to the file, which you should check, however recently I noticed that the same is thrown if the file has been transferred and windows has marked the file as 'Encrypt Contents to Secure Data'.

此错误可能是由文件权限引起的,您应该检查该权限,但是最近我注意到,如果文件已传输并且 Windows 已将该文件标记为“加密内容以保护数据”,则会引发相同的错误。

You can find this by bringing up the .bak file properties and clicking the advanced button, it appears as the last check box on the dialog.

您可以通过调出 .bak 文件属性并单击高级按钮来找到它,它显示为对话框中的最后一个复选框。

Hope that helps someone!

希望对某人有所帮助!

回答by okkko

I had a similar problem but I was trying to restore from lower to higher version (correct). The problem was however in insufficient rights. When I logged in with "Windows Authentication" I was able to restore the database.

我有一个类似的问题,但我试图从较低版本恢复到较高版本(正确)。然而,问题在于权利不足。当我使用“Windows 身份验证”登录时,我能够恢复数据库。

回答by thebiggestlebowski

In my case, the backup file was compressed, but the file extension didn't indicate this, didn't end in .zip, .tgz, etc. Once I decompressed my backup file I was able to import it.

在我的例子中,备份文件被压缩,但文件扩展名没有表明这一点,没有以 .zip、.tgz 等结尾。一旦我解压缩了我的备份文件,我就可以导入它。

回答by Madhivanan

My guess is that you are trying to restore in lower versions which wont work

我的猜测是您正在尝试以无法正常工作的较低版本进行恢复

回答by potatopeelings

I think you have 2 separate problems, 1. with restoring and 2. with creating

我认为您有 2 个单独的问题,1. 恢复和 2. 创建

For 1. you could try checking to see if the file was transferred properly (one easy way would be to check the md5 of the file on the server and again on the local environment to see if they match).

对于 1. 您可以尝试检查文件是否正确传输(一种简单的方法是检查服务器上文件的 md5,然后再次在本地环境中检查它们是否匹配)。

回答by Remus Rusanu

Cannot open backup device 'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup\ C:\HostingSpaces\dbname_jun14_2010_new.bak'

The error is quite self-explanatory. The file C:\program files\...\Backup \c:\Hosting...\is incorrectly formatted. This is quite obvious if you inspect the file name. Perhaps ommit the extra space in your backup statement?

该错误是不言自明的。文件C:\program files\...\Backup \c:\Hosting...\格式不正确。如果您检查文件名,这很明显。也许省略备份语句中的额外空间?

BACKUP DATABASE go4sharepoint_1384_8481 
TO DISK='C:\HostingSpaces\dbname_jun14_2010_new.bak' with FORMAT

Note there is no space between 'and C:

注意之间没有空格'C: