迁移概述:将 SQL Server 到 SQL 数据库Migration overview: SQL Server to SQL Database

适用于: Azure SQL 数据库

了解有关将 SQL Server 迁移到 Azure SQL 数据库的不同迁移选项和注意事项。Learn about different migration options and considerations to migrate your SQL Server to Azure SQL Database.

你可以迁移在本地或以下位置运行的 SQL Server:You can migrate SQL Server running on-premises or on:

  • 虚拟机上的 SQL ServerSQL Server on Virtual Machines
  • Amazon Web Services (AWS) EC2Amazon Web Services (AWS) EC2
  • Amazon 关系数据库服务 (AWS RDS)Amazon Relational Database Service (AWS RDS)
  • 计算引擎 (Google Cloud Platform - GCP)Compute Engine (Google Cloud Platform - GCP)
  • Cloud SQL for SQL Server (Google Cloud Platform - GCP)Cloud SQL for SQL Server (Google Cloud Platform – GCP)

有关其他方案,请参阅数据库迁移指南For other scenarios, see the Database Migration Guide.


对于需要完全托管的平台即服务 (PaaS) 的 SQL Server 工作负载,Azure SQL 数据库是推荐的目标选项。Azure SQL Database is a recommended target option for SQL Server workloads that require a fully managed Platform as a Service (PaaS). SQL 数据库处理大多数数据库管理功能以及内置的高可用性、智能查询处理、可伸缩性和性能功能,以适应多种不同的应用程序类型。SQL Database handles most database management functions, along with high availability, intelligent query processing, scalability, and performance capabilities built in to suit many different application types.

SQL 数据库为多种部署模型服务层级灵活性,以满足不同类型的应用程序或工作负载。SQL Database provides flexibility with multiple deployment models and service tiers that cater to different types of applications or workloads.

迁移到 SQL 数据库的一个主要好处是,你可以利用 PaaS 功能实现应用程序的现代化,并消除对实例级别范围内的技术组件(例如 SQL 代理作业)的任何依赖关系。One of the key benefits of migrating to SQL Database is that you can modernize your application by leveraging the PaaS capabilities and eliminate any dependency on technical components that are scoped at the instance level such as SQL Agent jobs.

如果你选择基于 vCore 的购买模型还可以通过使用适用于 SQL Server 的 Azure 混合权益 将 SQL Server 的本地许可证迁移到 Azure SQL 数据库来节省成本。You can also save on cost by migrating your SQL Server on-premises licenses to Azure SQL Database using the Azure Hybrid Benefit for SQL Server should you choose the vCore-based purchasing model.

本指南旨在阐明在准备将 SQL Server 数据库迁移到 Azure SQL 数据库时的迁移选项和注意事项。This guide aims to clarify migration options and considerations as you prepare to migrate your SQL Server databases to Azure SQL Database.


评估迁移选项时要考虑的关键因素取决于:The key factors to consider when evaluating migration options depend on:

  • 服务器和数据库的数量Number of servers and databases
  • 数据库大小Size of databases
  • 迁移过程中可接受的业务停机时间Acceptable business downtime during the migration process

本指南中列出的迁移选项考虑了这些因素。The migration options listed in this guide take these factors into account. 对于到 Azure SQL 数据库的逻辑数据迁移,迁移时间可能取决于数据库中对象的数量和数据库的大小。For logical data migration to Azure SQL Database, the time to migrate can depend both on the number of objects in a database and the size of the database.

不同的工具可用于不同的工作负载和用户首选项。Different tools are available for different workloads and user preferences. 某些工具可用于执行使用基于 UI 的工具的单一数据库的快速迁移,而其他工具可迁移多个数据库,这些数据库可自动处理大规模的迁移。Some tools can be used to perform a quick migration of a single database using a UI-based tool while other tools can migrate multiple databases that can be automated to handle migrations at scale.

选择适当的目标Choose appropriate target

请考虑一般准则,以帮助你选择正确的 Azure SQL 数据库部署模型和服务层级。Consider general guidelines to help you choose the right deployment model and service tier of Azure SQL Database. 可在部署期间选择计算和存储资源,然后在使用 Azure 门户之后对其进行更改,而不会导致应用程序停机。You can choose compute and storage resources during deployment and then change them afterwards using the Azure portal without incurring downtime for your application.

