简体   繁体   English

将 bak 文件还原到 Azure SQL PAAS 数据库?

[英]Restore to Azure SQL PAAS database a bak file?

Okay so I figured since Azure has a lot of tools and I am failing at best processes to just ask on SO.好的,所以我想,因为 Azure 有很多工具,而且我在最好的过程中失败了,只能问 SO。

What I can do:我可以做什么:

BACPAC creation BACPAC创建

Creation is directly from SSMS with hovering over the database in Object Explorer.创建直接来自 SSMS,并将鼠标悬停在对象资源管理器中的数据库上。 Right Click>Tasks>Export Data Tier Application.右键单击>任务>导出数据层应用程序。 Choose a disk location.选择磁盘位置。 The caveat is generally to not have a database that is in use querying.警告通常是没有正在使用查询的数据库。 So have a copy or system that can be not using the database.所以有一个可以不使用数据库的副本或系统。

BACPAC restore to Azure BACPAC 还原到 Azure

  1. SqlPackage.exe https://docs.microsoft.com/en-us/sql/tools/sqlpackage?view=sql-server-2017 SqlPackage.exe https://docs.microsoft.com/en-us/sql/tools/sqlpackage?view=sql-server-2017

    When I do it it is similar to: (must have Visual Studio or equivalent Sql management object DLLs installed) "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\Microsoft\\SQLDB\\DAC\\130\\SqlPackage.exe" /a:Import /sf:(bacpac Location) /tdn:(dbName)/tsn:bvtest.database.windows.net /tu:(user) /tp:(password)当我这样做时,它类似于:(必须安装 Visual Studio 或等效的 Sql 管理对象 DLL)“C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\Microsoft\\SQLDB\\ DAC\\130\\SqlPackage.exe" /a:Import /sf:(bacpac Location) /tdn:(dbName)/tsn:bvtest.database.windows.net /tu:(user) /tp:(password)

  2. In Azure>SQL Servers>(Top ribbon)>Import database>(have blob storage with a bacpac created to it already).在 Azure>SQL Servers>(顶部功能区)>导入数据库>(已经为它创建了带有 bacpac 的 blob 存储)。 This method appears slightly faster if they are both on same region.如果它们都在同一区域,则此方法看起来会稍快一些。

My question is that I have seen articles like this one: https://docs.microsoft.com/en-us/sql/azure-data-studio/tutorial-backup-restore-sql-server?view=sql-server-2017 as well as knowing SSMS pretty well.我的问题是我看过这样的文章: https : //docs.microsoft.com/en-us/sql/azure-data-studio/tutorial-backup-restore-sql-server?view=sql-server- 2017以及非常了解 SSMS。 It seems all options to restore to Azure SQL PAAS are turned off for a 'bak' backup and you have to make a bacpac for going instance to Azure PAAS.似乎所有还原到 Azure SQL PAAS 的选项都已关闭以进行“bak”备份,您必须制作 bacpac 才能将实例转到 Azure PAAS。 The problem is that this takes hours just to make the bacpac on a relatively medium sized database of 120 gigs.问题是,仅仅在 120 个演出的相对中等规模的数据库上制作 bacpac 就需要几个小时。 Then it takes hours to restore.然后需要几个小时才能恢复。 Other than what I have tried above is there a faster way?除了我上面尝试过的方法之外,还有更快的方法吗?

You can use Azure Data Migration Service (ADMS) instead of importing/exporting bacpacs.可以使用Azure 数据迁移服务(ADMS) 而不是导入/导出 bacpac。 Azure Data Migration Service allows you to migrate data from SQL Server to Azure SQL Database with no downtime if your database does not have "heaps".如果您的数据库没有“堆”,则 Azure 数据迁移服务允许您将数据从 SQL Server 迁移到 Azure SQL 数据库,而无需停机。 If your database has heaps you will have to perform an offline migration.如果您的数据库有堆,则必须执行离线迁移。 Copying/migrating data from a SQL Server ARM (IaaS) Premium Storage (200 GB / 790 tables) to an Azure SQL Database (Premium) takes 1 hour 40 minutes with an offline migration.将数据从 SQL Server ARM (IaaS) 高级存储(200 GB / 790 个表)复制/迁移到 Azure SQL 数据库(高级)需要 1 小时 40 分钟进行离线迁移。 That is the fastest data migration I have seen as a workaround to import/export bacpacs since SQL Server native backups are not supported on Azure SQL Database (DTU-model / Vcore model).由于 Azure SQL 数据库(DTU 模型/Vcore 模型)不支持 SQL Server 本机备份,因此这是我认为导入/导出 bacpac 的一种解决方法的最快数据迁移。

ADMS performs a validation of your data at the end, if you want.如果需要,ADMS 会在最后对您的数据进行验证。

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

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