Skip to main content
NetApp Solutions SAP

Automation example scripts

Contributors netapp-nbauer kevin-hoke

In this document, two scripts are used to further automate SnapCenter clone create and clone delete operations.

  • The script sc-system-refresh.sh is used for the system refresh and the system clone workflow to execute recovery and shutdown operations of the SAP HANA database.

  • The script sc-mount-volume.sh is used for the system clone workflow to execute mount and unmount operations for the SAP HANA shared volume.

    Note The example scripts are provided as is and are not supported by NetApp. You can request the scripts via email to ng-sapcc@netapp.com.

Script sc-system-refresh.sh

The example script sc-system-refresh.sh is used to execute recovery and shutdown operations. The script is called with specific command-line options within the SnapCenter workflows clone create and clone delete, as shown in the figure below.

The script is generic and reads all required parameters, like the SID from the target system. The script must be available at the target host of the system refresh operation. An hdb user store key must be configured for the user <SID>adm at the target system. The key must allow access to the SAP HANA system database and provide privileges for recovery operations. The key must have the name <TARGET-SID>KEY.

The script writes a log file sc-system-refresh-SID.log`, to the same directory, where it gets executed.

Note The current version of the script supports single host systems MDC single tenant, or MDC multiple tenant configurations. It does not support SAP HANA multiple-host systems.

Figure showing input/output dialog or representing written content

Supported tenant recovery operations

As described in the section “SAP HANA system refresh operation workflows using storage snapshot” the possible tenant recovery operations at the target system depend on the tenant configuration of the source system. The script sc-system-refresh.sh supports all tenant recovery operations, which are possible dependent on the source system configuration, as shown in the table below.

If a different tenant name is required at the target system, the tenant must be renamed manually after the recovery operation.

SAP HANA system Tenant configuration
at source system
Resulting tenant configuration
at target system

MDC single tenant

Source tenant name equal to source SID

Target tenant name is equal to target SID

MDC single tenant

Source tenant name not equal to source SID

Target tenant name is equal to source tenant name

MDC multiple tenants

Any tenant names

All tenants are recovered and will have the same name as the source tenants.

Script sc-mount-volume.sh

The example script sc-mount-volume.sh is used to execute mount and unmount for any volume. The script is used to mount the SAP HANA shared volume with the SAP HANA system clone operation. The script is called with specific command-line options within the SnapCenter workflows clone create and clone delete, as shown in the figure below.

Note The script supports SAP HANA systems using NFS as a storage protocol.

Figure showing input/output dialog or representing written content

SnapCenter environment variables

SnapCenter provides a set of environment variables that are available within the script that is executed at the target host. The script uses these variables to determine relevant configuration settings.

  • The script variables STORAGE, JUNCTION_PATH are used for the mount operation.

  • Derived from CLONED_VOLUMES_MOUNT_PATH environment variable.

  • CLONED_VOLUMES_MOUNT_PATH=${STORAGE}:/${JUNCTION_PATH}

  • For example: CLONED_VOLUMES_MOUNT_PATH=192.168.175.117:/SS1_shared_Clone_05112206115489411

Script to get SnapCenter environment variables

If the automation scripts should not be used and the steps should be executed manually, you need to know the storage system junction path of the FlexClone volume. The junction path is not visible within SnapCenter, so you need to either look up the junction path directly at the storage system, or you could use a simple script that provides the SnapCenter environment variables at the target host. This script needs to be added as a mount operation script within the SnapCenter clone create operation.

ss1adm@hana-1:/mnt/sapcc-share/SAP-System-Refresh> cat get-env.sh
#!/bin/bash
env > /tmp/env-from-sc.txt
ss1adm@hana-1:/mnt/sapcc-share/SAP-System-Refresh>

Within the env-from-sc.txt file, look for the variable CLONED_VOLUMES_MOUNT_PATH to get the storage system IP address and junction path of the FlexClone volume.

For example: CLONED_VOLUMES_MOUNT_PATH=192.168.175.117:/SS1_data_mnt00001_Clone_05112206115489411