简体   繁体   English

还原数据库 — 错误 RESTORE HEADERONLY 异常终止。

[英]Restore DB — Error RESTORE HEADERONLY is terminating abnormally.

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.执行 Transact-SQL 语句或批处理时发生异常。 (Microsoft.SqlServer.ConnectionInfo) (Microsoft.SqlServer.ConnectionInfo)

------------------------------ ADDITIONAL INFORMATION: - - - - - - - - - - - - - - - 附加信息:

The media family on device 'C:\go4sharepoint_1384_8481.bak' is incorrectly formed.设备“C:\go4sharepoint_1384_8481.bak”上的媒体系列格式不正确。 SQL Server cannot process this media family. SQL 服务器无法处理此媒体系列。 RESTORE HEADERONLY is terminating abnormally. RESTORE HEADERONLY 异常终止。 (Microsoft SQL Server, Error: 3241) (微软 SQL 服务器,错误:3241)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476如需帮助,请单击: 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 上的不同选项(自动、二进制)将文件从服务器下载到本地电脑的次数

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'.消息 3201,级别 16,State 1,第 1 行无法打开备份设备 '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.).操作系统错误 123(文件名、目录名或卷 label 语法不正确。)。 Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally.消息 3013,级别 16,State 1,第 1 行备份数据库异常终止。

After researching I found the following 2 useful links:经过研究,我发现了以下 2 个有用的链接:

  1. http://support.microsoft.com/kb/290787 http://support.microsoft.com/kb/290787
  2. http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4d5836f6-be65-47a1-ad5d-c81caaf1044f 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.谢谢。

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) 它给了我以下输出Microsoft SQL Server 2005 - 9.00.4053.00(Intel X86)2009年5月26日14:24:20版权所有(c)1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0(Build 6002:Service Pack 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版本。

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. 就像你有SQL Server 2008的备份,并且你试图将数据上传到SQL Server 2005然后你会遇到这种错误。 Please try to upload in a higher version. 请尝试上传更高版本。

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! 希望有人帮助!

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. 所以,我在SQL Server 2008机器上恢复了数据库。 Once this was done - I copied the database over to restore on SQL Server 2012 - and it failed with the following error 完成此操作后 - 我将数据库复制到SQL Server 2012上进行还原 - 但失败并出现以下错误

The media family on device 'C:\\XXXXXXXXXXX.bak' is incorrectly formed. 设备“C:\\ XXXXXXXXXXX.bak”上的媒体系列格式不正确。 SQL Server cannot process this media family. SQL Server无法处理此媒体系列。 RESTORE HEADERONLY is terminating abnormally. RESTORE HEADERONLY异常终止。 (Microsoft SQL Server, Error: 3241) (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。

I had similar error but I was able to resolve it be dropping the credentials and creating it again with a new SAS token我有类似的错误,但我能够通过删除凭据并使用新的 SAS 令牌再次创建它来解决它

DROP CREDENTIAL <credential_name> (generally its created for the server url) DROP CREDENTIAL <credential_name>(通常是为服务器 url 创建的)

CREATE CREDENTIAL <credential_name> WITH IDENTITY = '<credential_name>',创建凭据 <credential_name> WITH IDENTITY = '<credential_name>',
SECRET = '';秘密 = '';

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身份验证”登录时,我能够恢复数据库。

在我的情况下,备份文件被压缩,但文件扩展名没有表明这一点,没有以.zip,.tgz等结尾。一旦我解压缩我的备份文件,我就能导入它。

我的猜测是你试图在较低版本中恢复,这些版本无法正常工作

I think you have 2 separate problems, 1. with restoring and 2. with creating 我认为你有两个不同的问题,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,再次检查本地环境以查看它们是否匹配)。

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. 文件C:\\program files\\...\\Backup \\c:\\Hosting...\\格式不正确。 This is quite obvious if you inspect the file name. 如果检查文件名,这很明显。 Perhaps ommit the extra space in your backup statement? 也许省略备份声明中的额外空间?

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:之间没有空格C:

如果您尝试从 .BACPAC 文件还​​原数据库,请确保在 SSMS 中选择“导入数据层应用程序”而不是还原数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM