How to “automate” SAP HANA Backups using Storage Snapshots on Pure Storage

SAP HANA backup and recovery is a long painstaking process for SAP HANA system administrators. These administrators spend considerable amounts of time and effort prepping the environment and going through complicated procedures to ensure that the backup process is carried out with minimum disruption to the business and in accordance with best practices.

Pure Storage helps simplify the backup process for SAP HANA environments through our unique snapshot capabilities. Pure Storage snapshots are nearly instantaneous and highly space efficient, allowing system administrators to greatly speed up the backup/recovery process with minimal effect on production environments.

The storage snapshots are suitable to provide very fast data backups for a huge amount of data with a negligible impact on the network, overall I/O performance and the SAP HANA database itself.Also, storage snapshots are most suitable for fast database recovery (recovery-time-objective; RTO).

The whole process of backing up SAP HANA using Pure Storage snapshots takes few minutes. Storage snapshot support is enabled using a loose coupling between the SAP HANA database and the storage system. The creation of a storage snapshot is done in three steps that must be executed on the SAP HANA database site as well as on storage system level. The SAP HANA database offers SQL statements to PREPARE, CONFIRM and if needed ABANDON a storage snapshot.

Here are the steps in detail of how it can be automated using the shell script. The SAP HANA system SID is P66 and <sid>adm user is p66adm.

  1. The SAP HANA database has to be requested to PREPARE itself for the storage snapshot. This is done by executing the SQL statement BACKUP DATA CREATE SNAPSHOT which has to be given once to an arbitrary HANA index server. Get the backup id from backup_catalog as shown below.prepare-snapshot
  2. Freeze the XFS file system for SAP HANA data volume using command:                                  xfs_freeze -f /hana/data/P66
  3. Take the storage snapshot using Pure Storage CLI command:                                   purevol snap <name_of_datavolume> –suffix=<give_unique_suffix>
  4. Unfreeze the XFS file system for SAP HANA data volume using command:             xfs_freeze -u /hana/data/P66
  5. The last step is to report the storage snapshot creation to SAP HANA database even if the storage snapshot failed, because the SAP HANA database has to clear internal states. For that purpose use the SQL statement “BACKUP DATA CLOSE SNAPSHOT BACKUP_ID <backup_id> SUCCESSFUL <external_id>” for confirmation.close-snapshote

The script is available on Github.

https://github.com/krishnasatyavarapu/SAPHANA/blob/master/saphanabackupsnap.sh

https://github.com/krishnasatyavarapu/SAPHANA/blob/master/snapcopydatavolume.sh

Add this shell script to crontab and run it frequently like once every 2 hours. You can then reduce the File based backup less frequently like once every 3 days. This storage snapshot method gives more recover points for SAP HANA reducing the RTO drastically.

Compared to file-based or backint-based data backups, a storage snapshot will consider the entire data area of all SAP HANA database services and not only the payload of each service specific data volume.

If you would like to learn more about how to snapshot a SAP HANA database on a Pure Storage Flash Array, this short white paper will provide you with all the necessary details.

http://info.purestorage.com/Global-SAP-HANA-Backup-and-Recovery-using-Pure-Storage-Snapshots_Request.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s