部署模型:了解应用程序工作负载和使用模式,以在单一数据库或弹性池之间进行选择。Deployment models: Understand your application workload and the usage pattern to decide between a single database or elastic pool.

  • 单一数据库表示一个完全托管的数据库,适用于大多数新式云应用程序和微服务。A single database represents a fully managed database suitable for most modern cloud applications and microservices.
  • 弹性池是单一数据库的集合,其中包含一组共享资源(例如 CPU 或内存),适合将池中的数据库与可预测的使用模式结合使用,可有效地共享同一组资源。An elastic pool is a collection of single databases with a shared set of resources such as CPU or memory and suitable for combining databases in a pool with predictable usage patterns that can effectively share the same set of resources.

购买模型:在 vCore、DTU 或无服务器购买模型之间进行选择。Purchasing models: Choose between the vCore, DTU, or serverless purchasing model.

  • 利用 vCore 模型,你可以选择 Azure SQL 数据库的 vCore 数量,使其成为从本地 SQL Server 转换时的最简单选择。The vCore model lets you choose the number of vCores for your Azure SQL Database, making it the easiest choice when translating from on-premises SQL Server. 这是支持使用 Azure 混合权益节省许可证成本的唯一选项。This is the only option that supports saving on license cost with the Azure Hybrid Benefit.
  • DTU 模型提取基础计算、内存和 IO 资源,以便提供混合的 DTU。The DTU model abstracts the underlying compute, memory, and IO resources in order to provide a blended DTU.
  • 无服务器模型适用于需要自动按需缩放的工作负载,计算资源按每秒使用情况计费。The serverless model is intended for workloads that require automatic on-demand scaling with compute resources billed per second of usage. 无服务器计算层将在非活动期间(仅对存储计费)自动暂停数据库;当活动返回时,它将自动恢复数据库。The serverless compute tier automatically pauses databases during inactive periods (where only storage is billed), and automatically resumes databases when activity returns.

服务层:在三个专为不同类型的应用程序设计的服务层级之间进行选择。Service tiers: Choose between three service tiers designed for different types of applications.

  • 常规用途/标准服务层级提供了一个以预算导向的均衡选项,其计算和存储适用于交付中下层应用程序,存储层内置了冗余,可以从故障中恢复。General Purpose / Standard service tier offers a balanced budget-oriented option with compute and storage suitable to deliver mid-lower tier applications, with redundancy built in at the storage layer to recover from failures. 适用于大多数数据库工作负载。Designed for most database workloads.
  • 业务关键/高级服务层级适用于需要高事务速率、低延迟 IO 和高级别复原能力的高层应用程序,具有可用于故障转移和卸载读取工作负载的辅助副本。Business Critical / Premium service tier is for high tier applications that require high transaction rates, low latency IO, and a high level of resiliency with secondary replicas available for both failover and to offload read workloads.
  • 超大规模服务层级适用于具有不断增长的数据量并且需要自动纵向扩展到 100 TB 的数据库大小的数据库。Hyperscale service tier is for databases that have growing data volumes and need to automatically scale up to 100-TB database size. 专为特大型数据库设计。Designed for very large databases.


管理 Azure SQL 数据库中的事务日志记录速率以限制过高的数据引入速率。Transaction log rate is governed in Azure SQL Database to limit high ingestion rates. 因此在迁移过程中可能需要扩展目标数据库资源 (vCore/DTU) 以减轻 CPU 或吞吐量的压力。As such, during migration, it may be necessary to scale target database resources (vCores/DTUs) to ease pressure on CPU or throughput. 选择适当大小的目标数据库,但计划在必要时为迁移扩展资源。Choose the appropriately-sized target database, but plan to scale resources up for the migration if necessary.

Azure VM 上的 SQL Server 替代项SQL Server on Azure VM alternative

你的企业可能要求使 Azure 虚拟机中的 SQL Server 成为比 Azure SQL 数据库更合适的目标。Your business may have requirements that make SQL Server on Azure Virtual Machines a more suitable target than Azure SQL Database.

如果以下内容适用于你的业务,请考虑改为移动到 Azure VM 上的 SQL Server:If the following apply to your business, consider moving to a SQL Server on Azure VM instead:

  • 需要直接访问操作系统或文件系统(例如,为了在装有 SQL Server 的同一个虚拟机上安装第三方代理或自定义代理)。If you require direct access to the operating system or file system, such as to install third-party or custom agents on the same virtual machine with SQL Server.
  • 严重依赖于目前尚不支持的功能,如 FileStream/FileTable、PolyBase 和跨实例事务。If you have strict dependency on features that are still not supported, such as FileStream/FileTable, PolyBase, and cross-instance transactions.
  • 绝对需要保持使用特定的 SQL Server 版本(如 2012)。If you absolutely need to stay at a specific version of SQL Server (2012, for instance).
  • 计算要求比托管实例的要求低得多(如只需一个 vCore),且数据库整合不可接受。If your compute requirements are much lower than managed instance offers (one vCore, for instance), and database consolidation is not an acceptable option.

迁移工具Migration tools

推荐的迁移工具是数据迁移助手和 Azure 数据库迁移服务。The recommended tools for migration are the Data Migration Assistant and the Azure Database Migration Service. 还有其他可替代的迁移选项。There are other alternative migration options available as well.

下表列出了推荐的迁移工具:The following table lists the recommended migration tools:

技术Technology 说明Description
数据迁移助手 (DMA)Data Migration Assistant (DMA) 数据迁移助手是一种桌面工具,可提供对 SQL Server 的无缝评估和到 Azure SQL 数据库(架构和数据)的迁移。The Data Migration Assistant is a desktop tool that provides seamless assessments of SQL Server and migrations to Azure SQL Database (both schema and data). 此工具可以安装在本地服务器上,也可以安装在可以连接到源数据库的本地计算机上。The tool can be installed on a server on-premises or on your local machine that has connectivity to your source databases. 迁移过程是在源数据库和目标数据库中的对象之间进行的逻辑数据移动。The migration process is a logical data movement between objects in the source and target database.
- 迁移单一数据库(架构和数据)- Migrate single databases (both schema and data)
Azure 数据库迁移服务 (DMS)Azure Database Migration Service (DMS) 第一方 Azure 服务,可使用 Azure 门户将 SQL Server 数据库迁移到 Azure SQL 数据库,或通过 PowerShell 自动迁移。A first party Azure service that can migrate your SQL Server databases to Azure SQL Database using the Azure portal or automated with PowerShell. Azure DMS 要求在预配过程中选择首选的 Azure 虚拟网络 (VNet),以确保与源 SQL Server 数据库建立连接。Azure DMS requires you to select a preferred Azure Virtual Network (VNet) during provisioning to ensure there is connectivity to your source SQL Server databases.
- 迁移单一数据库或大规模迁移。- Migrate single databases or at scale.

替代工具Alternative tools

下表列出了可替代的迁移工具:The following table lists alternative migration tools:

技术Technology 说明Description
事务复制Transactional replication 通过在保持事务的一致性的同时提供发布服务器-订阅服务器类型迁移选项,将数据从源 SQL Server 数据库表复制到 SQL 数据库。Replicate data from source SQL Server database table(s) to SQL Database by providing a publisher-subscriber type migration option while maintaining transactional consistency. 在发布服务器上发生的增量数据更改将传播到订阅服务器。Incremental data changes are propagated to Subscribers as they occur on the Publishers.
导入导出服务/BACPACImport Export Service / BACPAC BACPAC 是扩展名为 .bacpac 的 Windows 文件,用于封装数据库的架构和数据。BACPAC is a Windows file with a .bacpac extension that encapsulates a database's schema and data. BACPAC 既可以用于从源 SQL Server 导出数据,也可以将数据导入 Azure SQL 数据库。BACPAC can be used to both export data from a source SQL Server and to import the data into Azure SQL Database. 可以使用 Azure 门户将 BACPAC 文件导入到新的 Azure SQL 数据库。BACPAC file can be imported to a new Azure SQL Database using the Azure portal.

对于大型数据库或大量数据库,为提高缩放性和性能,应考虑使用 SqlPackage 命令行实用工具来导出和导入数据库。For scale and performance with large databases sizes or large number of databases, you should consider using the SqlPackage command-line utility to export and import databases.
大容量复制Bulk copy 大容量复制程序 (bcp) 实用工具将数据从 SQL Server 实例复制到数据文件中。The bulk copy program (bcp) utility copies data from an instance of SQL Server into a data file. 使用 BCP 实用工具从源中导出数据,并将数据文件导入到目标 SQL 数据库中。Use the BCP utility to export the data from your source and import the data file into the target SQL Database.

若要进行高速大容量复制操作以将数据移动到 Azure SQL 数据库,智能大容量复制工具可用于利用并行复制任务来最大化传输速度。For high-speed bulk copy operations to move data to Azure SQL Database, Smart Bulk Copy tool can be used to maximize transfer speed by leveraging parallel copy tasks.
Azure 数据工厂 (ADF)Azure Data Factory (ADF) Azure 数据工厂中的复制活动使用内置连接器和集成运行时将数据从源 SQL Server 数据库迁移到 SQL 数据库。The Copy activity in Azure Data Factory migrates data from source SQL Server database(s) to SQL Database using built-in connectors and an Integration Runtime.

ADF 支持各种连接器,可将数据从 SQL Server 源移动到 SQL 数据库。ADF supports a wide range of connectors to move data from SQL Server sources to SQL Database.
SQL 数据同步SQL Data Sync 使用 SQL 数据同步这项基于 Azure SQL 数据库的服务,可以跨多个本地和云端数据库双向同步选定数据。SQL Data Sync is a service built on Azure SQL Database that lets you synchronize the data you select bi-directionally across multiple databases, both on-premises and in the cloud.
如果需要跨 Azure SQL 数据库或 SQL Server 中的多个数据库使数据保持最新,数据同步非常有用。Data Sync is useful in cases where data needs to be kept updated across several databases in Azure SQL Database or SQL Server.

比较迁移选项Compare migration options

比较迁移选项,选择适合你业务需求的路径。Compare migration options to choose the path appropriate to your business needs.

下表比较了推荐的迁移选项:The following table compares the recommended migration options:

迁移选项Migration option 何时使用When to use 注意事项Considerations
数据迁移助手 (DMA)Data Migration Assistant (DMA) - 迁移单一数据库(架构和数据)。- Migrate single databases (both schema and data).
- 可在数据迁移过程中适应停机。- Can accommodate downtime during the data migration process.

受支持的源:Supported sources:
- SQL Server (2005 - 2019) 本地或 Azure VM- SQL Server (2005 - 2019) on-premises or Azure VM
- GCP 计算 SQL Server VM- GCP Compute SQL Server VM
- 迁移活动执行数据库对象(从源到目标)之间的数据移动,因此建议在非高峰时间运行。- Migration activity performs data movement between database objects (from source to target) and hence recommended to run during off-peak times.
- DMA 报告每个数据库对象的迁移状态,包括迁移的行数。- DMA reports the status of migration per database object including the number of rows migrated.
- 对于大型迁移(数据库数量/数据库大小),请使用下面列出的 Azure 数据库迁移服务。- For large migrations (number of databases / size of database), use the Azure Database Migration Service listed below.
Azure 数据库迁移服务 (DMS)Azure Database Migration Service (DMS) - 迁移单一数据库或大规模迁移。- Migrate single databases or at scale.
- 可在迁移过程中适应停机。- Can accommodate downtime during migration process.

支持的源:Supported sources:
- SQL Server (2005 - 2019) 本地或 Azure VM- SQL Server (2005 - 2019) on-premises or Azure VM
- GCP 计算 SQL Server VM- GCP Compute SQL Server VM
- 可通过 PowerShell 自动执行大规模迁移。- Migrations at scale can be automated via PowerShell.
- 完成迁移的时间取决于数据库的大小和数据库中的对象数。- Time to complete migration is dependent on database size and the number of objects in the database.
- 需要源数据库设置为只读。- Requires the source database to set as Read-Only.

替代选项Alternative options

下表比较了替代迁移选项:The following table compares the alternative migration options:

方法/技术Method / technology 何时使用When to use 注意事项Considerations
事务复制Transactional replication - 通过不断地将源数据库表中的更改发布到目标 SQL 数据库表进行迁移。- Migrate by continuously publishing changes from source database tables to target SQL Database tables.
- 所选表(数据库的子集)的全部或部分数据库迁移。- Full or partial database migrations of selected tables (subset of database).

受支持的源:Supported sources:
- SQL Server (2016 - 2019),存在一些限制- SQL Server (2016 - 2019) with some limitations
- GCP 计算 SQL Server VM- GCP Compute SQL Server VM
- 与其他迁移选项相比,设置相对复杂。- Setup is relatively complex compared to other migration options.
- 提供连续复制选项以迁移数据(无需使数据库脱机)。- Provides a continuous replication option to migrate data (without taking the databases offline).
- 在源 SQL Server 上设置发布服务器时,关于事务的复制,有一些限制需要考虑。- Transactional replication has a number of limitations to consider when setting up the Publisher on the source SQL Server. 有关详细信息,请参阅对发布对象的限制See Limitations on Publishing Objects to learn more.
- 可以监视复制活动- It is possible to monitor replication activity.
导入导出服务/BACPACImport Export Service / BACPAC - 迁移单个业务线应用程序数据库。- Migrate individual Line-of-business application databases.
- 适用于较小的数据库。- Suited for smaller databases.
- 不需要单独的迁移服务或工具。- Does not require a separate migration service or tool.

受支持的源:Supported sources:
- SQL Server (2005 - 2019) 本地或 Azure VM- SQL Server (2005 - 2019) on-premises or Azure VM
- GCP 计算 SQL Server VM- GCP Compute SQL Server VM
- 需要停机,因为数据需要在源处导出并在目标处导入。- Requires downtime as data needs to be exported at the source and imported at the destination.
- 导出/导入中使用的文件格式和数据类型需要与表架构一致,以避免“截断”/“数据类型不匹配”错误。- The file formats and data types used in the export / import need to be consistent with table schemas to avoid truncation / data type mismatch errors.
- 导出包含大量对象的数据库所花费的时间可能会大大增加。- Time taken to export a database with a large number of objects can be significantly higher.
大容量复制Bulk copy - 迁移全部或部分数据迁移。- Migrate full or partial data migrations.
- 可以适应停机。- Can accommodate downtime.

支持的源:Supported sources:
- SQL Server (2005 - 2019) 本地或 Azure VM- SQL Server (2005 - 2019) on-premises or Azure VM
- GCP 计算 SQL Server VM- GCP Compute SQL Server VM
- 从源导出数据并导入目标时需要停机时间。- Requires downtime for exporting data from source and importing into target.
- 导出/导入中使用的文件格式和数据类型需与表架构一致。- The file formats and data types used in the export / import need to be consistent with table schemas.
Azure 数据工厂 (ADF)Azure Data Factory (ADF) - 从源 SQL Server 数据库迁移和/或转换数据。- Migrate and/or transforming data from source SQL Server databases.
- 将数据从多个数据源合并到 Azure SQL 数据库,通常用于商业智能 (BI) 工作负载。- Merging data from multiple sources of data to Azure SQL Database typically for Business Intelligence (BI) workloads.
- 需要在 ADF 中创建数据移动管道,以将数据从源移动到目标。- Requires creating data movement pipelines in ADF to move data from source to destination.
- 成本是一个重要的考虑因素,与管道触发器、活动运行、数据移动的持续时间等有关。- Cost is an important consideration and is based on the pipeline triggers, activity runs, duration of data movement, etc.
SQL 数据同步SQL Data Sync - 在源数据库和目标数据库之间同步数据。- Synchronize data between source and target databases.
- 适合在 Azure SQL 数据库和本地 SQL Server 之间以双向流运行连续同步。- Suitable to run continuous sync between Azure SQL Database and on-premises SQL Server in a bi-directional flow.
- Azure SQL 数据库必须是中心数据库,以与作为成员数据库的本地 SQL Server 数据库同步。- Azure SQL Database must be the Hub database for sync with on-prem SQL Server database as Member database.
- 与事务复制相比,SQL 数据同步支持在本地和 Azure SQL 数据库之间进行双向数据同步。- Compared to Transactional Replication, SQL Data Sync supports bi-directional data sync between on-premises and Azure SQL Database.
- 可能会对性能有更高的影响,具体取决于工作负载。- Can have a higher performance impact depending on the workload.

