Sunday , June 16 2024

Migrate Azure SQL Database To Managed Instance

In this article, I will be answering the question of how you can migrate an existing database backup to Arc Managed Instance.

You will be able to migrate to Arc SQL Managed instance using backup / restore within your organization.

You can find this issue as lift & shift in Microsoft documents.

If we want to restore an existing database to Azure SQL Managed Instance with Azure Arc and do some work later, we first need to put a backup of our database in the container or the storage we host in the container.

Accordingly, since SQL Managed Instance is the Azure version of SQL Server, you can use a standard database backup in the migration process.

In my example in the article, I will be using my managed instance named “dmcsqlmi” as in my other articles.

If you want to find out which container or pod is in your own structure, it would be useful to take a look at my previous articles about arc-enabled data services.

There are multiple ways to get our backups to Arc SQL Managed instance, and you will find the easiest and most applicable one in this article.

Azure Blob Storage

If you have a database that you want to move to Arc SQL Managed instance, the best way is to backup your SQL Server to Azure Blob Storage.

The only thing you will need to import your backups that come with SQL Server 2016 to Azure Blob Storage is actually a SAS key.

If you have a SAS key, you can create a credentials in SQL Server and take your backups to blob storage.

Of course, you do not have to take your direct backups from SQL Server to blob storage.

You can also use different transfer methods. An example Credentials definition is as follows.

We made the definition of Credentials. Now let’s create an empty database named “DMC” for test operations.

We created the DMC database. Now let’s take this database backup with the credentials we created.

Picture1 : Result of backup operation

As you can see, we have successfully completed the backup process. Now let’s check it over Azure Blob Storage.

In order to perform this operation, you can either use the Azure Storage Explorer application or check it through SQL Server Management Studio. We are looking through SSMS.

After opening SSMS, we click on the arrow next to Connect from the Object Explorer window on the left and select Azure Storage.

If you have logged in before, Azure will not ask you to log in to your account, but if you have not logged into your Azure account before, it will ask you to log in to your account.

Picture3: Ensuring backup accuracy

Yes, we have successfully completed the backup.

Now, we run the credential we created for the backup operation on the Arc SQL Managed instance again on the Arc SQL Managed instance.

After the run, I restore the DMC Database with the following code block.

Picture4: Restore operation log result

As you can see in Picture4, while performing the Restore process, we also performed the version information in parallel with the upgrade process, and we successfully completed the restore process.

Picture5: Restore is successful

By using Azure Blob Storage, you move your build to Arc SQL Managed Instance without the need for Kubernetes and infrastructure-level storage.

If you are using one of the previous versions in SQL Server 2016 version, let me tell you that as of July 13, 2021, the support for SQL Server 2016 version ends.

However, if you want to migrate to versions before 2016, if you transfer your backups to kubernetes, you will not have a problem migrating to Arc SQL Server Managed instance.


About Çağlar Özenç

Leave a Reply

Your email address will not be published. Required fields are marked *