SAP HANA is an in-memory database. New and changed data is written first to the SAP HANA memory, from where it is copied to the database persistence.
SAP HANA protects the database from power failures using its log area, frequent log area backups, and database savepoints (periodic save-to-disk of the newest data in the database). These all help to ensure that when the lights go out, the database is in a coherent state and can be safely recovered when the server is switched back on.
Unfortunately, what SAP HANA cannot protect against is a loss of the database persistence itself. Protection from the loss of database persistence requires regular database backups.
Hitachi Data Systems provides a backup tool for regular database backups: Hitachi Data Instance Director (HDID). This tool fully integrates with single-node SAP HANA databases to provide database snapshot-based backups on Hitachi Thin Image pools on Hitachi storage systems.
Data Instance Director can be used with many applications. Using HDID alongside a SAP HANA database allows the following three main functions:
- Database backup and restore using HDID snapshots
- Database backup and restore using HDID snapshots, plus SAP HANA log backup replay
- Database copy (production to non-production, for example), using HDID snapshots
Database Backup, Restore Points, and Data Loss
One of the most important concepts to consider when implementing a backup policy is the recovery point objective — or RPO. This concept determines how much data might be lost in case of failure. If the RPO is one hour, then up to one hour’s data might be lost. Backing up with a lower RPO protects the database better, but also creates a higher load on the system. The following graphic describes the different backup and restore options available in a SAP HANA system.
The illustration above shows that, in case of failure, having the following can restore the complete database:
- A database snapshot or a full backup
- Log area backups
- The log area itself, for the log entries not present in the latest log area backup
HDID can protect your SAP HANA database by creating backups of the first two of these items.
Database Backup and Restore Using HDID Snapshots
Hitachi Data Instance Director can create a snapshot of the SAP HANA data area, using the native ‘savepoint’ feature of SAP HANA itself. This adds very little overhead to the running system. This ‘savepoint’ occurs every five minutes (by default). These savepoint snapshots are then copied to a Hitachi Thin Image pool on the attached Hitachi storage system.
If a database restore becomes necessary, then HDID can do the following:
- Stop the running SAP HANA instance
- Revert the SAP HANA data area with a copy of the snapshot
The database can then be restored using the standard SAP HANA restore tools (SAP HANA Studio, or using the command line). Snapshot-based backups allow the database to be restored to the date and time the snapshot was taken.
Database Backup and Restore Using HDID Snapshots, Plus SAP HANA Log Backup Replay
For a more fine-grained backup policy, use Hitachi Data Instance Director to backup the log backup files for SAP HANA. Every five minutes or so, SAP HANA makes a backup of its redo-log area. These log backup files can be used, if present on the SAP HANA system, to allow a database restore to a more fine-grained time than only the snapshot date and time.
Using HDID to create backups of these log area backup files, alongside regular database snapshots, can allow the effective RPO of the backup to be as low as five minutes. It is not possible to back up the SAP HANA log area itself. This limitation exists in SAP HANA, because the database locks the files for its exclusive use. Only the log area backups can be saved by HDID.
Database backup using snapshots plus log area backups allows more fine-grained backup and restore times. During a database restore, the following happens:
- Restores the SAP HANA data area and snapshot using HDID
- Restores the log area backup files to their original locations (or another directory if preferred), again using HDID
- Performs the database restore using the standard SAP HANA tools
The database snapshot is the basis for the restore. The log backups taken after the snapshot date and time are read automatically by the restore process.
Database Copy Using HDID Snapshots
While the main use of a database backup is to protect the installed applications from catastrophic data loss, one additional use case is system copy.
During a project lifecycle, it can be useful from time to time to refresh development and preproduction environments with a copy of the production database. Then you can use this copy for performance tests on comparable data volumes in the preproduction environment. Or, you can perform regression rests on real-life situations without impacting the production system.
Hitachi Data Instance Director can make the SAP HANA database snapshot visible to a second host. This makes replacing the SAP HANA data area in development or preproduction with the contents of the snapshot into a simple operation. You can do this with only a couple of commands under Linux.
Using Hitachi Data Instance Director, you can implement efficient backup and restore policies for your SAP HANA database, and even use it to make copies of your SAP HANA database.
To learn more about using Hitachi Data Instance Director on a scale-up SAP HANA database, please check the following implementation guide from Hitachi Data Systems: https://www.hds.com/en-us/pdf/white-paper/hdid-backup-for-scale-up-databases-on-sap-hana.pdf