sql-server - 由于扇区大小不同错误,从 Azure Blob 存储恢复数据库失败

标签 sql-server azure amazon-web-services amazon-s3

我正在尝试将 SQL Server 数据库从 AWS SQL Server 导入到 Azure SQL Server。 以下是我在导入过程中执行的步骤:

  1. 将数据库从 AWS SQL Server 备份到 AWS S3 存储桶。
  2. 将 .bacpac 文件从 S3 存储桶复制到本地文件路径。
  3. 将 .bacpac 文件从本地文件路径上传到 Azure Blob 存储。

上传过程结束后,当我将 .bacpac 文件从 Azure Blob 存储恢复到 Azure SQL Server 时,出现以下异常。

*无法使用备份文件'https://sqlmigrateassistant.blob.core.windows.net/sql2005backup/demodatabase.bacpac ' 因为它最初的格式化扇区大小为 512,现在位于扇区大小为 65536 的设备上。 RESTORE FILELIST 异常终止 *

在上面的步骤 2 之后,我还尝试将 .bacpac 文件从本地文件路径手动从 SQL Server Management studio(SSMS) 导入到 Azure SQL Server。当时我收到以下异常。

*文件包含损坏的数据。 (Microsoft.Data.Tools.Schema.Sql) *

任何人都可以提供有关如何将数据库还原到 Azure SQL Server 的任何信息吗?

非常感谢任何信息。

最佳答案

您必须使用 URL 恢复数据库并指定 block 大小 512..

RESTORE DATABASE [AdventureWorks2012] FROM  URL = N'your bacpac path'
WITH  CREDENTIAL = N'My_Credential'
, FILE = 1,  NOUNLOAD,  STATS = 5,BLOCKSIZE= 512;

失败原因已解释如下:Database restore failure when restoring from URL并且上下文也适用于您的场景

When backing up to URL, SQL Server uses the 64K block size by default because the sector size presented by Azure blob storage is 64K. Therefore, regular scheduled backups to URL created by Managed Backup have the same block size as the media sector size, and this issue does not occur. But when a backup created on a local disk with 4K sector size is copied to the storage account, and then an attempt is made to restore from it, SQL Server blocks it with the above error message

关于sql-server - 由于扇区大小不同错误,从 Azure Blob 存储恢复数据库失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42902827/

相关文章:

sql - 计算每日变化和新销售人员

组织之间/跨组织的 Azure DevOps 管道使用情况

amazon-web-services - 无论用户访问的内容类型如何,将 CloudFront 定位在 ALB 前面是否更好?

amazon-web-services - Amazon CloudFront + Adob​​e FMS Stack 最大并发用户数

SQL 查询计算每月工作天数

sql-server - 无法更新包含特殊字符的 varchar 列

azure - 请求下层服务失败

java - 无法使用适用于 Java 的 Azure 管理库在订阅中列出 azure 应用程序服务(Spring Boot 应用程序)

amazon-web-services - Cloudformation 应在不同的可用区域中创建 documentdb 副本

sql - 将位值 (1) 替换为日期名称 SQL