PowerProtect: SAP-Hana Pre and Post-Scripts for Hana Native Snapshots in Conjunction with Cloud Snapshot Manager Snapshots
Summary: Tips on using Cloud Snapshot Manager for SAP-HANA database protection
Instructions
See this doc for SAP-HANA use with CSM guide:
https://dl.dell.com/content/docu104379-powerprotect-cloud-snapshot-manager-protecting-sap-hana-with-application-consistency.pdf?language=en-us
The paper is written for Azure but is applicable for AWS as well.
The method describes how to use a CSM application-consistency pre-snapshot script to trigger a HANA database native snapshot.
HANA native snapshots are not related to AWS or Azure snapshots.
HANA native snapshots are stored in the /hana/data/ directory on the HANA database server file systems. CSM takes snapshots of the machine volumes that contain HANA native snapshots.
The HANA database can be recovered by restoring machine volumes that contain HANA native snapshots. Alternatively, by restoring the VM of a HANA database server, and then using HANA Studio to recover the HANA System and then Tenant databases.
This can be accomplished either by using CSMs FLR feature to attach volumes to an existing HANA database machine. This is outlined in the referenced whitepaper link, Or it can be accomplished by restoring an entire VM with CSM's Restore VM feature and then restoring the HANA database using the saved HANA native snapshot.
Additional Information
Log replay may be wanted. It would be necessary to recover log backups by another means if recovery to a point in time that is after the CSM snapshot time is required. For example, NetWorker may be used for log backup and restore for point-in-time recovery where the recover time postdates the CSM snapshot time.
The method calls for placing the HANA-native scripts on the HANA database machine. The CSM pre-scripts and post-scripts then run the scripts that are on the machine.
When scripts are run on Linux machines, the last command run evaluates to the overall execution status. So, if the example for the pre-script, the HANA snapshot script runs followed by Linux fsfreeze command. The overall script status depends on the fsfreeze command execution.
It is probably desirable to add something to evaluate the HANA snapshot script status. Then the job in CSM can be marked as 'partially complete' if the HANA snapshot script does not complete normally.
Use a script that resembles this example from AWS Systems Manager doc:
"su - dbadminacct -c python /tmp/hana-pre.py",
"if [ $? -ne 0 ]",
"then ",
"echo command status non-zero",
"exit 2",
"fi",
"su - root -c /sbin/fsfreeze --freeze /hana/data/D1/"
Something similar for post script is prudent as well:
"customerr = 0",
"su - root -c /sbin/fsfreeze --unfreeze /hana/data/D1/",
"if [ $? -ne 0 ]",
"then ",
"customerr = 2",
"fi",
"su - dbadminacct -c python /tmp/hana-pre.py",
"if [ $customerr -ne 0 ]",
"then ",
"echo post script error encountered"
"exit 2",
"fi"