The Data Migration Assistant (DMA) helps you upgrade to a modern data platform by detecting compatibility issues that can impact database functionality in your new version of SQL Server or Azure SQL Database. The Data Migration Service (DMA) lets you migrate on-premises SQL Server or SQL Database hosted in AWS or GCP migrate to Azure SQL Database. There are three simple steps require to migrate Database to Azure SQL. There are two migration approach you can take, Offline and Online migration.
- Assess on-premises SQL Server instance(s) migrating to Azure SQL database(s).
- Discover issues that can affect an upgrade to an on-premises SQL Server.
- Migrate an on-premises SQL Server instance to Azure SQL Server
- SQL Server sysadmin role
- distributor role for source SQL Server
- SQL Server Management Studio (SSMS)
- Co-Administrator or Contributor role in Azure cloud
- Source Database is SQL Server 2005 or later version
- Target database is Azure SQL Database and Azure SQL Database Managed Instance
- Azure Virtual Network (VNET) for the Azure Database Migration Service by using the Azure Resource Manager deployment model.
- Ensure that your VNET Network Security Group rules don’t block the following communication ports 443, 53, 9354, 445, 12000.
- Download and install the Data Migration Assistant v3.3 or later.
Prepare Target Database:
A single database has a defined set of compute, memory, IO, and storage resources using one of two purchasing models.
- Log on to Azure Portal
- Select Create a resource in the upper left-hand corner of the Azure portal.
- Select Databases and then select SQL Database.
- In the Create SQL Database form, type or select Database name, Subscription, Resource group, Select source>select OK.
- Under Server, select Create new.
- In the New server form, create Server name, location, admin Name and password
- Choose Select.
- On the SQL Database form, select Pricing tier. Explore the amount of DTUs and storage available for each service tier.
- For this quickstart, select the Standard service tier, and then use the slider to select DTUs (S0) and GB of storage.
- Select Apply.
- On the SQL Database form, select Create to deploy and provision the resource group, server, and database.
- Deployment takes a few minutes. You can select Notifications on the toolbar to monitor deployment progress.
- On the SQL Database page for your database, select Query editor (preview) in the left menu.
- Enter your login information, and select OK.
- Enter the following query in the Query editor pane. Select Run, and then review the query results in the Results pane.
SELECT TOP 20 pc.Name as CategoryName, p.name as ProductName
FROM SalesLT.ProductCategory pc
JOIN SalesLT.Product p
ON pc.productcategoryid = p.productcategoryid;
Assess your on-premises database:
- In the Data Migration Assistant, select the New (+) icon, and then select the Assessment project type.
- Specify a project name, in the Source server type text box, select SQL Server, in the Target server type text box, select Azure SQL Database, and then select Create to create the project.
- When you’re assessing the source SQL Server database migrating to a single database or pooled database in Azure SQL Database, you can choose one or both of the following assessment report types: Check database compatibility, Check feature parity, Both report types are selected by default.
- In the Data Migration Assistant, on the Options screen, select Next.
- On the Select sources screen, in the Connect to a server dialog box, provide the connection details to your SQL Server, and then select Connect.
- In the Add sources dialog box, select AdventureWorks2012, select Add, and then select Start Assessment.
Create a Database Migration Services instance:
- In the Azure portal, select + Create a resource, search for Azure Database Migration Service, and then select Azure Database Migration Service from the drop-down list.
- On the Azure Database Migration Service screen, select Create.
- On the Create Migration Service screen, specify a name for the service, the subscription, and a new or existing resource group.
- Select the location in which you want to create the instance of the Azure Database Migration Service.
- Select an existing virtual network (VNET) or create a new one.
- Select a pricing tier.
- Select Create to create the service.
Create a migration project:
- In the Azure portal, select All services, search for Azure Database Migration Service, and then select Azure Database Migration Services.
- On the Azure Database Migration Services screen, search for the name of the Azure Database Migration Service instance that you created, and then select the instance.
- Select + New Migration Project.
- On the New migration project screen, specify a name for the project, in the Source server type text box, select SQL Server, in the Target server type text box, select Azure SQL Database, and then for Choose type of activity, select Offline data migration or Online data migration.
- Select Create and run activity to create the project and run the migration activity
Specify Source On-premises SQL Database:
- On the Migration source detail screen, specify the connection details for the source SQL Server instance e.g. FQDN of SQL Server, admin name (domain name\username) and password.
- Click Encrypt Connection. Click Save.
Specify Target Azure SQL Database:
- On the Migration target details screen, specify the connection details for the target Azure SQL Database Server.
- Select Save, and then on the Map to target databases screen, map the source and the target database for migration.
- Select Save, on the Select tables screen, expand the table listing, and then review the list of affected fields.
- Select Save, on the Migration summary screen, in the Activity name text box, specify a name for the migration activity.
- Expand the Validation option section to display the Choose validation option screen, and then specify whether to validate the migrated databases for Schema comparison, Data consistency, and Query correctness.
- Select Save, review the summary to ensure that the source and target details match what you previously specified.
- Select Run migration.
- After the migration completes, select Download report to get a report listing the details associated with the migration process.
- Verify the target database(s) on the target Azure SQL Database server.
Monitor & Cutover to Azure SQL Database:
- On the migration activity screen, select Refresh to update the display until the Status of the migration shows as Running.
- Click on a specific database to get to the migration status for Full data load and Incremental data sync operations.
- When you’re ready to complete the database migration, select Start Cutover.
- Make sure to stop all the incoming transactions to the source database; wait until the Pending changes counter shows 0.
- Select Confirm, and the select Apply.
- When the database migration status shows Completed, connect your applications to the new target Azure SQL Database.