New! SAP HANA Scripts for Automating Storage Operations

While writing and developing content for SAP HANA on Pure Storage® FlashArray™ or Pure Cloud Block Store™ (CBS), I have developed some scripts that speed up some of the operations which organizations using SAP HANA on Pure Storage products could also make use of.

To that end, I have created a repository for SAP HANA focused operations on Pure Storage Open Connect, which is where the latest scripts can be found.

Getting Started

The scripts are written in both Microsoft Powershell and Python to cater for both Windows and Linux users, respectively.

Assuming that git is installed on either the Linux based OS or Microsoft Windows, simply execute the following to clone the remote repository to a local one:

Git clone https://github.com/PureStorage-OpenConnect/SAP-HANA-Scripts.git

The repository contains separate folders for Powershell and Python scripts. Each separate folder further splits out to cater towards the type of SAP HANA deployment (Scale Up and Scale Out) to be operated on .In the initial release of these scripts only baremetal systems can take application consistent storage snapshots.

Prerequisites

Download and install the SAP HANA client (SAP login required) for the relevant OS and SAP HANA version.  To use the Python scripts, install the SAP HANA Python driver by following this process.

It is also important to know which port the SAP HANA database indexserver is running on. To ascertain this, simply execute the following Native SQL script on the system database (Multiple database containers):

SELECT HOST, DATABASE_NAME, SQL_PORT

FROM SYS_DATABASES.M_SERVICES

Python Scripts

Ensure the following packages are installed using either pip or easy_install

  • argparse
  • paramkio
  • regex
  • purestorage
  • Datetime

All scripts were created for  use with Python 3.6 and later to ensure they work as expected.  Accordingly, install the required version of Python and update the version for execution by using the following process provided by linuxconfig.org.

Python Script – SAP HANA Scale Up or Single Node – creating an application consistent snapshot

This script will connect to an SAP HANA database and determine if the system is configured for multiple database containers (MDC). In the event of using an MDC system, it will use the database user and password provided. This assumes the user provides both the SYSTEM and tenant database with the same password. Once connected to the correct database, the script finds the data volume, matches it to a volume on FlashArray or Pure CBS, prepares the database for a storage snapshot, takes the block device storage snapshot and then ensures everything is correct before confirming or abandoning the snapshot.

Location –  Python/Scale Up/saphana_create_snapshot.py

Arguments 

-ha/–hostaddress Host address(IP) or hostname of the SAP HANA Scale Up system.
-i/–instancenumber SAP HANA instance number , typically in the form 00. Defaults to 00 if not value given.
-dn/–databasename SAP HANA database or tenant name.
-p/–port SAP HANA port number , typically in the form 15,41 taken from the final two digits of the port number. Defaults to 15 if no value is given.
-du/–databaseuser SAP HANA database user with the correct permissions to  create a storage snapshot.
-dp/–databasepassword SAP HANA database password with the correct  permissions to create a storage snapshot.
-osu/–operatingsystemuser A user with the permissions to freeze the SAP HANA data volume and view volume information.
-osp/–operatingsystempassword Password for the user with permissions to freeze the  SAP HANA data volume and view volume information.
-fa/–flasharray The IP address or hostname of a Pure Storage FlashArray with the SAP HANA systems volumes on it.
-fau/–flasharrayuser A user on the FlashArray with permissions to create a volume snapshot.
-fap/–flasharraypassword A user on the FlashArray with permissions to create a volume snapshot

Python Script – SAP HANA Scale Out or Multi-Node – creating an application consistent snapshot

This script will connect to an SAP HANA database on any scale out worker node and identify if the system is configured for multiple database containers (MDC). In the event of using an MDC system it will use the database user and password provided. This assumes the user provides both the SYSTEM and tenant database with the same password. Once connected to the correct database the script finds the data volumes for each worker node, matches it to the volumes on FlashArray or CBS , prepares the database for a storage snapshot , takes a storage snapshot of each block storage device and then ensures everything is correct before confirming or abandoning the snapshot.

Location –  Python/Scale Out/saphana_create_snapshot.py

Arguments 