功能互操作性Feature interoperability

如果迁移的工作负载还依赖其他 SQL Server 功能,则还有其他注意事项。There are additional considerations when migrating workloads that rely on other SQL Server features.

SQL Server Integration ServicesSQL Server Integration Services

通过将 SQL Server Integration Services (SSIS) 包重新部署到 Azure 数据工厂中的 Azure SSIS 运行时,将包迁移到 Azure。Migrate SQL Server Integration Services (SSIS) packages to Azure by redeploying the packages to Azure-SSIS runtime in Azure Data Factory. Azure 数据工厂通过提供用于在 Azure 中执行 SSIS 包的运行时来支持 SSIS 包的迁移Azure Data Factory supports migration of SSIS packages by providing a runtime built to execute SSIS packages in Azure. 此外,还可以使用数据流在 ADF 中以本机方式重写 SSIS ETL 逻辑。Alternatively, you can also rewrite the SSIS ETL logic natively in ADF using Dataflows.

SQL Server Reporting ServicesSQL Server Reporting Services

将 SQL Server Reporting Services (SSRS) 报表迁移到 Power BI 中的分页报表。Migrate SQL Server Reporting Services (SSRS) reports to paginated reports in Power BI. 使用  RDL 迁移工具来帮助准备和迁移报表。Use the RDL Migration Tool to help prepare and migrate your reports. 此工具由 Microsoft 开发,可帮助客户将 RDL 报表从其 SSRS 服务器迁移到 Power BI。This tool was developed by Microsoft to help customers migrate RDL reports from their SSRS servers to Power BI. 它可在 GitHub 上使用,并记录迁移方案的端到端演练。It is available on GitHub, and it documents an end-to-end walkthrough of the migration scenario.

高可用性High availability

由于常规用途(标准可用性模型)业务关键(高级可用性模型) SQL 数据库中都已内置高可用性体系结构,因此在目标 Azure SQL 数据库上手动设置 SQL Server 高可用性功能(如 Always On 故障转移群集实例和 Always On 可用性组)已过时。Manual setup of SQL Server high availability features like Always On failover cluster instances and Always On availability groups become obsolete on the target Azure SQL Database as high availability architecture is already built into both General Purpose (standard availability model) and Business Critical (premium availability model) SQL Database. 业务关键/高级服务层级还提供读取扩展,该扩展允许连接到其中一个辅助节点以便只读。The Business Critical / Premium Service Tier also provides read scale-out that allows connecting into one of the secondary nodes for read-only purposes.

除了 SQL 数据库中包含的高可用性体系结构之外,还有自动故障转移组功能,使你可以管理托管实例中数据库到另一个区域的复制和故障转移。Beyond the high availability architecture that is included in SQL Database, there is also the auto-failover groups feature that allows you to manage the replication and failover of databases in a managed instance to another region.

SQL 代理作业SQL Agent jobs

Azure SQL 数据库不会直接支持 SQL 代理作业,需要部署到弹性数据库作业(预览版)SQL Agent jobs are not directly supported in Azure SQL Database and will need to be deployed to Elastic Database Jobs (Preview).

登录名和组Logins and groups

在脱机模式下,使用数据库迁移服务 (DMS) 将 SQL 登录名从源 SQL Server 移动到 Azure SQL 数据库。Move SQL logins from the source SQL Server to Azure SQL Database using Database Migration Service (DMS) in offline mode. 使用“迁移向导”中的“已选择登录名”边栏选项卡将登录名迁移到目标 SQL 数据库 。Use the Selected logins blade in the Migration Wizard to migrate logins to your target SQL Database.

