Cloud Database Migration At Scale with Azure DMS
Azure Database Migration Service (Azure DMS) is a fully managed, comprehensive solution for migrating your databases to the cloud at scale. Not to be confused with Azure Migrate, which currently focuses on preparing on-premises VMs for migration, Azure DMS is an end-to-end migration solution designed for databases. The Azure team is working toward adding as many source-target database pairs as possible to Azure DMS over time. Currently, the service covers two of the most common SQL-based scenarios. As of March, 2018, Azure DMS is available in public preview.
Azure DMS and Azure Migrate: knowing the difference
We recently took a deep dive into Azure Migrate. Although Azure DMS will work together with Azure Migrate in many circumstances, it’s important to note that the services have two key differences. First, Azure Migrate currently works with VMs, while Azure DMS works exclusively with databases. Second, Azure Migrate currently handles only the assessment and preparatory phase prior to the migration itself, while Azure DMS handles the entire end-to-end migration process.
Status (as of March 2018)
As a new service, Azure DMS will continue to rapidly evolve as more source-target database pairs are added in the coming months and years. As of March, 2018, the public preview of Azure DMS supports the following two source-target pairs:
- SQL Server to Azure SQL Database
- SQL Server to Azure SQL Database Managed Instance
The Azure team is focusing their attention on improving the reliability and functionality of the current service while adding as many new source-target pairs as possible in the near future.
Prerequisites
Some of the prerequisites for using Azure DMS are unique to specific source-target pairs. Others are common across all situations. Let’s look at the universal prerequisites first:
Universal prerequisites
Creating an Azure Virtual Network (VNET)
You will need to create a VNET for Azure DMS. Azure Resource Manager will guide you. Once your VNET is in place, make sure that all of the following communication ports are allowed by your VNET’s network security group:
- 443
- 53
- 9354
- 445
- 12000
Handling a firewall
Depending on your circumstances, you may need to change your firewall’s rules to ensure that Azure DMS can access the database you want to migrate. You may also need to use SQL Server Configuration Manager to allow the database engine access.
Enable TCP/IP
The SQL Server Express installation process sets the TCP/IP protocol to disabled by default. To enable it, see Enable or Disable a Server Network Protocol.
For migrations from SQL Server to Azure SQL Database
In order to migrate your SQL database from SQL Server to Azure SQL Database, you will not only need to fulfill the universal prerequisites above, but several additional prerequisites. First, be sure to create an Azure SQL Database instance from within the Azure portal. Next, install Data Migration Assistant (DMA). On its own, DMA is designed for small migrations and the DMA documentationdefers to Azure DMS for migrating large databases. However, Azure DMS does use DMA to assess your source databases. Based on DMA’s assessment, you can make any necessary changes to your source databases before going forward with the migration itself. Once DMA is installed, follow the remaining steps found here to fulfill all prerequisites.
For migrations from SQL Server to Azure SQL Database Managed Instance
To migrate your SQL database from SQL Server to Azure SQL Database Managed Instance, you will need to fulfill the common prerequisites listed above along with several additional prerequisites. First, be sure to create an Azure SQL Database Managed Instance from within the Azure portal. Next, install Data Migration Assistant. Then follow the remaining technical steps found here.
Key intermediate steps
After your prerequisites are complete, but before you install your Azure DMS instance, it’s important to complete three important intermediate steps: source database assessment, sample schema migration, and registering Microsoft.DataMigration.
Source database assessment
Before you move forward with your migration, you will need to perform a thorough assessment of your source database. You may want to start by reviewing a summary of the steps, then following the complete instructions.
Using DMA to migrate the sample schema
Once you have performed a thorough assessment of your source database, it’s time to migrate a sample schema to Azure SQL Database (or Azure SQL Database Managed Instance) using DMA. Simply open DMA, click +, then select Migration from Project type. Give your project a name, then select SQL Server under Source server type and Azure SQL Database (or Azure SQL Database Managed Instance) under Target server type. Next, select Schema only under Migration scope and click Create. For the remaining steps, see Azure’s instructions.
Registering Microsoft.DataMigration
From the Azure portal, click All Services, then select Subscriptions. Next, you will need to select the Azure subscription that you would like to use to create your Azure DMS instance. Having selected your subscription, click Resource providers in the right-hand menu. A search pane will appear. Enter Microsoft.DataMigration into the search field, then click Register. You are now ready to create an instance of Azure DMS.
Creating an Azure DMS instance
Click the prominent Create a resource link at the top of the Azure portal’s sidebar menu. Then search on Azure Database. Select Azure Database Migration Service from the auto-complete drop-down list. This will bring you to a page reminding you to perform the steps outlined above before creating your Azure DMS instance. If you have completed all the steps and are ready to proceed, click the Create button at the bottom of the page. A new pane will appear requiring you to provide a name for the service; an Azure subscription to use; a network (whether new or existing); and a location. Note that as of March, 2018, the Azure DMS service is only available in a limited number of regions.
You will also need to provide a pricing tier if you’re not content with the default (General Purpose: 8 vcores). The system will provide you with an estimated monthly cost based on your selections. Once you’re ready to proceed, click Create.
Creating your first migration project
Under All Services, search on Azure Database Migration and click on Azure Database Migration Services when it appears. This will take you to the main Azure DMS page. Recall the name you gave your Azure DMS instance and enter it into the search box provided. Then click New Migration Project from the top of the page. A new pane will appear in the right rail with three required fields. Under Project name, enter a name for your migration project. Under Source server type, choose SQL Server. Under Target server type, select Azure SQL Database (or Azure SQL Database Managed Instance). Then click Create.
Next, follow Azure’s instructions for specifying the source server details and the target server details.
Running and monitoring your database migration
From the Azure DMS main page, click on the name of your new project, which will be prominently listed. A new pane will appear displaying your project’s details. Click New Activity at the top of the pane, then Run Data Migration. The service will ask for the credentials for both source and target servers. Once you’ve provided them, click Save to continue.
Map to target destination
A new pane titled Map to target destination will appear. Follow instructions at the top of the page to perform the mapping properly. Note that if you’ve chosen the same name for your source and target databases, then the service will select the target from the drop-down menu by default. When you’ve made your selections and are ready to proceed, click Save.
Select tables
The Select tables pane will appear. Be sure to review the complete list of database tables provided before proceeding. Once your review is complete, click Save.
Migration summary
The Summary pane will appear. At this point, it’s important to take the time to read over Azure DMS’s performance-related recommendations at the top of the pane. Then proceed to give your migration a name in the required Activity name field.
You may also decide to open the Choose validation option pane to validate the database for any or all of the following: schema comparison, data consistency and query correctness. Once you’ve made your selections, click Save.
When you are confident that you are ready to initiate the migration, click the prominent Run migration button at the bottom of the pane. You can continue to click Refresh to monitor the status of your migration as it progresses.
Azure DMS: An end-to-end database migration solution
As outlined above, Azure DMS is a comprehensive, end-to-end solution for database migration at scale. Although Azure DMS and Azure Migrate can work together in some circumstances, it’s important to keep in mind that the two services are very different. Azure Migrate currently handles migration assessment and preparation, not the migration itself. It also currently applies only to on-premises VMs. Azure DMS, on the other hand, handles the entire end-to-end migration process, and applies exclusively to databases. Azure DMS currently supports migration from SQL Server to either Azure SQL Database or Azure SQL Database Managed Instance. The Azure team plans to significantly expand the number of source-target pairs over time.
When trying out Azure DMS, be sure to follow the procedures reviewed in this post. Begin by fulfilling the universal and scenario-specific prerequisites outlined above. Then take the time to complete the three key intermediate steps, beginning with a thorough migration assessment. Next, set up your Azure DMS instance according to Azure’s complete instructions. Finally, run and monitor your first complete migration to leverage all the advantages that that come with the Azure cloud.
For more information on Azure DMS and other Azure services that are reshaping cloud computing in 2018, contact us.