image_pdfimage_print

SAP HANA is an in-memory data platform engineered, marketed and sold by SAP SE. The data platform offers an in-memory, column oriented relational database management system primarily focused on data processing and analysis in a performant manner. With the release of SAP HANA SPS04, storage snapshots of instances deployed with multiple database containers are now supported. In previous versions, the functionality was not supported, and thus data protection operations needed to be performed through Backint for SAP HANA, to a network file system (NFS) or local disk target. 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

Process

Step 1: Check the SAP HANA System mode

Using the connection string:

Driver={HDBODBC}; ServerNode=<HostAddress>:3 <InstanceNumber> 15; UID= <Database User>; PWD=<DatabasePassword>;

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

SELECT VALUE FROM M_INIFILE_CONTENTS WHERE FILE_NAME = ‘global.ini’ AND SECTION = ‘multidb’ AND KEY = ‘mode’

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

Driver={HDBODBC}; ServerNode=<HostAddress>:3 <InstanceNumber> 13; UID= <Database User>; PWD=<DatabasePassword>;

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.

Step 2: Determine the block storage volume on FlashArray that corresponds to the SAP HANA persistent data volume mount point in Linux

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

SELECT VALUE FROM M_INIFILE_CONTENTS WHERE FILE_NAME = ‘global.ini’ AND SECTION = ‘persistence’ AND KEY = ‘basepath_datavolumes’ AND VALUE NOT LIKE ‘$%’

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.

df -h | grep <SAP HANA Data Persistence mount point>

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:

udevadm info –query=all –name<device name> | grep DM_SERIAL

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”

Step 3. Prepare the database snapshot and retrieve the backup ID for it

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

BACKUP DATA FOR FULL SYSTEM CREATE SNAPSHOT COMMENT ‘SNAPSHOT-<Snapshot Time>

To retrieve the backup ID, execute the following query:

SELECT BACKUP_ID, COMMENT FROM M_BACKUP_CATALOG WHERE ENTRY_TYPE_NAME = ‘data snapshot’ AND STATE_NAME = ‘prepared’

Step 4. Freeze the filesystem

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.

/sbin/fsfreeze –freeze <path to mount point>

Step 5. Query the relevant FlashArray for a list of its volumes and search them for the serial number contained within the serial number returned by step 2, then create a snapshot once the volume has been located

$Array = New-PfaArray -EndPoint $FlashArrayAddress -username $User -Password $Password -IgnoreCertificateError
$Volumes = Get-PfaVolumes -Array $Array
Example of PowerShell using the Pure Storage PowerShell SDK
$VolumeSnapshot = New-PfaVolumeSnapshots -Array $Array -Sources $volume.name -Suffix $SnapshotSuffix
Once the correct volume has been found create a snapshot with a specified Snapshot suffix
return $VolumeSnapshot.serial
Return the serial number for the volume to be used as a reference when confirming or abandoning the snapshot

Step 6. Unfreeze the filesystem

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.

/sbin/fsfreeze –unfreeze <path to mount point>

Step 7. Confirm or abandon the database snapshot

BACKUP DATA FOR FULL SYSTEM CLOSE SNAPSHOT BACKUP_ID <External Backup ID> SUCCESSFUL;
Confirm the snapshot if all of the previous steps executed successfully.

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

BACKUP DATA FOR FULL SYSTEM CLOSE SNAPSHOT BACKUP_ID <Prepared database snapshot backup ID> UNSUCCESSFUL <additional comments>;
Abandon the snapshot if one of the previous steps did not execute successfully.

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.

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)

SAP HANA Backup and Recovery using purity CloudSnap

SAP HANA Backup and Recovery using SnapToNFS