SQL Server Database to SQL Server Migration on Azure

SQL Server Database to SQL Server Migration on Azure

Even though there are different methods you can try migrating SQL Server Database to SQL Server Migration on Azure, we recommend migrating the database files to the Azure VM using a compressed backup file for best data transfer. During migration you could face some downtime so in order to reduce the downtime use any of these options – the Always On or the transactional replication option, If not migrate your database manually.

Take a database back and then have a copy of the database backup into Azure, and then restore the database, like this you can manually migrate a database into an Azure VM.

Methods for primary migration:

Method 1: Back up to URL and restore it to Azure VM from URL.

Source & Destination database version: SQL Server 2012 SP1 CU2 or higher

Size limitation for source database backups: < 12.8 TB for SQL Server 2016 or < 1 TB

Note: This method is used for transferring the backup file to the VM via Azure storage.

Method 2: Compress the on-premises backup and manually copy it into the Azure VM.

Source & Destination database version: SQL Server 2005 or higher

Size limitation for source database backups: Azure VM storage limit

Note: Moving databases between machines is made easy with a method. 

Method 3: Isolate and move your database and log files to Azure Blob storage/ Azure storage and then attach the database to SQL Server in Azure VM from URL.

Source database version: SQL Server 2005 or higher

Destination database version: SQL Server 2014 or higher

Size limitation for source database backups: Azure VM storage limit

Note: If you have a plan to store the files in Azure Blob storage and attach them into SQL Server running in an Azure VM, especially when your database is larger then follow this method.

Method 4:  Convert on-premises machines to Hyper-V VHDs, upload them to Azure Blob storage, and by using uploaded VHD, deploy a new virtual machine.

Source & Destination database version: SQL Server 2005 or higher

Size limitation for source database backups: Azure VM storage limit

Note: Use if you have your SQL Server license and if you’re migrating a database with an older version of SQL Server, or if you’re migrating system and user databases simultaneously since one user database or system database depends on another user database or system database.

Method 5: Use Windows Import/Export Service to send a hard drive.

Source & Destination database version: SQL Server 2005 or higher

Size limitation for source database backups: Azure VM storage limit

Note: If manual copying takes too long with a large database, use the Windows Import/Export Service.

Method 6: Use the Add Azure Replica Wizard

Source & Destination database version: SQL Server 2012 or higher

Size limitation for source database backups: Azure VM storage limit

Note: Utilize when you have an Always ON on-premises deployment to reduce downtime.

Method 7: Use transactional replication in SQL Server.

Source & Destination database version: SQL Server 2005 or higher

Size limitation for source database backups: Azure VM storage limit

Note: If you need to reduce downtime but don’t have an Always ON on-premises deployment, use this method.

Back-Up and Restore

Compress your database backup, transfer the backup to VM, and then restore it. The maximum size of a VM disc is 1 TB, so if your backup file is larger than that, you must create a striped unit.

Steps to migrate a user database manually,

  • Back up the entire database to an on-premises location.
  • Create or submit a VM with the preferred SQL Server version.
  • Configure connectivity according to your requirements.
  • Use the copy command from a command prompt, remote desktop, or Windows Explorer to copy your backup files to your VM.

Backup to URL and Restore from URL: 

You can use Backup to URL and then restore it from URL to the VM as an alternative to backing up to a local file. Use of the Windows Import/Export Service is recommended for large databases.

Isolate and reattach from a URL

  • Steps to migrate a user database manually,
  • First, isolate the database files out of the on-premises database instance.
  • Using AZCopy, copy the isolated database files to Azure Blob storage.
  • Then, attach the database files in Azure VM from the URL to the SQL Server instance.

Migrate all system & user databases

To migrate complete SQL Server instance:

  • Convert physical/virtual machines to Hyper-V VHDs.
  • Upload VHD files to Azure Storage – using the Add-AzureVHD cmdlet.
  • Add a new VM using the uploaded VHD.

To migrate large amounts of the data file to Azure Blob storage, you can use Windows Import/Export Service method.

Check: 7 Ways to Optimize High-Traffic in MySQL

To get more updates you can follow us on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox