CAPTCHA

Updated! SAP HANA Scripts with recovery automation

One of the recent projects I have been very proud to deliver was the creation of an open source repository on GitHub, containing scripts to help customers automate SAP HANA  storage operations with common scripting languages like Microsoft PowerShell and Python. The initial scripts committed to this public repository will help customers create application consistent and crash consistent storage snapshots for Scale Up and Scale Out deployments. I am very pleased to announce that additional scripts have been added to the repository to enable the recovery of Scale Up systems to be automated. This automation focuses on application consistent snapshots created using the existing scripts in the repository but is dependant on the following factors:

  • Application consistent data snapshots are created and recorded in the SAP HANA backup catalog.
  • The availability of the SAP HANA instance and the backup catalog for querying. In the event that the SAP HANA system has suffered a loss of service , a manual recovery using SAP HANA Studio or SAP HANA cockpit will need to be performed.
  • Application consistent volume snapshots are created on FlashArray™ or Pure Cloud Block Store™ (CBS) using the format  <Source volume name>. SAPHANA-<BackupID>
  • The current version of the recovery scripts only support Scale Up deployments on baremetal

How it all works : Assuming that application consistent storage snapshots have been created and conform to the naming conventions required  the script is executed using the command line arguments, as seen using the Powershell Scale Up recovery script below:

Once the script starts to execute, it will check the prerequisites.  If the prerequisites have not been entered onto the command line, the script will prompt the user to ensure the passwords for various components are present.

If all of the credentials are accepted, the user is then directed to a list of data snapshot recovery points. Only ten are shown per view and the user selects a recovery point by entering a catalog id entry.

Once a recovery point has been chosen, the presence of the storage snapshot is verified against the array given in the command line arguments. If the volume snapshot is not present, the user is notified and then sent back to the catalog dialog to select another recovery point. If the volume snapshot that corresponds to the backup id is present, then the user is prompted to verify if they want to proceed with the recovery.

The process is disruptive as the SAP HANA system needs to be shutdown before the recovery can begin.

Everything from the confirmation is very straightforward and the following occurs:

  • The instance is shut down;
  • The original SAP HANA data volume is disconnected from the host and the operating system is updated accordingly;
  • The snapshot is copied to a new volume with the name “Original volume name-<backup id>”;
  • The new volume is connected to the host and the operating system is updated accordingly;
  • The SystemDB is then recovered and the instance is started; and
  • All of the tenants present at the time when the data snapshot was taken are recovered sequentially.

It is possible to instead overwrite the original SAP HANA data volume with the storage snapshot, this is done by adding the argument “-OverwriteVolume” to the original command line.

 

I created a video of how the entire process of creating and recovering from an application consistent storage snapshot with FlashArray would be invoked :

 

Python scripts  Recover from an application consistent storage snapshot for Scale Up systems (copy to new volume)

Running this script with the arguments will bring up an interactive ASCII menu thereby, allowing for a specific point in time data snapshot to be rolled back to. The script will also check that the data snapshot is still present on the array. This script assumes the snapshot is on the same array as the running SAP HANA data volumes.This will also copy the snapshot to an entirely new volume.

Location – Python/Snapshot Creation/recover_scaleup_snapshot.py

saphana_recoverfrom_snapshot.py –hostaddress<Host Address of SAP HANA system> –instancenumber <instancenumber> –databaseuser <user with permissions to create storage snapshot> –databasepassword <password of databaseuser> –operatingsystemuser <user with permissions to freeze and unfreeze filesystems and query device information> –operatingsystempassword <password of operatingsystemuser> –flasharray <flasharray IP or FQDN of the SAP HANA block storage provider> –flasharrayuser <flasharrayuser> –flasharraypassword <flasharraypassword>

Recover from an application consistent storage snapshot for Scale Up systems (overwrite existing volume)

Running this script with the arguments will bring up an interactive ASCII menu, thereby allowing for a specific point in time data snapshot to be rolled back to. The script will also check that the data snapshot is still present on the array. This script assumes the snapshot is on the same array as the running SAP HANA data volumes.This will also overwrite the original SAP HANA Data Volume with the storage snapshot.

Location – Python/Snapshot Creation/recover_scaleup_snapshot.py

saphana_recoverfrom_snapshot.py –hostaddress<Host Address of SAP HANA system> –instancenumber <instancenumber> –databaseuser <user with permissions to create storage snapshot> –databasepassword <password of databaseuser> –operatingsystemuser <user with permissions to freeze and unfreeze filesystems and query device information> –operatingsystempassword <password of operatingsystemuser> –flasharray <flasharray IP or FQDN of the SAP HANA block storage provider> –flasharrayuser <flasharrayuser> –flasharraypassword <flasharraypassword> –overwritevolume  

If the concept of automating some of the disaster recovery scenarios in your SAP HANA landscape has some appeal, then head on over to the SAP HANA scripts repository on GitHub and get cloning!