简体   繁体   English

从 On Prem 到 Azure SQL (PaaS) 的数据迁移

[英]Data Migration from On Prem to Azure SQL (PaaS)

We have an on-prem SQL Server DB (SQL Server 2017 Comp 140) that is about 1.2 TB.我们有一个大约 1.2 TB 的本地 SQL Server 数据库(SQL Server 2017 Comp 140)。 We need to do a repeatable migration of just the data to an on cloud SQL (Paas).我们需要将数据重复迁移到云端 SQL (Paas)。 The on-prem has procedures and functions that do cross DB queries which eliminates the Data Migration Assistant.本地具有执行跨数据库查询的过程和功能,从而消除了数据迁移助手。 Many of the tables that we need to migrate are system versioned tables (just to make this more fun).我们需要迁移的许多表都是系统版本的表(只是为了让它更有趣)。 Ideally we would like to move the data into a different schema of a different DB so we can avoid the use of External tables (worried about performance).理想情况下,我们希望将数据移动到不同数据库的不同模式中,这样我们就可以避免使用外部表(担心性能)。

Moving the data is just the first step as we also need to do an ETL job on the data to massage it into the new table structure.移动数据只是第一步,因为我们还需要对数据进行 ETL 作业,以将其按摩到新的表结构中。

We are looking at using ADF but it has trouble with versioned tables unless we turn them off first.我们正在考虑使用 ADF,但除非我们先将其关闭,否则它对版本化表有问题。

What are other options that we can look and try to be able to do this quickly and repeatedly?我们可以寻找并尝试能够快速重复地做到这一点的其他选择是什么? Do we need to change to IaaS or use a third party tool?我们是否需要更改为 IaaS 或使用第三方工具? Did we miss options in ADF to handle this?我们是否错过了 ADF 中处理此问题的选项?

If I summarize your requirements, you are not just migrating a database to cloud but a complete architecture of your SQL Server, which includes:如果我总结您的要求,您不仅仅是将数据库迁移到云,而是您的 SQL Server 的完整架构,其中包括:

  1. 1.2 TB of data, 1.2 TB 数据,
  2. Continuous data migration afterwards,之后不断的数据迁移,
  3. Procedures and functions for cross DB queries,跨数据库查询的过程和函数,
  4. Versioned tables版本化表

Point 1, 3, and 4 can be done easily by creating and exporting .bacpac file using SQL Server Management Studio (SSMS) from on premises to Azure Blob storage and then importing that file in Azure SQL Database.通过使用SQL Server Management Studio (SSMS)创建和导出.bacpac文件从本地到 Azure Blob 存储,然后将该文件导入 Azure SQL 数据库,可以轻松完成第 1、3 和 4 点。 The .bacpac file that we create in SSMS allows us to include all version tables which we can import at destination database.我们在 SSMS 中创建的.bacpac文件允许我们包含可以在目标数据库中导入的所有版本表。

Follow this third-party tutorial by sqlshack to migrate data to Azure SQL Database.按照sqlshack的此第三方教程将数据迁移到 Azure SQL 数据库。

The stored procedures can also be moved using SQL Scripts.也可以使用 SQL 脚本移动存储过程。 Follow the below steps:请按照以下步骤操作:

  1. Go the server in Management Studio在 Management Studio 中访问服务器
  2. Select the database, right click on it Go to Task .选择数据库,右键单击它 Go to Task
  3. Select Generate Scripts option under Task选择Task下的Generate Scripts选项
  4. Once its started select the desired stored procedures you want to copy and create a file of them and then run script from that file to the Azure SQL DB which you can login in SSMS.启动后,选择要复制的所需存储过程并为其创建一个文件,然后将该文件中的脚本运行到可以登录 SSMS 的 Azure SQL DB。

The repeatable migration of data is challenging part.数据的可重复迁移是具有挑战性的部分。 You can try it with Change Data Capture (CDC) but I'm not sure that is what exactly your requirement.您可以使用更改数据捕获 (CDC) 进行尝试,但我不确定这正是您的要求。 You can enable the CDC on database level using below command:您可以使用以下命令在数据库级别启用 CDC:

Use <databasename>;
EXEC sys.sp_cdc_enable_db;

Refer to know more - https://www.qlik.com/us/change-data-capture/cdc-change-data-capture#:~:text=Change%20data%20capture%20(CDC)%20refers,a%20downstream%20process%20or%20system .参考了解更多 - https://www.qlik.com/us/change-data-capture/cdc-change-data-capture#:~:text=Change%20data%20capture%20(CDC)%20refers,a %20下游%20进程%20或%20系统

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

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