Migrate SQL Server database from Azure to AWS - azure

I need to migrate a SQL Server database from Azure to AWS. I've tried to create a backup on Azure but it seems that option is not available, not even through a script.

I don't know if exists an option to backup in Azure, as you said. However, you can export your database to a .BACPAC file and import it in a local instance of SQL Server. Then you can create a .bak file from this database to export to the AWS.
To export your database to a bacpac file, you can follow this documentation:
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-export

You have at least a few options here:
You can indeed create a backup in Azure. The backup file will get stored in a Storage account you set up. You can then download this and transfer it to your AWS VM (or RDS services) and restore it. I believe the manual backup you create in Azure is in the form of a .BACPAC file, which is just a compressed backup file.
You can create an empty database in AWS, sync the two schemas using something like RedGate or SSDT (which is free) and then use SSIS to move the data over. Or you could use scripts if you wanted. This would be a better option if you wanted to move your data over piecemeal.
You can use features in SSMS to copy the database directly from Azure and directly to AWS. Personally though I've never had a great deal of luck moving databases like this.

Related

Apply local DB changes to Azure SQL Database

I have a backup file that came from Server A and I copied that .bak files into my local and setup that DB into my Sql Server Management Studio. Now After setting it up I deployed it in Azure Sql Database. But now there were change in the Data in Server A because it's still being used, so I need to get all those changes to the Azure SQL Database that I just deployed. How am I going to do that?
Note: I'm using Azure for my server and I have a local copy of Server A database. So basically in terms of data and structure my local and the previous Server A db is the same. But after a few days Server A data is now updated and my local DB is still the same as when I just backup the db in Server A.
How can I update the DB in Azure to take all the changes in Server A and deploy it in Azure?
You've got a few choices. It's just about migrating data. It's also a question of which data you're going to migrate. Let's say it's a neat, complete replacement. Then, I'd suggest looking at the bacpac mechanism. That's a way to export a database, it's structure and data, then import it into a new location. This is one mechanism of moving to Azure.
If you can't simply replace everything, you need to look at other options. First, there's SSIS. You can build a pipeline to move the data you need. There's also export and import through sqlcmd, which can connect to Azure SQL Database. You can also look to a third party tool like Redgate SQL Data Compare as a way to pick and choose the data that gets moved. There are a whole bunch of other possible Extract/Transform/Load (ETL) tools out there that can help.
Do you want to sync schema changes as well as Data change or just Data? If it is just Data then the best service to be used would be Azure Data Migration Service, where this service can help you copy the delta with respect to Data to Azure incrementally, both is online and offline manner and you can also decide on the schedule.

Azure Sql Database back up files

