Data snapshots offer an additional option to backup and restore SAP HANA databases. A data snapshot captures the state of the data volume on the storage system at a particular point in time. A data snapshot includes all the data that is required to recover an SAP HANA system to a consistent state.
Data Snapshot Benefits
Data snapshots have a minimal impact on the database system, because they are created in the storage system and do not consume database resources.
Recovery from a data snapshot is fast because the data snapshot is already available in the data area of the storage system, no need to copy data from the backup server to the storage system.
For a recovery based on a data snapshot, you can also use delta backups and log backups in the same way as with a recovery based on a data backup.
Important Points to Know About Data Snapshot
If you are planning a backup strategy that makes use of data snapshots, you should be aware of several important points.
To create a data snapshot, first an internal database snapshot is created. This internal database snapshot provides a frozen consistent state of the database at the point in time that it was started. This is particularly important if multiple storage volume groups are involved.
Data snapshots can only be created through the system database.
During a data snapshot the SAP HANA database system is online, and all the configured services are running.
To create a data snapshot, you must use native SQL.
Recovery from a data snapshot is supported by SAP HANA cockpit.
Whereas a data backup is written to a separate storage location, a data snapshot must be manually stored in a location that is physically separate from the SAP HANA data area.
The responsibility of the integrity of the storage snapshot lies with the storage vendor. SAP HANA cannot check the integrity of the storage snapshot on the storage system.
An SAP HANA database can be recovered in a single procedure, either using a data snapshot, or using a data snapshot in combination with log backups. You can replay log backups after the database has been recovered with a data snapshot.
Creating a Data Snapshot
A data snapshot is created in three steps that are performed in the SAP HANA database and at storage system level. There is a weak link between SAP HANA and the storage tool. Data snapshots are recorded in the SAP HANA backup catalog.
While the data snapshot is being prepared or created, the snapshot-relevant data is frozen. While the snapshot-relevant data remains frozen, changes can still be made in the database. Such changes will not cause the frozen snapshot-relevant data to be changed. Instead, the changes are written to positions in the data area that are separate from the data snapshot. Changes are also written to the log.
To create a data snapshot, proceed as follows:
Prepare the database by creating a new internal database snapshot and finding the generated backup id using the following SQL command:Code snippetExpand
BACKUP DATA FOR FULL SYSTEM CREATE SNAPSHOT COMMENT ‘Internal database snapshot’; SELECT * FROM M_BACKUP_CATALOG WHERE ENTRY_TYPE_NAME = 'data snapshot';
From the output, find the backup id of the internal database snapshot with the state
PREPARED. This backup id is later needed to confirm or abandon the data snapshot backup.
Create a storage snapshot of the SAP HANA data volume area using the tool provided by your storage vendor. Note down the storage snapshot id. This storage snapshot id is later needed to confirm or abandon the data snapshot backup.
Depending on the success or failure of the storage snapshot, confirm or abandon the data snapshot in SAP HANA.
Confirm or abandon the data snapshot using the following SQL commands:
BACKUP DATA FOR FULL SYSTEM CLOSE SNAPSHOT BACKUP_ID 3456789 SUCCESSFUL 'snapshot_id_12345‘
BACKUP DATA FOR FULL SYSTEM CLOSE SNAPSHOT BACKUP_ID 3456789 UNSUCCESSFUL 'snapshot_id_12345‘
You can specify an external ID to identify the data snapshot later in the storage system.
An entry with the external backup ID is written to the backup catalog. If the data snapshot cannot be created, or if confirmation fails, choose Abandon.
After you have confirmed or abandoned a data snapshot, it is recorded in the backup catalog as either successful or unsuccessful. The SAP HANA database automatically deletes the internal snapshot from the SAP HANA data area after it has been either confirmed or abandoned.
Prepared data snapshots only exist until the data snapshot is executed using the storage tool. When a data snapshot is prepared but not confirmed for a longer period of time, an alert occurs.
It is strongly recommended to confirm or abandon a data snapshot as soon as possible after it has been created.
For information on creating data snapshots using SQL commands, see the SAP HANA Administration Guide - Data Snapshots.
Recovery with a Data Snapshot
Using SAP HANA cockpit and storage system tools, you can use a data snapshot to recover an SAP HANA system with all its tenant databases. See the SAP HANA Administration Guide - Recover SAP HANA from a Data Snapshot
SAP Note 2039883 - FAQ: SAP HANA database and data snapshots (storage snapshots)