How to Automate Storage Snapshot Data Protection for SAP HANA and FlashArray

A guide to automating the creation of application-consistent storage snapshots on any single or multiple-tenant single host database with Pure Storage® FlashArray™ .

Automate Storage Snapshot

image_pdfimage_print

SAP HANA is an in-memory data platform offering an in-memory, column oriented relational database management system primarily focused on data processing and analysis in a performant manner. Storage snapshots of instances deployed with multiple database containers are supported. Here, we will teach to automate storage snapshot data protection for SAP HANA and FlashArray.

The purpose of this guide is to showcase how an organisation can automate storage snapshots on any single or multiple tenant single host database with Pure Storage® FlashArray™ .

The operation of creating a storage snapshot for the SAP HANA Scale Up/Single Host for a landscape of systems is possible through the use of programmatic logic.The concepts discussed here are high level and can be applied to any scripting or high-level programming language with the relevant libraries and support. It is assumed that the deployment has a single volume for data and log mount points separate from one another and not configured using logical volume manager(LVM). Some examples will be shown with reference to PowerShell and bash commands.

Workflow to create a storage snapshot for a single host SAP HANA database.

Requirements

  • A library/module which enables the user to SSH into the SAP HANA system with a username and password
  • If possible, an SDK to work with the Pure Storage Flash Array ReST API
  • A library/module to interact with SAP HANA using the hdbsql query language.

Process

Using the connection string:

Connect to the SAP HANA database and run the following query to determine system mode:

The result will be either “singledb” or “multidb”:

Changing the port number allows the application to connect to the System database.In this case the port to connect on for instance 00 would change from 30015 to 30013.

Using the established connection string run the following query to determine the SAP HANA persistence data volume mount point:

The value returned will include the database name at the end (e.g. SH1 will correspond to /hana/data/SH1) the mount point needed to interact with is the directory above the database name (e.g. /hana/data/SH1 becomes /hana/data/).

An SSH connection needs to be created to query the operating system for the device serial number for the SAP HANA data persistence volume, once the command line is available for reading and writing we run the “df -h” command to view all mounted volumes and mount points as well as retrieving the device mapper or storage device (sd) the mount point is mapped to. The output of df -h then needs to be piped and “grep” used to isolate the specific entry for the required volume. It is possible to query the /etc/fstab for the same information but the contents of fstab may not always be what the system is working on at that point in time.

Once the device the mount point corresponds to has been isolated, udevadm is then queried for the serial number known as “DM_SERIAL” in its output using the command:

Using the serial number returned for the device, it is possible to match it up to the block storage volume a FlashArray. Note that the block volume serial number will be all of the characters after “3624a9370”

Using the established connection string to execute the query needed to prepare a database snapshot.

To retrieve the backup ID, execute the following query:

An SSH connection needs to be created with the operating system on which the SAP HANA instance is installed to execute command line arguments. To freeze the filesystem the fsfreeze utility will be used as it supports EXT3/4, ReiserFS, JFS and XFS. The mount point retrieved in step 2 will be used during the freeze operation.

An SSH connection needs to be created with the operating system on which the SAP HANA instance is installed to execute command line arguments. To unfreeze the filesystem use the same mount point used in step 3.

Using the connection string established in step 1, confirm or abandon the snapshot using hdbsql commands:

It is important that the storage snapshot is not kept for too long as snapshot relevant data is frozen and new changes to the database will be written to a separate area and the data volume will continue to grow.

Application-Consistent vs Crash-Consistent Snapshots

You can create two types of snapshots. Crash-consistent snapshots are likely the most common for non-critical systems. These snapshots take a copy of the system as it is in the current moment. Any data that hasn’t been written to disk yet is excluded. The name “crash-consistent” snapshot is used because it’s a copy of the system as if it crashed.

Application-consistent snapshots preserve data better, but it’s much more complex and might require the system to pause first. Data from applications is first written to disk and then a snapshot is taken. This snapshot type is better for critical systems when data integrity is important for recovery. It’s mostly used with database applications.

Use crash-consistent snapshots when you need a quick backup and don’t need to preserve the most recent data. Be warned that losing data might affect some applications, so it’s quicker to take the snapshot but might take more time to recover the system. Application-consistent snapshots are good for databases and mission-critical applications. The process takes longer, but recovery restores all data and is much more accurate.

Further Information

Further information on backup and recovery with Pure FlashArray and SAP HANA can be found at the below locations:

SAP HANA Platform 2.0 SPS04 New features

Whats New in the SAP HANA Platform 2.0 : SAP HANA Database Backup and Recovery (New and Changed)

flash array test drive

Explore our unified block and file storage platform.