Back up SAP HANA databases in Azure VMs
SAP HANA databases are critical workloads that require a low recovery-point objective (RPO) and long-term retention. You can back up SAP HANA databases running on Azure virtual machines (VMs) by using Azure Backup.
This article shows how to back up SAP HANA databases that are running on Azure VMs to an Azure Backup Recovery Services vault.
In this article, you'll learn how to:
- Create and configure a vault
- Discover databases
- Configure backups
- Run an on-demand backup job
As of August 1st, 2020, SAP HANA backup for RHEL (7.4, 7.6, 7.7 & 8.1) is generally available.
Soft delete for SQL server in Azure VM and soft delete for SAP HANA in Azure VM workloads is now available in preview.
To sign up for the preview, write to us at AskAzureBackupTeam@microsoft.com.
Establish network connectivity
For all operations, an SAP HANA database running on an Azure VM requires connectivity to the Azure Backup service, Azure Storage, and Azure Active Directory. This can be achieved by using private endpoints or by allowing access to the required public IP addresses or FQDNs. Not allowing proper connectivity to the required Azure services may lead to failure in operations like database discovery, configuring backup, performing backups, and restoring data.
The following table lists the various alternatives you can use for establishing connectivity:
|Private endpoints||Allow backups over private IPs inside the virtual network
Provide granular control on the network and vault side
|Incurs standard private endpoint costs|
|NSG service tags||Easier to manage as range changes are automatically merged
No additional costs
|Can be used with NSGs only
Provides access to the entire service
|Azure Firewall FQDN tags||Easier to manage since the required FQDNs are automatically managed||Can be used with Azure Firewall only|
|Allow access to service FQDNs/IPs||No additional costs
Works with all network security appliances and firewalls
|A broad set of IPs or FQDNs may be required to be accessed|
|Use an HTTP proxy||Single point of internet access to VMs||Additional costs to run a VM with the proxy software|
More details around using these options are shared below:
Private endpoints allow you to connect securely from servers inside a virtual network to your Recovery Services vault. The private endpoint uses an IP from the VNET address space for your vault. The network traffic between your resources inside the virtual network and the vault travels over your virtual network and a private link on the Microsoft backbone network. This eliminates exposure from the public internet. Read more on private endpoints for Azure Backup here.
If you use Network Security Groups (NSG), use the AzureBackup service tag to allow outbound access to Azure Backup. In addition to the Azure Backup tag, you also need to allow connectivity for authentication and data transfer by creating similar NSG rules for Azure AD (AzureActiveDirectory) and Azure Storage(Storage). The following steps describe the process to create a rule for the Azure Backup tag:
In All Services, go to Network security groups and select the network security group.
Select Outbound security rules under Settings.
Select Add. Enter all the required details for creating a new rule as described in security rule settings. Ensure the option Destination is set to Service Tag and Destination service tag is set to AzureBackup.
Select Add to save the newly created outbound security rule.
You can similarly create NSG outbound security rules for Azure Storage and Azure AD. For more information on service tags, see this article.
Azure Firewall tags
If you're using Azure Firewall, create an application rule by using the AzureBackup Azure Firewall FQDN tag. This allows all outbound access to Azure Backup.
Allow access to service IP ranges
If you choose to allow access service IPs, refer to the IP ranges in the JSON file available here. You'll need to allow access to IPs corresponding to Azure Backup, Azure Storage, and Azure Active Directory.
Allow access to service FQDNs
You can also use the following FQDNs to allow access to the required services from your servers:
|Service||Domain names to be accessed|
|Azure AD||Allow access to FQDNs under sections 56 and 59 according to this article|
Use an HTTP proxy server to route traffic
When you back up an SAP HANA database running on an Azure VM, the backup extension on the VM uses the HTTPS APIs to send management commands to Azure Backup and data to Azure Storage. The backup extension also uses Azure AD for authentication. Route the backup extension traffic for these three services through the HTTP proxy. Use the list of IPs and FQDNs mentioned above for allowing access to the required services. Authenticated proxy servers aren't supported.
Create a Recovery Services vault
A Recovery Services vault is a management entity that stores recovery points created over time and provides an interface to perform backup related operations. These include taking on-demand backups, performing restores, and creating backup policies.
To create a Recovery Services vault, follow these steps.
Sign in to your subscription in the Azure portal.
On the left menu, select All services.
In the All services dialog box, enter Recovery Services. The list of resources filters according to your input. In the list of resources, select Recovery Services vaults.
The list of Recovery Services vaults in the subscription appears.
On the Recovery Services vaults dashboard, select Add.
The Recovery Services vault dialog box opens. Provide values for the Name, Subscription, Resource group, and Location.
Name: Enter a friendly name to identify the vault. The name must be unique to the Azure subscription. Specify a name that has at least 2 but not more than 50 characters. The name must start with a letter and consist only of letters, numbers, and hyphens.
Subscription: Choose the subscription to use. If you're a member of only one subscription, you'll see that name. If you're not sure which subscription to use, use the default (suggested) subscription. There are multiple choices only if your work or school account is associated with more than one Azure subscription.
Resource group: Use an existing resource group or create a new one. To see the list of available resource groups in your subscription, select Use existing, and then select a resource from the drop-down list. To create a new resource group, select Create new and enter the name. For more information about resource groups, see Azure Resource Manager overview.
Location: Select the geographic region for the vault. To create a vault to protect any data source, the vault must be in the same region as the data source.
If you're not sure of the location of your data source, close the dialog box. Go to the list of your resources in the portal. If you have data sources in multiple regions, create a Recovery Services vault for each region. Create the vault in the first location before you create the vault for another location. There's no need to specify storage accounts to store the backup data. The Recovery Services vault and Azure Backup handle that automatically.
After providing the values, select Review + create.
When you're ready to create the Recovery Services vault, select Create.
It can take a while to create the Recovery Services vault. Monitor the status notifications in the Notifications area at the upper-right corner of the portal. After your vault is created, it's visible in the list of Recovery Services vaults. If you don't see your vault, select Refresh.
We highly recommend you review the default settings for Storage Replication type and Security settings before configuring backups in the vault. For more information, see the Set Storage redundancy section.
Discover the databases
In the vault, in Getting Started, select Backup. In Where is your workload running?, select SAP HANA in Azure VM.
Select Start Discovery. This initiates discovery of unprotected Linux VMs in the vault region.
- After discovery, unprotected VMs appear in the portal, listed by name and resource group.
- If a VM isn't listed as expected, check whether it's already backed up in a vault.
- Multiple VMs can have the same name but they belong to different resource groups.
In Select Virtual Machines, select the link to download the script that provides permissions for the Azure Backup service to access the SAP HANA VMs for database discovery.
Run the script on each VM hosting SAP HANA databases that you want to back up.
After running the script on the VMs, in Select Virtual Machines, select the VMs. Then select Discover DBs.
Azure Backup discovers all SAP HANA databases on the VM. During discovery, Azure Backup registers the VM with the vault, and installs an extension on the VM. No agent is installed on the database.
Now enable backup.
In Step 2, select Configure Backup.
In Select items to back up, select all the databases you want to protect > OK.
In Backup Policy > Choose backup policy, create a new backup policy for the databases, in accordance with the instructions below.
After creating the policy, on the Backup menu, select Enable backup.
Track the backup configuration progress in the Notifications area of the portal.
Create a backup policy
A backup policy defines when backups are taken, and how long they're retained.
- A policy is created at the vault level.
- Multiple vaults can use the same backup policy, but you must apply the backup policy to each vault.
Azure Backup doesn’t automatically adjust for daylight saving time changes when backing up a SAP HANA database running in an Azure VM.
Modify the policy manually as needed.
Specify the policy settings as follows:
In Policy name, enter a name for the new policy.
In Full Backup policy, select a Backup Frequency, choose Daily or Weekly.
- Daily: Select the hour and time zone in which the backup job begins.
- You must run a full backup. You can't turn off this option.
- Select Full Backup to view the policy.
- You can't create differential backups for daily full backups.
- Weekly: Select the day of the week, hour, and time zone in which the backup job runs.
- Daily: Select the hour and time zone in which the backup job begins.
In Retention Range, configure retention settings for the full backup.
- By default all options are selected. Clear any retention range limits you don't want to use, and set those that you do.
- The minimum retention period for any type of backup (full/differential/log) is seven days.
- Recovery points are tagged for retention based on their retention range. For example, if you select a daily full backup, only one full backup is triggered each day.
- The backup for a specific day is tagged and retained based on the weekly retention range and setting.
- The monthly and yearly retention ranges behave in a similar way.
In the Full Backup policy menu, select OK to accept the settings.
Select Differential Backup to add a differential policy.
In Differential Backup policy, select Enable to open the frequency and retention controls.
- At most, you can trigger one differential backup per day.
- Differential backups can be retained for a maximum of 180 days. If you need longer retention, you must use full backups.
Incremental backups aren't currently supported.
Select OK to save the policy and return to the main Backup policy menu.
Select Log Backup to add a transactional log backup policy,
- In Log Backup, select Enable. This can't be disabled, since SAP HANA manages all log backups.
- Set the frequency and retention controls.
Log backups only begin to flow after a successful full backup is completed.
Select OK to save the policy and return to the main Backup policy menu.
After you finish defining the backup policy, select OK.
Each log backup is chained to the previous full backup to form a recovery chain. This full backup will be retained until the retention of the last log backup has expired. This might mean that the full backup is retained for an extra period to make sure all the logs can be recovered. Let's assume a user has a weekly full backup, daily differential and 2 hour logs. All of them are retained for 30 days. But, the weekly full can be really cleaned up/deleted only after the next full backup is available, that is, after 30 + 7 days. For example, a weekly full backup happens on Nov 16th. According to the retention policy, it should be retained until Dec 16th. The last log backup for this full happens before the next scheduled full, on Nov 22nd. Until this log is available until Dec 22nd, the Nov 16th full can't be deleted. So, the Nov 16th full is retained until Dec 22nd.
Run an on-demand backup
Backups run in accordance with the policy schedule. You can run a backup on-demand as follows:
- In the vault menu, select Backup items.
- In Backup Items, select the VM running the SAP HANA database, and then select Backup now.
- In Backup Now, choose the type of backup you want to perform. Then select OK. This backup will be retained according to the policy associated with this backup item.
- Monitor the portal notifications. You can monitor the job progress in the vault dashboard > Backup Jobs > In progress. Depending on the size of your database, creating the initial backup may take a while.
By default, the retention of on-demand backups is 45 days.
Run SAP HANA Studio backup on a database with Azure Backup enabled
If you want to take a local backup (using HANA Studio) of a database that's being backed up with Azure Backup, do the following:
- Wait for any full or log backups for the database to finish. Check the status in SAP HANA Studio / Cockpit.
- Disable log backups, and set the backup catalog to the file system for relevant database.
- To do this, double-click systemdb > Configuration > Select Database > Filter (Log).
- Set enable_auto_log_backup to No.
- Set log_backup_using_backint to False.
- Set catalog_backup_using_backint to False.
- Take an on-demand full backup of the database.
- Wait for the full backup and catalog backup to finish.
- Revert the previous settings back to those for Azure:
- Set enable_auto_log_backup to Yes.
- Set log_backup_using_backint to True.
- Set catalog_backup_using_backint to True.