SAP HANA Backup Based on Storage Snapshots
It is recommended to apply this backup method to non-production systems. Cloud Server Backup Service (CSBS) and Volume Backup Service (VBS) are used to create snapshots for one or multiple volumes of SAP HANA. The volume snapshots are backed up and automatically uploaded to an OBS bucket. Figure 1 shows the process for backing up SAP HANA volumes based on storage snapshots.
With this backup method, you can quickly back up and restore data without affecting the system. However, to ensure the data consistency when SAP HANA is running is crucial. Compared with file-based backup, the backup based on storage snapshots does not have a specific tool to check the consistency of backup data. Therefore, exercise caution when using this backup method. This method applies to the scenarios where there is no strict requirement for data consistency or backup can be performed when the system is stopped. After data is backed up using storage snapshots, you are advised to periodically perform data recovery drills to restore backup data to a new system and check whether the backup data is complete and valid.
For details about the SAP HANA database and storage snapshots, see SAP Note 2039883.
The processes for storing snapshots of SAP HANA are as follows:
- Prepare SAP HANA snapshots
- Create snapshots for EVS disks of SAP HANA.
- Confirm the snapshots
HUAWEI CLOUD CSBS supports the database server backup in the process of creating SAP HANA storage snapshots.
The backup processes are as follows:
- Prepare SAP HANA snapshots
- Freeze the file system of the SAP HANA data volume (for example, run the xfs_freeze command).
- Create snapshots for EVS disks, such as the EVS disk where the SAP HANA data volume resides, based on user requirements.
- Unfreeze the file system of the SAP HANA data volume (for example, run the xfs_freeze command).
- Confirm the snapshots
- Backup the stored snapshots and upload them to the OBS bucket.
The restoration processes are as follows:
- Stop ECSs.
- Detach EVS disks from ECSs.
- Restore the EVS disks using backup files.
- Attach the EVS disks to the ECSs.
- Start ECSs.
- You can use SAP HANA Studio, SAP HANA SQL statements, or SAP HANA Cockpit to restore the database.
The following uses HUAWEI CLOUD ECS as an example to describe how to perform snapshot-based backup and restoration.
In this example, data in the data volume is lost and we need to use data volume snapshots, log volume data, and log volume backups to restore SAP HANA to the most recent state.
Table 1 lists the required information in the example.
| Item | Example Value |
|---|---|
| SAP HANA ECS host name | hwchana |
| SAP HANA version | SAP HANA Platform Edition 2.0 SPS03 Rev30 |
| SID | HWC |
| Instance ID | 02 |
| Data volume path | /hana/data |
| Log volume path | /hana/log |
| Log backup path | /hana/backup/log |
Backup Processes
- Follow the operations described in the SAP official documents to install SAP HANA and SAP HANA Studio. Open SAP HANA Studio and configure the log backup path.


- Switch to the <sid>adm user and create a storage key for the SYSTEM user to run the hdbsql command such as:
hdbuserstore set SYSTEMDB hwchana:30213 SYSTEM <yourpassword>
- Install the Agent required for the database server backup feature of CSBS. For details about how to configure the Agent, see Using a Custom Script to Implement Consistent Backup for SAP HANA.
- Use SAP HANA Studio to create a table for system database and tenant database and insert a sample data record into each table.
- System database
Run the following commands to create a table and insert a sample data record into each table:
create table test_table_system (id int, name char(50));
insert into test_table_system values (01, 'before snapshot');

- Tenant database
Run the following commands to create a table and insert a sample data record into each table:
create table test_table_tenant (id int, name char(50));
insert into test_table_tenant values (01, 'before snapshot');

- System database
- When using CSBS to back up SAP HANA ECSs, select Immediate Backup and Database Server Backup. In this example, only the data volume is backed up.


- Verify that the backup is successful on the CSBS console and SAP HANA Studio.


- After the backup is complete, insert another data record into system database and tenant database.
- System database
Run the insert into test_table_system values (02, 'after snapshot'); command to insert another data record into system database.

- Tenant database
Run the insert into test_table_tenant values (02, 'after snapshot'); command to insert another data record into tenant database.

- System database
- Run the following command to delete the data volume:
rm /hana/data/* -rf
This operation is a high-risky operation and used to simulate a fault in the example. Do not perform this operation in your SAP system.
Restoration Processes
- On the console of CSBS, locate the SAP HANA ECS and click Restore Data in the Operation column. This operation will stop the SAP HANA ECS and restore the data volume to the point in time when the backup was performed.


- After the restoration is complete, start the SAP HANA ECS to view the data volume data. Files whose names start with snapshot exist in the data volume, which indicates the data volume is restored to the time when the backup was performed.

- Run the following command to restore the system database to a future point in time, that is, the most recent state:
HDBSettings.sh recoverSys.py --command="RECOVER DATABASE UNTIL TIMESTAMP '2020-01-01 00:00:00' USING SNAPSHOT;"

After the restoration, the system database automatically starts. Then, you can run the hdbsql command or use SAP HANA Studio to perform the following operations.
- Run the hdbsql -jU SYSTEMDB 'alter system stop database HWC' command to stop the tenant database and the hdbsql -jU SYSTEMDB "RECOVER DATABASE FOR HWC UNTIL TIMESTAMP '2020-01-01 00:00:00' USING SNAPSHOT;" command to restore the tenant database to a future point in time, that is, the most recent state.
hdbsql -jU SYSTEMDB 'alter system stop database HWC'
hdbsql -jU SYSTEMDB "RECOVER DATABASE FOR HWC UNTIL TIMESTAMP '2020-01-01 00:00:00' USING SNAPSHOT;"

- Users can use the HDB start command to start SAP HANA before the tenant database is restored, which makes snapshots invalid. To prevent existing snapshots from becoming invalid, you are advised to run the following command to disable automatic startup of the tenant database:
hdbsql -jU SYSTEMDB 'ALTER DATABASE HWC NO RESTART'
You can also perform this operation on SAP HANA Studio to restore the database to the most recent state. For example:






- Log in to SAP HANA Studio and query the data in system and tenant databases after restoration.
If the data is restored to the latest backup state before the fault, the restoration is successful.


Last Article: File-based SAP HANA Backup
Next Article: SAP HANA Backup Using a Third-party Software

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.