The SAP HANA Fast Restart option reduces the restart time in the event that SAP HANA terminates while the operating system remains running. Google Cloud recommends that you enable this option for your SAP HANA workload, especially for multi-terabyte workloads. For more information about this option, see the SAP document SAP HANA Fast Restart Option.
This document is intended for SAP Basis and SAP system administrators who are familiar with managing SAP HANA workloads.
Before you begin
In the Google Cloud console, select the Google Cloud project where your SAP HANA workload is running.
Make sure that the
SIDadmOS user that you use has permission to start and stop SAP HANA.
Required roles
To ensure that the service account has the necessary permissions to access secrets stored in Secret Manager, ask your administrator to grant the following IAM roles to the service account on your project:
-
If you are using the automation script provided by Google Cloud to enable the SAP HANA Fast Restart option, and are using Secret Manager to store the password to connect to the SAP HANA database:
Secret Manager Secret Accessor (
roles/secretmanager.secretAccessor)
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to access secrets stored in Secret Manager. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to access secrets stored in Secret Manager:
-
If you are using the automation script provided by Google Cloud to enable the SAP HANA Fast Restart option, and are using Secret Manager to store the password to connect to the SAP HANA database:
secretmanager.versions.access
Your administrator might also be able to give the service account these permissions with custom roles or other predefined roles.
Enable the SAP HANA Fast Restart option
Use automation script
Google Cloud provides a script that you can use to enable SAP HANA Fast Restart option.
To enable the SAP HANA Fast Restart option by using the automation script provided by Google Cloud, complete the following steps:
Establish an SSH connection with the compute instance that's running your SAP HANA workload.
As the
SIDadmuser, stop the SAP HANA database.Download the
sap_lib_hdbfr.shscript, which is provided by Google Cloud:wget https://storage.googleapis.com/cloudsapdeploy/terraform/latest/terraform/lib/sap_lib_hdbfr.shMake the
sap_lib_hdbfr.shfile executable:sudo chmod +x sap_lib_hdbfr.shVerify that the script has no errors:
./sap_lib_hdbfr.sh -helpIf the command returns an error, then contact Cloud Customer Care. For information about how to contact Customer Care, see Getting support for SAP on Google Cloud.
Enable the SAP HANA Fast Restart option by running the script:
sudo ./sap_lib_hdbfr.sh -h 'SID' -s SECRET_NAMEIf you're not using a Secret Manager secret to provide the password, you can provide the password in plain text. However, Google Cloud recommends against this because the password gets recorded in the command-line history of the compute instance.
sudo ./sap_lib_hdbfr.sh -h 'SID' -p PASSWORDReplace the following:
SID: the SAP system ID (SID) of your SAP HANA workload; for exampleAB1SECRET_NAME: the name of the secret in Secret Manager that securely stores the password for theSYSTEMuser of your SAP HANA database. The secret must exist in the same Google Cloud project that runs your SAP HANA workload.PASSWORD: the password of theSYSTEMuser of your SAP HANA database
The output is similar to the following:
INFO - Script is running in standalone mode ls: cannot access '/hana/tmpfs*': No such file or directory INFO - Setting up HANA Fast Restart for system 'TST/00'. INFO - Number of NUMA nodes is 2 INFO - Number of directories /hana/tmpfs* is 0 INFO - HANA version 2.57 INFO - No directories /hana/tmpfs* exist. Assuming initial setup. INFO - Creating 2 directories /hana/tmpfs* and mounting them INFO - Adding /hana/tmpfs* entries to /etc/fstab. Copy is in /etc/fstab.20220625_030839 INFO - Updating the HANA configuration. INFO - Running command: select * from dummy DUMMY "X" 1 row selected (overall time 4124 usec; server time 130 usec) INFO - Running command: ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('persistence', 'basepath_persistent_memory_volumes') = '/hana/tmpfs0/TST;/hana/tmpfs1/TST;' 0 rows affected (overall time 3570 usec; server time 2239 usec) INFO - Running command: ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('persistent_memory', 'table_unload_action') = 'retain'; 0 rows affected (overall time 4308 usec; server time 2441 usec) INFO - Running command: ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini', 'SYSTEM') SET ('persistent_memory', 'table_default') = 'ON'; 0 rows affected (overall time 3422 usec; server time 2152 usec)As the
SIDadmuser, start the SAP HANA database.
Manual steps
To manually enable the SAP HANA Fast Restart option for your workload, complete the following steps:
Establish an SSH connection with the compute instance that's running your SAP HANA workload.
As the
SIDadmuser, stop the SAP HANA database.Create directories for the NUMA nodes and mount them in the
tmpfsfile system:Review the NUMA topology of your compute instance:
sudo lscpu | grep NUMAThe following is an example output for a compute instance based on the
m2-ultramem-208machine type, which has four NUMA nodes numbered 0-3. Your output is similar to this example.NUMA node(s): 4 NUMA node0 CPU(s): 0-25,104-129 NUMA node1 CPU(s): 26-51,130-155 NUMA node2 CPU(s): 52-77,156-181 NUMA node3 CPU(s): 78-103,182-207Create a directory for each NUMA node and assign the ownership of these directories to the SAP HANA administrator user and group:
mkdir -pv /hana/tmpfsNEW_NUMA_NODE_INDEX_RANGE/SID chown -R SID_LCadm:sapsys /hana/tmpfs*/SID chmod 777 -R /hana/tmpfs*/SID
Replace the following:
SID: the SAP system ID (SID) of your SAP HANA workload; for exampleAB1NUMA_NODE_INDEX_RANGE: the index range for the NUMA nodes available on your compute instance. For example, if your compute instance was based on them2-ultramem-208machine type, which has four NUMA nodes, then you'd specify the value0..3.SID_LC: the SID in lowercase; for exampleab1
Mount the NUMA node directories to the
tmpfsfile system:sudo mount tmpfsSID0 -t tmpfs -o mpol=prefer:0 /hana/tmpfs0/SID sudo mount tmpfsSID1 -t tmpfs -o mpol=prefer:1 /hana/tmpfs1/SID sudo mount tmpfsSID2 -t tmpfs -o mpol=prefer:2 /hana/tmpfs2/SID sudo mount tmpfsSID3 -t tmpfs -o mpol=prefer:3 /hana/tmpfs3/SIDTo ensure that these mount points persist after an OS reboot, add the following entries to the
/etc/fstabfile:tmpfsSID0 /hana/tmpfs0/SID tmpfs rw,nofail,relatime,mpol=prefer:0 tmpfsSID1 /hana/tmpfs1/SID tmpfs rw,nofail,relatime,mpol=prefer:1 tmpfsSID1 /hana/tmpfs2/SID tmpfs rw,nofail,relatime,mpol=prefer:2 tmpfsSID1 /hana/tmpfs3/SID tmpfs rw,nofail,relatime,mpol=prefer:3
(Optional) Because the
tmpfsfile system can grow and shrink dynamically, you can limit its memory usage by using the following options:Limit the size of a NUMA node volume:
sudo mount tmpfsSID0 -t tmpfs -o mpol=prefer:0,size=SIZE /hana/tmpfs0/SIDReplace
SIZEwith the size to which you want to limit the NUMA node volume. For example,250G.Limit the overall memory usage of
tmpfsfor all NUMA for a given SAP HANA instance and given compute instance by setting thepersistent_memory_global_allocation_limitin the[memorymanager]section the SAP HANAglobal.inifile.
From the compute instance that's running your workload, inform the SAP HANA system about the
tmpfslocations by updating the[persistence]section of theglobal.inifile to include paths to thetmpfslocation that you created in the preceding steps. Separate eachtmpfslocation with a semicolon.The following example is specific to an
m2-ultramem-208instance, and specifies four memory volumes that correspond to the four NUMA nodes available on the M2 instance. If you were running SAP HANA on anm2-ultramem-416instance, then you'd need to configure eight memory volumes.[persistence] basepath_datavolumes = /hana/data basepath_logvolumes = /hana/log basepath_persistent_memory_volumes = /hana/tmpfs0/SID;/hana/tmpfs1/SID;/hana/tmpfs2/SID;/hana/tmpfs3/SIDTo turn on persistent memory for any SAP HANA tables or partitions, complete the following steps on the compute instance that's running your workload:
Turn on persistent memory for the SAP HANA table or partition, run the following SQL query:
ALTER TABLE TABLE_OR_PARTITION_NAME persistent memory ON immediate CASCADEReplace
TABLE_OR_PARTITION_NAMEwith the name of the table or partition.Update the memory persistence settings by adding the
table_defaultparameter in theindexserver.inifile:[persistent_memory] table_default = ON
For information from SAP about how to control columns, tables, and which monitoring views provide detailed information, see Persistent Memory.
As the
SIDadmuser, start the SAP HANA database.
Modify the fast restart configuration after increasing compute instance size
After you increase the size of the compute instance that hosts your SAP HANA workload, you must update the SAP HANA Fast Restart configuration to match the new NUMA topology.
To modify the configuration of the SAP HANA Fast Restart option for such a scenario, complete the following steps:
Establish an SSH connection with the resized compute instance that runs your workload.
As the
SIDadmuser, stop the SAP HANA database.Make note of the NUMA topology of the resized compute instance:
sudo lscpu | grep NUMAClear the occupied memory by unmounting the existing
tmpfsfile systems:sudo umount /hana/tmpfs0/SID sudo umount /hana/tmpfs1/SID sudo umount /hana/tmpfs2/SID sudo umount /hana/tmpfs3/SIDReplace
SIDwith the SID of your SAP HANA database, for exampleABC.For each new NUMA node, create a directory and assign the ownership of these new directories to the SAP HANA administrator user and group:
mkdir -pv /hana/tmpfsNEW_NUMA_NODE_INDEX_RANGE/SID chown -R SID_LCadm:sapsys /hana/tmpfs*/SID chmod 777 -R /hana/tmpfs*/SID
Replace the following:
NEW_NUMA_NODE_INDEX_RANGE: the index range that denotes the new NUMA nodes. For example, imagine that your compute instance was based on them2-ultramem-208machine type, which has four NUMA nodes (0..3). If you resized your instance to use them2-ultramem-416machine type, which has 8 NUMA nodes, then you'd specify the range4..7.SID_LC: the SID in lowercase; for exampleabc
Mount each new NUMA node directory to the
tmpfsfile system:sudo mount tmpfsSIDSERIAL_NUMBER_OF_NEW_NODE -t tmpfs -o mpol=prefer:SERIAL_NUMBER_OF_NEW_NODE /hana/tmpfsSERIAL_NUMBER_OF_NEW_NODE/SIDFor example, if you resized from
m2-ultramem-208(4 NUMA nodes) tom2-ultramem-416(8 NUMA nodes) for a system with SIDABC, then you'd have to run the following:sudo mount tmpfsABC4 -t tmpfs -o mpol=prefer:4 /hana/tmpfs4/ABC sudo mount tmpfsABC5 -t tmpfs -o mpol=prefer:5 /hana/tmpfs5/ABC sudo mount tmpfsABC6 -t tmpfs -o mpol=prefer:6 /hana/tmpfs6/ABC sudo mount tmpfsABC7 -t tmpfs -o mpol=prefer:7 /hana/tmpfs7/ABCTo ensure that these mount points persist and are available after an OS reboot, add an entry for each new mount point to the
/etc/fstabfile:tmpfsSIDSERIAL_NUMBER_OF_NEW_NODE /hana/tmpfsSERIAL_NUMBER_OF_NEW_NODE/SID tmpfs rw,relatime,mpol=prefer:SERIAL_NUMBER_OF_NEW_NODEContinuing with the example:
tmpfsABC4 /hana/tmpfs4/ABC tmpfs rw,relatime,mpol=prefer:4 tmpfsABC5 /hana/tmpfs5/ABC tmpfs rw,relatime,mpol=prefer:5 tmpfsABC6 /hana/tmpfs6/ABC tmpfs rw,relatime,mpol=prefer:6 tmpfsABC7 /hana/tmpfs7/ABC tmpfs rw,relatime,mpol=prefer:7Inform the SAP HANA system about the new
tmpfslocations, update the[persistence]section of theglobal.inifile to include paths to the newtmpfslocations that you created. Separate eachtmpfslocation with a semicolon.Continuing with the example, the updated
global.inifile looks similar to the following:[persistence] basepath_persistent_memory_volumes = /hana/tmpfs0/ABC;/hana/tmpfs1/ABC;/hana/tmpfs2/ABC;/hana/tmpfs3/ABC;/hana/tmpfs4/ABC;/hana/tmpfs5/ABC;/hana/tmpfs6/ABC;/hana/tmpfs7/ABC;As the
SIDadmuser, start the SAP HANA database.
Modify the fast restart configuration after decreasing compute instance size
After you decrease the size of the compute instance that hosts your SAP HANA workload, you must update the SAP HANA Fast Restart configuration to match the new NUMA topology.
To modify the configuration of the SAP HANA Fast Restart option for such a scenario, complete the following steps:
Establish an SSH connection with the resized compute instance that runs your workload.
As the
SIDadmuser, stop the SAP HANA database.Make note of the NUMA topology of the resized compute instance:
sudo lscpu | grep NUMAClear the occupied memory by unmounting and removing the directories from the
tmpfsfile system that correspond to the reduced number of NUMA nodes on your resized compute instance:umount /hana/tmpfsNUMA_NODE_INDEX/SID rmdir /hana/tmpfsNUMA_NODE_INDEX/SIDReplace the following:
SID: the SID of your SAP HANA database, for exampleABCNUMA_NODE_INDEX: the index of the NUMA node that is no longer present
For example, image that your compute instance was based on the
m2-ultramem-208machine type, which has four NUMA nodes (0..3). If you resized your instance to use them3-ultramem-128machine type, which has two NUMA nodes, then you'd unmount and remove the directories corresponding to the NUMA nodes 2 and 3:unmount /hana/tmpfs2/ABC rmdir /hana/tmpfs2/ABC unmount /hana/tmpfs3/ABC rmdir /hana/tmpfs3/ABCTo ensure that these changes persist even after an OS reboot, remove the entries from
/etc/fstabfile that correspond to the NUMA nodes that are no longer present.Continuing with the example, the updated
/etc/fstabfile looks similar to the following:tmpfsABC0 /hana/tmpfs0/ABC tmpfs rw,relatime,mpol=prefer:0 tmpfsABC1 /hana/tmpfs1/ABC tmpfs rw,relatime,mpol=prefer:1Inform the SAP HANA system about the updated
tmpfslocations by modifying the[persistence]section of theglobal.inifile and removing paths of thetmpfslocations that you are no longer available.Continuing with the example, the updated
global.inifile looks similar to the following:[persistence] basepath_persistent_memory_volumes = /hana/tmpfs0/ABC;/hana/tmpfs1/ABC;As the
SIDadmuser, start the SAP HANA database.
Verify that the fast restart option is enabled
To verify that the SAP HANA Fast Restart option is enabled for your SAP HANA deployment, see the SAP note 3439821 - How to know if SAP HANA database Fast Restart Option (FRO) is used on your HANA database or not.