In this article, we will discuss and understand a method to migrate an on-premises SQL Server database to the Azure SQL database.

在本文中,我们将讨论和理解将本地SQL Server数据库迁移到Azure SQL数据库的方法。

This article will look at ways to modernize and transform applications and infrastructure by taking advantage of the agility and flexibility of the cloud.

本文将探讨通过利用云的敏捷性和灵活性来现代化和转换应用程序和基础架构的方法。

Azure SQL Database currently resides in ~50 data centers around the world, with more data centers coming online regularly, enabling you to run your database in a data center near you. With so many on-premises implementations at customer sites, how do you migrate from the traditional on-premises SQL Server implementation to modern Azure SQL Database technologies and benefit from what cloud database services can offer?

Azure SQL数据库当前位于全球约50个数据中心中,越来越多的数据中心定期上线,使您可以在附近的数据中心中运行数据库。 在客户站点上有如此众多的本地实施,您如何从传统的本地SQL Server实施迁移到现代Azure SQL数据库技术,并从可提供的云数据库服务中受益?

This article will guide you through the process and steps required to migrate your database workloads from on-premises to Azure-based cloud services.

本文将指导您完成将数据库工作负载从本地迁移到基于Azure的云服务所需的过程和步骤。

介绍 (Introduction)

Digital transformation plays a key role in every organization’s future. Dependencies on legacy systems and siloed processes act as major roadblocks to efforts towards digital transformation.

数字化转型在每个组织的未来中都扮演着关键角色。 对遗留系统和孤立过程的依赖成为实现数字化转型的主要障碍。

For many organizations, the upcoming Microsoft end of support (EOS) for Windows Server and SQL Server 2008 and SQL Server 2008 R2 brings in challenges in terms of innovation, cost, security, and regulatory compliance. Many traditional organizations are under tremendous pressure to upgrade their systems to the more recent versions of Windows and SQL Server.

对于许多组织而言,即将到来的Microsoft对Windows Server和SQL Server 2008和SQL Server 2008 R2的支持终止(EOS)带来了创新,成本,安全性和法规遵从性方面的挑战。 许多传统组织承受着巨大的压力,要求将其系统升级到Windows和SQL Server的最新版本。

If you look at the brighter side, though, this is a great opportunity for organizations to make up for the missed opportunities of the past to migrate, modernize and redefine their core to enhance performance, improve customer experience and drive a competitive edge. One of the options also available is to modernize by migrating their legacy estates to Azure SQL Database.

但是,如果您放眼光明的一面,这对于组织来说是一个很好的机会,可以弥补过去错过的迁移,现代化和重新定义其核心的机会,以增强性能,改善客户体验并提高竞争优势。 还可以使用的选项之一是通过将其旧版资产迁移到Azure SQL数据库来进行现代化。

为什么我们可能必须将本地SQL Server数据库迁移到Azure SQL数据库(PaaS-平台即服务)? (Why we may have to migrate on-premises SQL Server database to Azure SQL Database (PaaS—Platform as a Service)?)

Microsoft’s enabling functions and cloud offerings have many advantages with Azure SQL Database that runs as a PaaS. On a high level, for instance, there is no need for you to create VMs or install the Windows Server operating system or SQL Server. They are all simply available to use. All you have to do is log into the Azure portal and pick the size and configuration that fits your needs.

Microsoft的支持功能和云产品通过作为PaaS运行的Azure SQL数据库具有许多优势。 例如,在较高级别,不需要创建VM或安装Windows Server操作系统或SQL Server。 它们都可以简单地使用。 您要做的就是登录Azure门户,然后选择适合您需要的大小和配置。

  • Note: The PaaS offering from Microsoft provides you with everything required to support database services. Microsoft owns more than half of the administration overhead, which includes patching, software updates, system maintenance, etc. However, it is important to understand the underlying database service implications of this model. Azure SQL Database doesn’t in-house full feature parity when compared to the on-premise database versions of SQL Server like SQL Server 2014, SQL Server 2016, and SQL server 2017

    注意 :Microsoft的PaaS产品为您提供支持数据库服务所需的一切。 Microsoft拥有一半以上的管理开销,其中包括补丁程序,软件更新,系统维护等。但是,了解此模型对底层数据库服务的意义非常重要。 与SQL Server的本地数据库版本(例如SQL Server 2014,SQL Server 2016和SQL Server 2017)相比,Azure SQL Database没有内部完整功能奇偶校验

    Some of the major notable omissions that include Database Mail, FILESTREAM data type, and CLR integration with SQL Server. You can refer to the Microsoft documentation for more about the features that are supported and not supported by SQL PaaS offering

    一些主要的显着遗漏包括数据库邮件 , FILESTREAM数据类型以及与SQL Server的CLR集成。 您可以参考Microsoft文档以获取有关SQL PaaS产品支持和不支持的功能的更多信息。

如何验证数据库是否与Azure SQL数据库兼容? (How can you validate whether your database is compatible with Azure SQL Database?)

This can be validated in multiple ways:

这可以通过多种方式进行验证:

  1. Create a BACPAC file: If you can create the BACPAC file from your database that means your database can be migrated to Azure SQL Database 创建BACPAC文件 :如果可以从数据库中创建BACPAC文件,则意味着可以将数据库迁移到Azure SQL数据库
  2. Use a script: Generate a schema of the on-premises databases and create the same in the Azure SQL environment 使用脚本 :生成本地数据库的架构,并在Azure SQL环境中创建该架构

数据迁移有哪些方式? (What are some ways that data be migrated?)

There are several ways to migrate the data. The following are some of the methods that can be used for data migration:

有几种迁移数据的方法。 以下是一些可用于数据迁移的方法:

  1. Create BACPAC files and export them 创建BACPAC文件并将其导出
  2. Use SQL Server Management Studio; generate scripts and use the import/export data methods 使用SQL Server Management Studio; 生成脚本并使用导入/导出数据方法
  3. Use the Data Migration Assistant Wizard 使用数据迁移助手向导
  4. Transactional Replication to port the data over to the cloud 事务复制将数据移植到云中
  5. Use PowerShell and SQLPackage.exe, an SSDT tool 使用PowerShell和SQLPackage.exe(SSDT工具)
  • Note: You would need to study your situation and adopt any of the above-mentioned methods based on your requirements and the current environment. It is hard to say which of these methods would be better for you until you understand the migration process. In most cases, Data Migration Assistance and/or Replication is best-suited for data migration
  • 注意 :您将需要研究您的情况并根据您的要求和当前环境采用上述任何方法。 在您了解迁移过程之前,很难说出哪种方法对您更好。 在大多数情况下,数据迁移协助和/或复制最适合数据迁移

In this guide, I will discuss the first method to migrate the database to Azure SQL Database.

在本指南中,我将讨论将数据库迁移到Azure SQL数据库的第一种方法。

使用导出数据层应用程序导出数据库 (Exporting database using export data-tier application)

To migrate on-premises SQL Server database to Azure SQL Database Using Export Data-Tier Application:

使用导出数据层应用程序将本地SQL Server数据库迁移到Azure SQL数据库:

使用Management Studio创建BACPAC文件 (Create BACPAC files using Management Studio)

  1. Verify that you have the latest version of SQL Server Management Studio. New versions of Management Studio are updated monthly to remain in sync with updates to the Azure portal

    验证您具有最新版本SQL Server Management Studio。 新版本的Management Studio每月更新一次,以与Azure门户的更新保持同步

    Note: It is recommended that you always use the latest version of Management Studio to remain synchronized with updates to Microsoft Azure and SQL Database.Update SQL Server Management Studio

    注意 :建议始终使用最新版本的Management Studio与Microsoft Azure和SQL数据库的更新保持同步。 更新SQL Server Management Studio

  2. Open SQL Server Management Studio (SSMS) and connect to the source database in Object Explorer. In this case, the source database is AdventureWorks2016 打开SQL Server Management Studio(SSMS),然后在对象资源管理器中连接到源数据库。 在这种情况下,源数据库为AdventureWorks2016
  3. Right-click AdventureWorks2016 database in Object Explorer, point to Tasks, and click Export Data-Tier Application…

    右键单击 对象资源管理器”中的 AdventureWorks2016数据库,指向“ 任务” ,然后单击“ 导出数据层应用程序”。

  4. Next to bypass the default setting page 下一步”以跳过默认设置页面
  5. In the Export Settings tab, configure the export to save the BACPAC file to either a local disk or to Azure blob storage and click Next

    在“ 导出设置”选项卡中,配置导出以将BACPAC文件保存到本地磁盘或Azure blob存储,然后单击“ 下一步”。

    • Note: A BACPAC file will only be saved if you have no database compatibility issues. If there are compatibility issues, then the error message will be displayed on the console

      注意 :仅当您没有数据库兼容性问题时,才会保存BACPAC文件。 如果存在兼容性问题,那么错误消息将显示在控制台上

  6. In this case, let us follow the default settings 在这种情况下,让我们遵循默认设置
  7. Advanced tab and clear the 高级选项卡,然后清除全Select All checkbox to skip exporting the data. Our goal at this point is only to test for compatibility 复选框以跳过导出数据。 我们目前的目标只是测试兼容性
  8. Save to Microsoft Azure option to save the bacpac file to Azure Blob storage 保存到Microsoft Azure选项以将bacpac文件保存到Azure Blob存储
  9. Next, go to the Azure portal to get the storage account details. In this case, dbmigratestg is the storage account created for this exercise

    接下来,转到Azure门户以获取存储帐户详细信息。 在这种情况下, dbmigratestg是为此练习创建的存储帐户

  10. Select the storage account and copy the access key. Paste the key in SQL Server Management Studio and click Connect

    选择存储帐户并复制访问密钥。 将密钥粘贴到SQL Server Management Studio中,然后单击“ 连接”

  11. Now, you can access the Azure Blob storage

    现在,您可以访问Azure Blob存储

  12. Click Advanced. In this pane, you can select the intended objects that are going to be part of the migration

    单击高级 。 在此窗格中,您可以选择将要包含在迁移中的预期对象

  13. Before you click the Finish button, let us validate the summary in detail

    在单击“ 完成”按钮之前,让我们详细验证摘要

  14. Next and then click 下一步 ,然后单击Finish 完成
  15. The Export wizard performs the database compatibility checks. If any issues are found, they will appear after the wizard validates the schema

    导出向导执行数据库兼容性检查。 如果发现任何问题,它们将在向导验证架构后出现

  16. Error for 验证模式 Validating schema 错误”
  17. Finally, the preparation phase to migrate on-premises SQL Server database to Azure SQL Database completed 最后,将本地SQL Server数据库迁移到Azure SQL数据库的准备阶段已完成

使用导入数据库选项导入文件 (Importing file using Import database option )

In the process of migrating on-premises SQL Server database to Azure SQL Database, now we do the import of .bacpac file.

现在,在将本地SQL Server数据库迁移到Azure SQL数据库的过程中,我们将导入.bacpac文件。

将BACPAC文件导入到Azure (Importing the BACPAC file to Azure )

Now that we have the BACPAC file ready, we can now use the same to migrate the data over to Azure. This BACPAC file could be stored locally, or on Azure Blob storage (standard).

现在我们已经准备好BACPAC文件,现在我们可以使用该文件将数据迁移到Azure。 此BACPAC文件可以存储在本地,也可以存储在Azure Blob存储(标准)上。

For now, the Azure portal will allow you to only create a single database in Azure SQL Database, and this can be done only from a BACPAC file. Follow the steps below to import the BACPAC file you saved.

目前,Azure门户仅允许您在Azure SQL数据库中创建一个数据库,而这只能通过BACPAC文件来完成。 请按照以下步骤导入您保存的BACPAC文件。

  1. Connect to Azure portal and open the SQL database page. Navigate into your resource group and create a new instance of an Azure Database (this is out of the scope of this article). The Assumption is that Azure PaaS SQL Database is available 连接到Azure门户并打开SQL数据库页面。 导航到您的资源组并创建一个Azure数据库的新实例(这不在本文的讨论范围之内)。 假设Azure PaaS SQL数据库可用
  2. Next, select the Import database on the toolbar

    接下来,在工具栏上选择“ 导入数据库

  3. Next, locate the Blob storage account and its respective container for the BACPAC file

    接下来,找到Blob存储帐户及其BACPAC文件的相应容器

  4. Type in the new database name, size, and the SQL admin credentials

    输入新的数据库名称,大小和SQL管理员凭据

  5. OK will begin the process of importing the BACPAC file into the new Azure Database, and you should be good to go 确定”将开始将BACPAC文件导入新的Azure数据库的过程,您应该一切顺利
  • Note: I recommend going for a higher DTU; higher DTU results in a higher speed of operation. Once you are set up with Azure Database, scaling the database to a higher service tier is rather simple. After the import is complete, you could even scale down to a lower tier to suit your needs
  • 注意: 我建议使用更高的DTU。 DTU越高,操作速度就越高。 一旦设置了Azure数据库,就可以将数据库扩展到更高的服务层。 导入完成后,您甚至可以缩小到较低的级别以满足您的需求

That’s all for now…

目前为止就这样了…

摘要 (Summary)

In this post, we saw one of the ways to migrate an on-premises SQL Server database to the Azure SQL Database. We discussed one of the methods – migration using a BACPAC file in detail. I will discuss more other options in my upcoming articles. Stay tuned for more updates. Please leave your feedback and questions in the comments section below.