We are new to Azure SQL Database and doing some research about the backup files. I have few questions related to SQL Database.
1) I read that Azure has built-in backup capabilities. I don't see the back up files in the azure portal. We want to use the automated backup files and restore the database in our local environments. Is there any way to access the back up files.
2) I used the SQLPackage.exe command to export the database to my local machine. With this approach it is only allowing me to export a bacpac file. Is there anyway other way to take backup files with extension of .bak
The overall goal is to take a weekly full backup and daily differential backups, which would allow us to restore the database in local. Please suggest us the best options to do so.
Thanks in advance.
We want to use the automated backup files and restore the database in our local environments. Is there any way to access the back up files.
No, you cannot access the backup files directly. In SQL Sever you can't restore a backup file to an older version of SQL Server, and Azure SQL Database is generally newer than any SQL Server you could install. So you wouldn't be able to restore them anyway.
I read that Azure has built-in backup capabilities. I don't see the back up files in the azure portal. We want to use the automated backup files and restore the database in our local environments. Is there any way to access the back up files.
We can see the backup on Portal: SQL Server--> Manage Backups, but we can not access the backup files and use the automated backup files to restore the database in your local environments.
I used the SQLPackage.exe command to export the database to my local machine. With this approach it is only allowing me to export a bacpac file. Is there anyway other way to take backup files with extension of .bak
For Azure SQL Database, it doesn't provide a native way to generate '.bak' format backup file. You could reference:How to create BAK file from azure sql db.
About your goal, you should using some scripts to schedule backup the database to blob, then you can use the backup to restore the database in local.
Here two ways can help you:
Powershell scripts: Backup Azure SQL Databases to Blob storage: This Azure Automation runbook automates Azure SQL database backup to Blob storage and deletes old backups from blob storage.
Tool Database Backup Tool: SQLBackupAndFTP is SQL Server, MySQL
and PostgreSQL backup software that runs scheduled backups (full,
differential or transaction log) of SQL Server or SQL Server Express
databases (any version), runs file/folder backup, zips and encrypts
the backups, stores them on a network or on an FTP server or in the
cloud (Amazon S3 and others we're constantly adding more), removes
old backups, and sends an e-mail confirmation on the job's success
or failure.
Hope this helps.

Cannot see long-term backup files for Azure SQL

If I select to restore my Azure SQL database, I can choose from a large number of long-term backup files.
However, I just want to download those files locally.
I cannot see where I can access these files.
The Azure docs suggest that I click on the 'Manage Backups' link.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-long-term-backup-retention-configure
I cannot see this link though.
Has anyone any idea where I can access these files?
You cannot restore those backup files to a local computer because this is a service managed by Azure.
What you can do is restore to a point-in-time which will create a new database, then export that database as bacpac to your local computer, and remove the newly created database once is no longer needed.
SqlPackage /Action:Export /SourceServerName:SampleSQLServer.sample.net,1433 /SourceDatabaseName:RestoredDatabase /TargetFile:"F:\Temp\RestoredDatabase.bacpac"

How to backup Azure SQL that will withstand deletion of azure server

Azure SQL has built in backups. If the SQL database and server are deleted from within the Portal these backups are lost.
What is best practice for backing up Azure SQL that will withstand deletion of the server from the portal.
I have manually exported the database to a storage location, however Azure says that this should not be used as a backup. Why should it not be used and what should I be doing instead?
If you want a direct control over your backups, then the best mechanism is fairly straight forward.
Create a copy of your database. This ensures no active transactions because it's a copy.
Use the BACPAC process to export the copy of the database. BACPAC doesn't respect transactions, this is why we created a copy.
Store this where ever you want.
Drop the copy of the database because you're paying for that while it exists.
You can use the BACPAC to import into a new Azure database, or you can import it into a VM in Azure, AWS, or locally.
Azure SQL has built in backups. If the SQL database and server are
deleted from within the Portal these backups are lost.
Yes,If you delete the Azure SQL server that hosts SQL Databases, all databases that belong to the server are also deleted and cannot be recovered. You cannot restore a deleted server.
What is best practice for backing up Azure SQL that will withstand
deletion of the server from the portal.
If your Azure SQL Server has been deleted, you need to create a support ticket to restore the databases.
When you really need to delete a SQL sever and then try to back up it, You can configure the Azure Recovery Services vault to store Azure SQL database backups and then recover a database using backups retained in the vault using the Azure portal or PowerShell.
Why should it not be used and what should I be doing instead?
I think you can export your database to your local storage , but it's complex to restore it to Azure. Also, it may change some information of your SQL database and may need migration to Azure.
Well, there is no real answer to this, you can use any backup method you like. Its mostly a personal preference.
But the easiest way (probably) is using Azure Backup Vault to do long term backups (which is a native way for Azure). Its pretty easy to configure (next\next\next) and it is not connected to the Azure SQL Server, so when you delete the server the backups are there.

Best practice to upgrade a SQL Azure DB?

I am trying to upgrade an Azure DB in a continuous release scenario. The DB lives in SQL Azure and its size keeps growing. Now it's about > 50G. In my previous on-premise experience, I usually backup the old DB in a compressed format and save it to an on-premise file sever. In case the upgrade fail, I can restore it safely.
But with SQL Azure, I am not sure if it's OK to download such a big DB from SQL Azure. And is there any best practice for the SQL Azure DB upgrade scenario?
ADD
I found this link regarding different SQL Azure backup strategies. But it'll be great if someone can share some field experiences.
Azure now has automatic exports (aka full backups) to blob storage that you can schedule. The .bacpac files are complete compressed copies of your database and blob storage is pretty cheap. To give you an idea of size we have a 20GB database that is backed up to only 500 MB. We typically keep 14 days of backups but how long to retain them is up to your needs.
It's kind of like the Ron Popeil Rotisserie. You just set it, and forget it.
Obviously after you take a backup you want to restore it somewhere else to verify it worked. It's also a good idea to periodically restore your backups to make sure they working over time. You can do all of this in the Azure Portal. Just create a new database based on a .bacpac file that you created from the automated export.
You actually don't have to download the DB on premise unless you want another copy locally. Because if you are using geo-redundant blob storage its already copied to another region and you have 6 copies in total. But again its up to you.
When you log into the management portal navigate to the Sql Database tab. Click on your DB and then click configure. There you can set up automated backups for your db to blob storage.
The path on the management portal looks like this:
https://manage.windowsazure.com/mycompany.com#Workspaces/SqlAzureExtension/SqlServer/coolazuredb/Database/5.coolazuredb/Config
Here is a screenshot of the automated export section:

Resources