Restore SAP HANA databases on Azure VMs
This article describes how to restore SAP HANA databases running on an Azure Virtual Machine (VM), which the Azure Backup service has backed up to a Recovery Services vault. Restores can be used to create copies of the data for dev / test scenarios or to return to a previous state.
For more information, on how to back up SAP HANA databases, see Back up SAP HANA databases on Azure VMs.
Restore to a point in time or to a recovery point
Azure Backup can restore SAP HANA databases that are running on Azure VMs as follows:
Restore to a specific date or time (to the second) by using log backups. Azure Backup automatically determines the appropriate full, differential backups and the chain of log backups that are required to restore based on the selected time.
Restore to a specific full or differential backup to restore to a specific recovery point.
Prerequisites
Before restoring a database, note the following:
You can restore the database only to an SAP HANA instance that's in the same region.
The target instance must be registered with the same vault as the source. Learn more.
Azure Backup can't identify two different SAP HANA instances on the same VM. So restoring data from one instance to another on the same VM isn't possible.
To ensure that the target SAP HANA instance is ready for restore, check its Backup readiness status:
To learn more about the restore types that SAP HANA supports, refer to the SAP HANA Note 1642148
Restore a database
To restore, you need the following permissions:
- Backup Operator permissions in the vault where you're doing the restore.
- Contributor (write) access to the source VM that's backed up.
- Contributor (write) access to the target VM:
- If you're restoring to the same VM, this is the source VM.
- If you're restoring to an alternate location, this is the new target VM.
In the Azure portal, go to Backup center and click Restore.
Select SAP HANA in Azure VM as the datasource type, select the database you wish to restore, and then click Continue.
Under Restore Configuration, specify where (or how) to restore data:
Alternate Location: Restore the database to an alternate location and keep the original source database.
Overwrite DB: Restore the data to the same SAP HANA instance as the original source. This option overwrites the original database.
Restore to alternate location
In the Restore Configuration menu, under Where to Restore, select Alternate Location.
Select the SAP HANA host name and instance name to which you want to restore the database.
Check if the target SAP HANA instance is ready for restore by ensuring its Backup Readiness. Refer to the prerequisites section for more details.
In the Restored DB Name box, enter the name of the target database.
Note
Single Database Container (SDC) restores must follow these checks.
If applicable, select Overwrite if the DB with the same name already exists on selected HANA instance.
In Select restore point, select Logs (Point in Time) to restore to a specific point in time. Or select Full & Differential to restore to a specific recovery point.
Restore and overwrite
In the Restore Configuration menu, under Where to Restore, select Overwrite DB > OK.
In Select restore point, select Logs (Point in Time) to restore to a specific point in time. Or select Full & Differential to restore to a specific recovery point.
Restore as files
Note
Restore as files doesn't work on CIFS share, but works for NFS.
To restore the backup data as files instead of a database, choose Restore as Files. Once the files are dumped to a specified path, you can take these files to any SAP HANA machine where you want to restore them as a database. Because you can move these files to any machine, you can now restore the data across subscriptions and regions.
In the Restore Configuration menu, under Where and how to Restore, select Restore as files.
Select the host / HANA Server name to which you want to restore the backup files.
In the Destination path on the server, enter the folder path on the server selected in step 2. This is the location where the service will dump all the necessary backup files.
The files that are dumped are:
- Database backup files
- JSON metadata files (for each backup file that's involved)
Typically, a network share path, or path of a mounted Azure file share when specified as the destination path, enables easier access to these files by other machines in the same network or with the same Azure file share mounted on them.
Note
To restore the database backup files on an Azure file share mounted on the target registered VM, make sure that root account has read/ write permissions on the Azure file share.
Select the Restore Point corresponding to which all the backup files and folders will be restored.
All the backup files associated with the selected restore point are dumped into the destination path.
Based on the type of restore point chosen (Point in time or Full & Differential), you'll see one or more folders created in the destination path. One of the folders named
Data_<date and time of restore>contains the full backups, and the other folder namedLogcontains the log backups and other backups (such as differential, and incremental).Note
If you've selected Restore to a point in time, the log files (dumped to the target VM) may sometimes contain logs beyond the point-in-time chosen for restore. Azure Backup does this to ensure that log backups for all HANA services are available for consistent and successful restore to the chosen point-in-time.
Move these restored files to the SAP HANA server where you want to restore them as a database.
Then follow these steps:
Set permissions on the folder / directory where the backup files are stored using the following command:
chown -R <SID>adm:sapsys <directory>Run the next set of commands as
<SID>admsu - <sid>admGenerate the catalog file for restore. Extract the BackupId from the JSON metadata file for the full backup, which will be used later in the restore operation. Make sure that the full and log backups (not present for Full Backup Recovery) are in different folders and delete the JSON metadata files in these folders.
hdbbackupdiag --generate --dataDir <DataFileDir> --logDirs <LogFilesDir> -d <PathToPlaceCatalogFile>In the command above:
<DataFileDir>- the folder that contains the full backups.<LogFilesDir>- the folder that contains the log backups, differential and incremental backups. For Full BackUp Restore, Log folder isn't created. Add an empty directory in that case.<PathToPlaceCatalogFile>- the folder where the catalog file generated must be placed.
Restore using the newly generated catalog file through HANA Studio or run the HDBSQL restore query with this newly generated catalog. HDBSQL queries are listed below:
To open hdsql prompt, run the following command:
hdbsql -U AZUREWLBACKUPHANAUSER -d systemDBTo restore to a point-in-time:
If you're creating a new restored database, run the HDBSQL command to create a new database
<DatabaseName>and then stop the database for restore using the commandALTER SYSTEM STOP DATABASE <db> IMMEDIATE. However, if you're only restoring an existing database, run the HDBSQL command to stop the database.Then run the following command to restore the database:
RECOVER DATABASE FOR <db> UNTIL TIMESTAMP <t1> USING CATALOG PATH <path> USING LOG PATH <path> USING DATA PATH <path> USING BACKUP_ID <bkId> CHECK ACCESS USING FILE<DatabaseName>- Name of the new database or existing database that you want to restore<Timestamp>- Exact timestamp of the Point in time restore<DatabaseName@HostName>- Name of the database whose backup is used for restore and the host / SAP HANA server name on which this database resides. TheUSING SOURCE <DatabaseName@HostName>option specifies that the data backup (used for restore) is of a database with a different SID or name than the target SAP HANA machine. So, it doesn't need to be specified for restores done on the same HANA server from where the backup is taken.<PathToGeneratedCatalogInStep3>- Path to the catalog file generated in Step C<DataFileDir>- the folder that contains the full backups<LogFilesDir>- the folder that contains the log backups, differential and incremental backups (if any)<BackupIdFromJsonFile>- the BackupId extracted in Step C
To restore to a particular full or differential backup:
If you're creating a new restored database, run the HDBSQL command to create a new database
<DatabaseName>and then stop the database for restore using the commandALTER SYSTEM STOP DATABASE <db> IMMEDIATE. However, if you're only restoring an existing database, run the HDBSQL command to stop the database:RECOVER DATA FOR <DatabaseName> USING BACKUP_ID <BackupIdFromJsonFile> USING SOURCE '<DatabaseName@HostName>' USING CATALOG PATH ('<PathToGeneratedCatalogInStep3>') USING DATA PATH ('<DataFileDir>') CLEAR LOG<DatabaseName>- the name of the new database or existing database that you want to restore<Timestamp>- the exact timestamp of the Point in time restore<DatabaseName@HostName>- the name of the database whose backup is used for restore and the host / SAP HANA server name on which this database resides. TheUSING SOURCE <DatabaseName@HostName>option specifies that the data backup (used for restore) is of a database with a different SID or name than the target SAP HANA machine. So it need not be specified for restores done on the same HANA server from where the backup is taken.<PathToGeneratedCatalogInStep3>- the path to the catalog file generated in Step C<DataFileDir>- the folder that contains the full backups<LogFilesDir>- the folder that contains the log backups, differential and incremental backups (if any)<BackupIdFromJsonFile>- the BackupId extracted in Step C
To restore using backup ID:
RECOVER DATA FOR <db> USING BACKUP_ID <bkId> USING CATALOG PATH <path> USING LOG PATH <path> USING DATA PATH <path> CHECK ACCESS USING FILEExamples:
SAP HANA SYSTEM restoration on same server
RECOVER DATABASE FOR SYSTEM UNTIL TIMESTAMP '2022-01-12T08:51:54.023' USING CATALOG PATH ('/restore/catalo_gen') USING LOG PATH ('/restore/Log/') USING DATA PATH ('/restore/Data_2022-01-12_08-51-54/') USING BACKUP_ID 1641977514020 CHECK ACCESS USING FILESAP HANA tenant restoration on same server
RECOVER DATABASE FOR DHI UNTIL TIMESTAMP '2022-01-12T08:51:54.023' USING CATALOG PATH ('/restore/catalo_gen') USING LOG PATH ('/restore/Log/') USING DATA PATH ('/restore/Data_2022-01-12_08-51-54/') USING BACKUP_ID 1641977514020 CHECK ACCESS USING FILESAP HANA SYSTEM restoration on different server
RECOVER DATABASE FOR SYSTEM UNTIL TIMESTAMP '2022-01-12T08:51:54.023' USING SOURCE <sourceSID> USING CATALOG PATH ('/restore/catalo_gen') USING LOG PATH ('/restore/Log/') USING DATA PATH ('/restore/Data_2022-01-12_08-51-54/') USING BACKUP_ID 1641977514020 CHECK ACCESS USING FILESAP HANA tenant restoration on different server
RECOVER DATABASE FOR DHI UNTIL TIMESTAMP '2022-01-12T08:51:54.023' USING SOURCE <sourceSID> USING CATALOG PATH ('/restore/catalo_gen') USING LOG PATH ('/restore/Log/') USING DATA PATH ('/restore/Data_2022-01-12_08-51-54/') USING BACKUP_ID 1641977514020 CHECK ACCESS USING FILE
Restore to a specific point in time
If you've selected Logs (Point in Time) as the restore type, do the following:
Select a recovery point from the log graph and select OK to choose the point of restore.

On the Restore menu, select Restore to start the restore job.

Track the restore progress in the Notifications area or track it by selecting Restore jobs on the database menu.

Restore to a specific recovery point
If you've selected Full & Differential as the restore type, do the following:
Select a recovery point from the list and select OK to choose the point of restore.

On the Restore menu, select Restore to start the restore job.

Track the restore progress in the Notifications area or track it by selecting Restore jobs on the database menu.

Note
In Multiple Database Container (MDC) restores after the system DB is restored to a target instance, one needs to run the pre-registration script again. Only then the subsequent tenant DB restores will succeed. To learn more refer to Troubleshooting – MDC Restore.
Cross Region Restore
As one of the restore options, Cross Region Restore (CRR) allows you to restore SAP HANA databases hosted on Azure VMs in a secondary region, which is an Azure paired region.
To onboard to the feature, read the Before You Begin section.
To see if CRR is enabled, follow the instructions in Configure Cross Region Restore
View backup items in secondary region
If CRR is enabled, you can view the backup items in the secondary region.
- From the portal, go to Recovery Services vault > Backup items.
- Select Secondary Region to view the items in the secondary region.
Note
Only Backup Management Types supporting the CRR feature will be shown in the list. Currently, only support for restoring secondary region data to a secondary region is allowed.


Restore in secondary region
The secondary region restore user experience will be similar to the primary region restore user experience. When configuring details in the Restore Configuration pane to configure your restore, you'll be prompted to provide only secondary region parameters. A vault should exist in the secondary region and the SAP HANA server should be registered to the vault in the secondary region.


Note
- After the restore is triggered and in the data transfer phase, the restore job can't be cancelled.
- The role/access level required to perform restore operation in cross-regions are Backup Operator role in the subscription and Contributor(write) access on the source and target virtual machines. To view backup jobs, _ Backup reader_ is the minimum premission required in the subscription.
Monitoring secondary region restore jobs
In the Azure portal, go to Backup center > Backup Jobs.
Filter Operation for value CrossRegionRestore to view the jobs in the secondary region.
Next steps
- Learn how to manage SAP HANA databases backed up using Azure Backup
Povratne informacije
Pošalјite i prikažite povratne informacije za