-ha/–hostaddress Host address(IP) or hostname of any SAP HANA worker node with an indexserver.
-d/–domainname Domain name of the domain where the SAP HANA scale out nodes are located.
-i/–instancenumber SAP HANA instance number , typically in the form 00. Defaults to 00 if not value given.
-dn/–databasename SAP HANA database or tenant name.
-p/–port SAP HANA port number , typically in the form 15,41 taken from the final two digits of the port number. Defaults to 15 if no value is given.
-du/–databaseuser SAP HANA database user with the correct permissions to  create a storage snapshot.
-dp/–databasepassword SAP HANA database password with the correct  permissions to create a storage snapshot.
-osu/–operatingsystemuser A user with the permissions to freeze the SAP HANA data volume and view volume information.
-osp/–operatingsystempassword Password for the user with permissions to freeze the  SAP HANA data volume and view volume information.
-fa/–flasharray The IP address or hostname of a Pure Storage FlashArray with the SAP HANA systems volumes on it.
-fau/–flasharrayuser A user on the FlashArray with permissions to create a volume snapshot.
-fap/–flasharraypassword A user on the FlashArray with permissions to create a volume snapshot

Powershell Scripts

All scripts are created to work on Powershell 3.0 or later. The .Net Framework 4.5 or later also needs to be installed to ensure all of the correct prerequisites are available.  The script will check if the SAP HANA client and ODBC provider are added to the ODBC data sources, the Pure Storage Powershell SDK is installed and POSH-SSH are installed.

Powershell Script – SAP HANA Scale Up or Single Node – creating an application consistent snapshot

This script will connect to an SAP HANA database and identify if the system is configured for multiple database containers (MDC). In the event of using an MDC system, it will use the database user and password that is provided. This assumes the user provides both the SYSTEM and tenant database with the same password. Once connected to the correct database, the script finds the data volume, matches it to a volume on FlashArray or Pure CBS, prepares the database for a storage snapshot, takes the block device storage snapshot and then ensures everything is correct before confirming or abandoning the snapshot.

Location –  Powershell\Scale Up\New-StorageSnapshot.ps1

Arguments 

HostAddress Host address(IP) or hostname of the SAP HANA Scale Up system.
InstanceNumber SAP HANA instance number , typically in the form 00. Defaults to 00 if not value given.
InstanceNumber SAP HANA database or tenant name.
DatabaseUser SAP HANA port number , typically in the form 15,41 taken from the final two digits of the port number. Defaults to 15 if no value is given.
-DatabasePassword SAP HANA database user with the correct permissions to  create a storage snapshot.
DatabasePassword SAP HANA database password with the correct  permissions to create a storage snapshot.
OperatingSystemUser A user with the permissions to freeze the SAP HANA data volume and view volume information.
OperatingSystemPassword Password for the user with permissions to freeze the  SAP HANA data volume and view volume information.
PureFlashArrayAddress The IP address or hostname of a Pure Storage FlashArray with the SAP HANA systems volumes on it.
PureFlashArrayUser A user on the FlashArray with permissions to create a volume snapshot.
PureFlashArrayPassword A user on the FlashArray with permissions to create a volume snapshot

Powershell Script – SAP HANA Scale Out or Multi-Node – creating an application consistent snapshot

This script will connect to an SAP HANA database on any scale out worker node and identify if the system is configured for multiple database containers (MDC). In the event of using an MDC system, it will use the database user and password provided. This assumes the user provides both the SYSTEM and tenant database with the same password. Once connected to the correct database, the script finds the data volumes for each worker node, matches it to the volumes on FlashArray or CBS, prepares the database for a storage snapshot, takes a storage snapshot of each block storage device and then ensures everything is correct before confirming or abandoning the snapshot.

Location –  Powershell\Scale Out\New-StorageSnapshot.ps1

Arguments 

HostAddress Host address(IP) or hostname of any SAP HANA worker node with an indexserver.
DomainName Domain name of the domain where the SAP HANA scale out nodes are located.
InstanceNumber SAP HANA instance number , typically in the form 00. Defaults to 00 if not value given.
InstanceNumber SAP HANA database or tenant name.
DatabaseUser SAP HANA port number , typically in the form 15,41 taken from the final two digits of the port number. Defaults to 15 if no value is given.
-DatabasePassword SAP HANA database user with the correct permissions to  create a storage snapshot.
DatabasePassword SAP HANA database password with the correct  permissions to create a storage snapshot.
OperatingSystemUser A user with the permissions to freeze the SAP HANA data volume and view volume information.
OperatingSystemPassword Password for the user with permissions to freeze the  SAP HANA data volume and view volume information.
PureFlashArrayAddress The IP address or hostname of a Pure Storage FlashArray with the SAP HANA systems volumes on it.
PureFlashArrayUser A user on the FlashArray with permissions to create a volume snapshot.
PureFlashArrayPassword A user on the FlashArray with permissions to create a volume snapshot

One thought on “New! SAP HANA Scripts for Automating Storage Operations

Leave a Reply

Your email address will not be published. Required fields are marked *