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.
1 2 | CREATE CREDENTIAL [https://storagearcsqlbackup.blob.core.windows.net/backup] WITH IDENTITY = ‘SHARED ACCESS SIGNATURE’, SECRET = ‘sv=thatbigandrandomstring&someofthe=dates&will=bethere&aswell=asthe’; |
We made the definition of Credentials. Now let’s create an empty database named “DMC” for test operations.
1 | Create Database DMC; |
We created the DMC database. Now let’s take this database backup with the credentials we created.
1 2 3 | BACKUP DATABASE [DMC] TO URL = N'https://storagearcsqlbackup.blob.core.windows.net/backup/dmc_backup.bak' WITH NOFORMAT, NOINIT, NAME = N'DMC-Full Database Backup', NOSKIP, NOREWIND, NOUNLOAD, STATS = 10 |
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.
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.
1 2 3 | RESTORE DATABASE [DMC] FROM URL = N'https://storagearcsqlbackup.blob.core.windows.net/backup/dmc_backup.bak' WITH FILE = 1, MOVE N'DMC' TO N'/var/opt/mssql/data/DMC.mdf', MOVE N'DMC_log' TO N'/var/opt/mssql/data/DMC_log.ldf', NOUNLOAD, STATS = 5 |
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.
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.