在本文中,我们看到了一种将本地SQL Server数据库迁移到Azure SQL数据库的方法。 我们讨论了一种方法-详细介绍了如何使用BACPAC文件进行迁移。 我将在我的后续文章中讨论更多其他选项。 敬请期待更多的更新。 请在下面的评论部分中留下您的反馈和问题。

翻译自: https://www.sqlshack.com/migrate-an-on-premises-sql-server-database-to-the-azure-sql-database/

将本地SQL Server数据库迁移到Azure SQL数据库相关推荐

  1. 使用SQL Server事务复制将SQL Server数据库迁移到Azure SQL数据库

    In this guide, we'll discuss more about migrating a SQL Server database to Azure SQL Database using ...

  2. SQL SERVER 2012/2014 链接到 SQL SERVER 2000的各种坑

    原文:SQL SERVER 2012/2014 链接到 SQL SERVER 2000的各种坑 本文总结一下SQL SERVER 2012/2014链接到SQL SERVER 2000的各种坑,都是在 ...

  3. sql azure 语法_如何将内部SQL Server数据库迁移到Azure

    sql azure 语法 Lately, database administrators often hear the question "have you tried Azure?&quo ...

  4. 使用Microsoft数据迁移助手在Oracle数据库和SQL Server之间迁移的具体示例

    介绍 (Introduction) Intended audience 目标听众 This document is intended for application developers and da ...

  5. 如何将用户迁移到SQL Server中的部分包含的数据库

    介绍 (Introduction) Microsoft introduced the Contained Database feature in SQL Server 2012. In this ar ...

  6. 将您的SQL Server工作负载迁移到PostgreSQL –第1部分

    目录 为什么要开源? 从许可软件迁移到开源 为什么选择PostgreSQL? 竞争者 SQL Server:历史记录,版本和版本 PostgreSQL:历史,版本和版本 根据您的需要选择合适的Post ...

  7. 【SQL Server数据迁移】链接服务器、分布式查询

    链接服务器为SQL Server提供了从远程数据源访问数据的能力,可以执行查询.修改数据.远程过程调用.远程数据源可以是同类的(数据源可以是另一个SQL Server实例),也可以是不同类的(其他关系 ...

  8. 将您的SQL Server工作负载迁移到PostgreSQL

    目录 介绍 关于文章系列 第1部分 第2部分 第三部分 第4部分 文章链接 介绍 这个由多部分组成的系列文章讨论了从SQL Server到PostgreSQL的数据库,应用程序和服务的迁移,并讨论了开 ...

  9. 将您的SQL Server工作负载迁移到PostgreSQL –第4部分

    目录 维护与监控 高可用性,负载平衡和复制 通过并行部署稳定环境 总结 维护与监控  SQL Server带有内置的维护和监视工具,例如Cluster Manager,Profiler等,可用于管理S ...

最新文章

  1. php创建多级目录完整封装类操作
  2. 离职交接文档_如何写好离职工作交接文档?
  3. linux 网络状态表 /proc/net/tcp 各项参数说明
  4. Qt C++单例类写法
  5. css 设置其它标签,有没有办法将CSS样式设置为特定输入类型的标签?
  6. linux下同步库的创建
  7. 阿里最喜欢问的多线程顺序打印的5种解法!
  8. opencv图像分割2-GMM
  9. python获取程序文件中的全局变量和局部变量的函数
  10. 神奇的文本编辑,惊人的移花接木 | ACM MM 2019 论文赏析
  11. LCA(最近公共祖先)
  12. ServletConfig讲解
  13. 最小化安装CentOS 7后,图形界面的安装(GNOME、KDE等)
  14. matlab 做中值滤波时K = filter2(fspecial('average',3),J)/255,为什么要除以255
  15. element-ui的tree配合原生
  16. oracle 韩思捷,oracle
  17. 华为笔试题 字符串解压缩(C语言解法)
  18. Python爬虫学习简单入门(第四含scrapy安装)
  19. 沈颖刚:生物柴油或是高原柴油货车污染治理有效途径
  20. 正则表达式中常用符号

热门文章

  1. python正则匹配html标签_Python爬虫常用正则表达式及HTML网页标签分析总结
  2. python学习-- django 2.1.7 ajax 请求 进阶版
  3. 【转】sql server 订阅发布、快照发布(一)
  4. 微信小程序项目笔记以及openId体验版获取问题
  5. dp4--codeVs1043 方格取数
  6. C/C++: C++可调用对象详解
  7. UVa 10806 Dijkstra,Dijkstra(最小费用最大流)
  8. 水中浮力插件buoyancy_程序化河流后续——加入浮力系统
  9. P1426 小鱼会有危险吗
  10. 怎样做地推,转化率提高20倍?