Windows 用户和组也可以通过在“DMS 配置”页中启用相应的切换按钮来使用 DMS 进行迁移。Windows users and groups can also be migrated using DMS by enabling the corresponding toggle button in the DMS Configuration page.

或者,还可以使用 Microsoft 数据迁移架构师专门设计的 PowerShell 实用程序工具Alternatively, you can use the PowerShell utility tool specially designed by the Microsoft Data Migration Architects. 该实用程序使用 PowerShell 创建 Transact-SQL (T-SQL) 脚本来重新创建登录名,并从源到目标选择数据库用户。The utility uses PowerShell to create a Transact-SQL (T-SQL) script to recreate logins and select database users from the source to the target. 该工具自动将 Windows AD 帐户映射到 Azure AD 帐户,并且可以针对源 Active Directory 的每个登录名执行 UPN 查找。The tool automatically maps Windows AD accounts to Azure AD accounts, and can do a UPN lookup for each login against the source Active Directory. 该工具脚本自定义服务器和数据库角色,以及角色成员身份、数据库角色和用户权限。The tool scripts custom server and database roles, as well as role membership, database role, and user permissions. 目前不支持所包含的数据库,并且仅对一部分可能的 SQL Server 权限进行脚本编写。Contained databases are not yet supported and only a subset of possible SQL Server permissions are scripted.

系统数据库System databases

对于 Azure SQL 数据库,唯一适用的系统数据库为 master 和 tempdb。For Azure SQL Database, the only applicable system databases are master and tempdb. 若要了解详细信息,请参阅 Azure SQL 数据库中的 TempdbTo learn more, see Tempdb in Azure SQL Database.

利用高级功能Leverage advanced features

请确保利用 SQL 数据库提供的基于云的高级功能。Be sure to take advantage of the advanced cloud-based features offered by SQL Database. 例如,你不再需要担心管理备份的问题,因为服务会进行管理。For example, you no longer need to worry about managing backups as the service does it for you. 你可以还原到保留期内的任何时间点You can restore to any point in time within the retention period.

要增强安全性,请考虑使用  Azure Active Directory 身份验证审核、 威胁检测、 行级别安全性和 动态数据掩码To strengthen security, consider using Azure Active Directory Authentication, auditing, threat detection, row-level security, and dynamic data masking.

除了高级管理和安全功能以外,SQL 数据库还提供一组高级工具来帮助你监视和优化工作负载In addition to advanced management and security features, SQL Database provides a set of advanced tools that can help you monitor and tune your workload.

自动优化 会持续监视 SQL 执行计划统计信息的性能,并自动修复已识别的性能问题。Automatic tuning continuously monitors performance of your SQL execution plan statistics and automatically fixes identified performance issues.

迁移资产Migration assets

如需更多帮助,请参阅以下资源,这些资源是为支持实际迁移项目而开发的。For additional assistance, see the following resources that were developed for real world migration projects.

资产Asset 说明Description
数据工作负荷评估模型和工具Data workload assessment model and tool 此工具为给定的工作负荷提供了建议的“最佳匹配”目标平台、云就绪和应用程序/数据库修正级别。This tool provides suggested "best fit" target platforms, cloud readiness, and application/database remediation level for a given workload. 它提供简单的一键式计算和报表生成功能,通过提供统一的自动化目标平台决策过程,帮助加速大规模评估。It offers simple, one-click calculation and report generation that helps to accelerate large estate assessments by providing an automated and uniform target platform decision process.
DBLoader 实用工具DBLoader Utility DBLoader 可用于将带分隔符的文本文件中的数据加载到 SQL Server 中。The DBLoader can be used to load data from delimited text files into SQL Server. 此 Windows 控制台实用工具使用 SQL Server 本机客户端 bulkload 接口,该接口可用于所有版本的 SQL Server(包括 Azure SQL 数据库)。This Windows console utility uses the SQL Server native client bulkload interface, which works on all versions of SQL Server, including Azure SQL Database.
使用 PowerShell 批量创建数据库Bulk database creation with PowerShell 这包括一组三个 PowerShell 脚本,可用于创建资源组 (create_rg.ps1)、Azure 中的逻辑服务器 (create_sqlserver.ps1) 和 Azure SQL 数据库 (create_sqldb.ps1)。This includes a set of three PowerShell scripts that create a resource group (create_rg.ps1), the logical server in Azure (create_sqlserver.ps1), and Azure SQL Database (create_sqldb.ps1). 这些脚本包括循环功能,因此你可以根据需要循环访问和创建任意数量的服务器和数据库。The scripts include loop capabilities so you can iterate and create as many servers and databases as necessary.
使用 MSSQL-Scripter 和 PowerShell 批量部署架构Bulk schema deployment with MSSQL-Scripter & PowerShell 此资产在 Azure 中创建一个资源组、一个或多个逻辑服务器来承载 Azure SQL 数据库,从一个本地 SQL Server(或多个 SQL Server (2005+))导出每个架构,并将其导入 Azure SQL 数据库。This asset creates a resource group, one or multiple logical servers in Azure to host Azure SQL Database, exports every schema from an on-premises SQL Server (or multiple SQL Servers (2005+) and imports it to Azure SQL Database.
将 SQL Server 代理作业转换为弹性数据库作业Convert SQL Server Agent jobs into Elastic Database Jobs 此脚本将源 SQL Server 代理作业迁移到弹性数据库作业。This script migrates your source SQL Server Agent jobs to Elastic Database Jobs.
用于将本地 SQL Server 登录名移动到 Azure SQL 数据库的实用工具Utility to move on-premises SQL Server logins to Azure SQL Database 一个 PowerShell 脚本,可创建 T-SQL 命令脚本以重新创建登录名并从本地 SQL Server 到 Azure SQL 数据库选择数据库用户。A PowerShell script that creates a T-SQL command script to re-create logins and select database users from on-premises SQL Server to Azure SQL Database. 该工具允许将 Windows AD 帐户自动映射到 Azure AD 帐户,还可以选择性地迁移 SQL Server 本机登录名。The tool allows automatic mapping of Windows AD accounts to Azure AD accounts as well as optionally migrating SQL Server native logins.
使用 Logman 的 PerfMon 数据收集自动化PerfMon data collection automation using Logman 一种工具,用于收集 PerMon 数据以了解基线性能,并帮助提供迁移目标建议。A tool that collects PerMon data to understand baseline performance and assists in migration target recommendations. 该工具使用 logman.exe 创建将创建、启动、停止和删除在远程 SQL Server 上设置的性能计数器的命令This tool uses logman.exe to create the command that will create, start, stop, and delete performance counters set on a remote SQL Server
白皮书 - 使用 BACPAC 将数据库迁移到 Azure SQL DBWhitepaper - Database migration to Azure SQL DB using BACPAC 此白皮书提供了一些指导和步骤,可帮助你使用 BACPAC 文件加快从 SQL Server 到 Azure SQL 数据库的迁移。This whitepaper provides guidance and steps to help accelerate migrations from SQL Server to Azure SQL Database using BACPAC files.

这些资源是作为 Data SQL Ninja 计划的一部分开发的,该计划由 Azure 数据组工程团队提供赞助。These resources were developed as part of the Data SQL Ninja Program, which is sponsored by the Azure Data Group engineering team. Data SQL Ninja 计划的核心宗旨是解锁和加速复杂的现代化进程,并争取数据平台向 Azure 数据平台迁移的机会。The core charter of the Data SQL Ninja program is to unblock and accelerate complex modernization and compete data platform migration opportunities to Azure Data platform. 如果你认为贵组织有意参与 Data SQL Ninja 计划,请联系帐户团队并让他们提交提名。If you think your organization would be interested in participating in the Data SQL Ninja program, please contact your account team and ask them to submit a nomination.

后续步骤Next steps

若要开始将 SQL Server 迁移到 Azure SQL 数据库,请参阅 SQL Server 到 SQL 托管实例迁移指南To start migrating your SQL Server to Azure SQL Database, see the SQL Server to SQL Database migration guide.