将 SQL 服务器备份恢复到 Azure SQL 数据库
Restoring SQL Server backup to Azure SQL Database
有没有办法简单地获取 SQL 备份 .bak 文件,并将其用作还原点以在 Azure SQL 数据库上生成新数据库?
在这种情况下,我看到的通常推荐的向导想要创建一个要使用的自定义文件,但它会吐出加密对象(函数和视图),我看不到另一种方法来实现它。
Azure SQL 数据库目前不支持该功能。在 Azure SQL 数据库中还原的唯一方法是从 BACPAC 文件导入 - 您可以按照本指南使用 BACPAC 文件迁移到 Azure SQL 数据库:https://azure.microsoft.com/en-us/documentation/articles/sql-database-cloud-migrate/
其他选项是使用 SQL Server in a VM,这将启用 .bak 文件的恢复
如果您在本地计算机上已有数据库,则可以使用 SQL Management Studio 将其直接迁移到 Azure。请按照以下步骤操作:
右键单击SSMS中的数据库名称:
按照随后出现的向导进行操作。
如果您是 运行 SSMS v17,则可以配置 Azure SQL 数据库版本、大小和服务 objective。
目前 Azure 不支持使用备份 (.bak) 文件在 Azure SQL 实例上恢复数据库。但是还有许多其他方法可以将 SQL 数据库迁移到 Azure SQL。例如,使用 SQL Server Management Studio 部署提及或在 .bacpac 文件中进行备份,然后使用 SSMS Export/Import 或使用 Microsoft 数据库迁移辅助工具将其导入。下面 link 将对您有所帮助,因为他们将这些方法逐步解释为过程。
How to migrate SQL Database to Azure SQL Database using SSMS Export/Import
How to migrate SQL Database to Azure SQL Database using SSMS deploy
Migrating SQL Database To Azure SQL Instance using Microsoft Database Migration Assistant (DMA) Tool
为了在 Azure SQL 服务器上获取我的 .BAK 文件,我遵循了该线程中两个答案的建议。
在完成以下步骤之前,我的笔记本电脑 SQL 实例上的 BAK 文件恢复失败(备份来自 SQL2016,与我的 SQL2014 不兼容)。我正在从 EDX.org: “DAT216x Delivering a Relational Data Warehouse” 进行培训,我从培训中下载了这两个文件:AdventureWorks2016CTP3.bak
和 AdventureWorksDW2016CTP3.bak
.
BAK 到 AzureDB
- USER: Joseph Idziorek | ANSWER: Use SQL Server in a VM, which would enable a restore of a .bak file
I followed these 2 videos (hosted on YouTube) to create the Azure VM
and SQL Instance
to be used in MCA training… Demo: Provisioning Microsoft Azure Services (VM, SQL). The 9:00-minute video shows you how to provision the relevant Azure resources. The video also demonstrates how to get the connection string for the Azure SQL Database, which is used in the next step.
From the Azure VM remote session connection to SSMS I did the Restore Database from BAK.
- USER: razon | ANSWER: Right click (database name) > Tasks > Deploy Database to SQL Azure…
From the Azure VM remote sessions connection to SSMS SQL Instance, I ran the wizard “Deploy Database to SQL Azure”. After connection successfully the deployment took a few minutes to complete. NOTE: you must use ‘SQL Server Authentication’ because ‘Windows’ is not supported for Azure database. The Azure SQL Server authentication was demonstrated in the video link provided earlier in this answer.
部署环境
@@服务器名@@版本
+------------------------------------------------------------------------------------------------------+
| Source |
+------------------------------------------------------------------------------------------------------+
| data216x |
| |
| Microsoft SQL Server 2016 (SP1-CU13) (KB4475775) - 13.0.4550.1 (X64) |
| Jan 10 2019 19:31:11 |
| Copyright (c) Microsoft Corporation |
| Developer Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor) |
+------------------------------------------------------------------------------------------------------+
| Target |
+------------------------------------------------------------------------------------------------------+
| sqlserver-dat216x |
| |
| |
| Microsoft SQL Azure (RTM) - 12.0.2000.8 |
| Dec 19 2018 08:43:17 |
| Copyright (C) 2018 Microsoft Corporation |
+------------------------------------------------------------------------------------------------------+
结果
将数据库部署到 Azure 在我的方案中的步骤 Importing database
中失败并显示此消息。删除不兼容的对象后,Azure 数据库部署成功。
正在导入数据库...
TITLE: Microsoft SQL Server Management Studio
Could not import package.
Warning SQL0: A project which specifies SQL Server 2016 as the target
platform may experience compatibility issues with Microsoft Azure SQL
Database v12.
Error SQL72014: .Net SqlClient Data Provider: Msg 40536, Level 16,
State 2, Line 1
'MEMORY_OPTIMIZED tables' is not supported in this service tier of the
database. See Books Online for more details on feature support in
different service tiers of Windows Azure SQL Database.
Error SQL72045: Script execution error. The executed script:
CREATE TYPE [Sales].[SalesOrderDetailType_inmem] AS TABLE (
[OrderQty] SMALLINT NOT NULL,
[ProductID] INT NOT NULL,
[SpecialOfferID] INT NOT NULL,
INDEX [IX_SpecialOfferID] NONCLUSTERED HASH ([SpecialOfferID]) WITH (BUCKET_COUNT = 8),
INDEX [IX_ProductID] NONCLUSTERED HASH ([ProductID]) WITH (BUCKET_COUNT = 8))
WITH (MEMORY_OPTIMIZED = ON);
(Microsoft.SqlServer.Dac)
BUTTONS:
OK
截图:
删除不兼容的对象后,Azure 数据库部署成功。 (注意:我不得不这样做几次。我尝试了 Redgate SQL 搜索 MEMORY_OPTIMIZED
但它一直说 "no search results" 即使 table 定义确实包含关键字。)
试试“数据迁移助手”;
https://docs.microsoft.com/en-us/sql/dma/dma-migrateonpremsqltosqldb?view=sql-server-ver15
DMA 下载:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=53595
有没有办法简单地获取 SQL 备份 .bak 文件,并将其用作还原点以在 Azure SQL 数据库上生成新数据库?
在这种情况下,我看到的通常推荐的向导想要创建一个要使用的自定义文件,但它会吐出加密对象(函数和视图),我看不到另一种方法来实现它。
Azure SQL 数据库目前不支持该功能。在 Azure SQL 数据库中还原的唯一方法是从 BACPAC 文件导入 - 您可以按照本指南使用 BACPAC 文件迁移到 Azure SQL 数据库:https://azure.microsoft.com/en-us/documentation/articles/sql-database-cloud-migrate/
其他选项是使用 SQL Server in a VM,这将启用 .bak 文件的恢复
如果您在本地计算机上已有数据库,则可以使用 SQL Management Studio 将其直接迁移到 Azure。请按照以下步骤操作:
右键单击SSMS中的数据库名称:
按照随后出现的向导进行操作。
如果您是 运行 SSMS v17,则可以配置 Azure SQL 数据库版本、大小和服务 objective。
目前 Azure 不支持使用备份 (.bak) 文件在 Azure SQL 实例上恢复数据库。但是还有许多其他方法可以将 SQL 数据库迁移到 Azure SQL。例如,使用 SQL Server Management Studio 部署提及或在 .bacpac 文件中进行备份,然后使用 SSMS Export/Import 或使用 Microsoft 数据库迁移辅助工具将其导入。下面 link 将对您有所帮助,因为他们将这些方法逐步解释为过程。
How to migrate SQL Database to Azure SQL Database using SSMS Export/Import
How to migrate SQL Database to Azure SQL Database using SSMS deploy
Migrating SQL Database To Azure SQL Instance using Microsoft Database Migration Assistant (DMA) Tool
为了在 Azure SQL 服务器上获取我的 .BAK 文件,我遵循了该线程中两个答案的建议。
在完成以下步骤之前,我的笔记本电脑 SQL 实例上的 BAK 文件恢复失败(备份来自 SQL2016,与我的 SQL2014 不兼容)。我正在从 EDX.org: “DAT216x Delivering a Relational Data Warehouse” 进行培训,我从培训中下载了这两个文件:AdventureWorks2016CTP3.bak
和 AdventureWorksDW2016CTP3.bak
.
BAK 到 AzureDB
- USER: Joseph Idziorek | ANSWER: Use SQL Server in a VM, which would enable a restore of a .bak file
I followed these 2 videos (hosted on YouTube) to create the
Azure VM
andSQL Instance
to be used in MCA training… Demo: Provisioning Microsoft Azure Services (VM, SQL). The 9:00-minute video shows you how to provision the relevant Azure resources. The video also demonstrates how to get the connection string for the Azure SQL Database, which is used in the next step.From the Azure VM remote session connection to SSMS I did the Restore Database from BAK.
- USER: razon | ANSWER: Right click (database name) > Tasks > Deploy Database to SQL Azure…
From the Azure VM remote sessions connection to SSMS SQL Instance, I ran the wizard “Deploy Database to SQL Azure”. After connection successfully the deployment took a few minutes to complete. NOTE: you must use ‘SQL Server Authentication’ because ‘Windows’ is not supported for Azure database. The Azure SQL Server authentication was demonstrated in the video link provided earlier in this answer.
部署环境
@@服务器名@@版本
+------------------------------------------------------------------------------------------------------+
| Source |
+------------------------------------------------------------------------------------------------------+
| data216x |
| |
| Microsoft SQL Server 2016 (SP1-CU13) (KB4475775) - 13.0.4550.1 (X64) |
| Jan 10 2019 19:31:11 |
| Copyright (c) Microsoft Corporation |
| Developer Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor) |
+------------------------------------------------------------------------------------------------------+
| Target |
+------------------------------------------------------------------------------------------------------+
| sqlserver-dat216x |
| |
| |
| Microsoft SQL Azure (RTM) - 12.0.2000.8 |
| Dec 19 2018 08:43:17 |
| Copyright (C) 2018 Microsoft Corporation |
+------------------------------------------------------------------------------------------------------+
结果
将数据库部署到 Azure 在我的方案中的步骤 Importing database
中失败并显示此消息。删除不兼容的对象后,Azure 数据库部署成功。
正在导入数据库...
TITLE: Microsoft SQL Server Management Studio
Could not import package.
Warning SQL0: A project which specifies SQL Server 2016 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12.
Error SQL72014: .Net SqlClient Data Provider: Msg 40536, Level 16, State 2, Line 1
'MEMORY_OPTIMIZED tables' is not supported in this service tier of the database. See Books Online for more details on feature support in different service tiers of Windows Azure SQL Database.
Error SQL72045: Script execution error. The executed script:
CREATE TYPE [Sales].[SalesOrderDetailType_inmem] AS TABLE ( [OrderQty] SMALLINT NOT NULL, [ProductID] INT NOT NULL, [SpecialOfferID] INT NOT NULL, INDEX [IX_SpecialOfferID] NONCLUSTERED HASH ([SpecialOfferID]) WITH (BUCKET_COUNT = 8), INDEX [IX_ProductID] NONCLUSTERED HASH ([ProductID]) WITH (BUCKET_COUNT = 8)) WITH (MEMORY_OPTIMIZED = ON);
(Microsoft.SqlServer.Dac)
BUTTONS:
OK
截图:
删除不兼容的对象后,Azure 数据库部署成功。 (注意:我不得不这样做几次。我尝试了 Redgate SQL 搜索 MEMORY_OPTIMIZED
但它一直说 "no search results" 即使 table 定义确实包含关键字。)
试试“数据迁移助手”; https://docs.microsoft.com/en-us/sql/dma/dma-migrateonpremsqltosqldb?view=sql-server-ver15
DMA 下载: https://www.microsoft.com/en-us/download/confirmation.aspx?id=53595