Sunday, March 20, 2022

Manual Recovery Guide for SAP HANA on Azure Large Instance from storage snapshot with AzAcSnap

Table of Contents

Version 

Authors 

Overview 

Assumptions 

Terms and Definitions 

System status 

Recover the database to its most recent state 

Recover the database to the following point in time 

Recover the database to a specific data (snapshot) backup 

Appendix - SAP HANA Data Volume locations 

 

Version

This article is for the SAP HANA on Azure Large Instances using the Microsoft AzAcSnap version 4.2 or later.

 

Authors

Phil JensenPrincipal Software Engineer at Microsoft.

 

Overview

This article provides guidance on using SAP HANA Studio to recover SAP HANA on Azure Large Instances. This article has step-by-step screenshots to follow to understand the three primary methods of recovering SAP HANA using HANA Studio from a snapshot taken using the Microsoft provided snapshot tools.

 

The screenshots in this document are from SAP HANA Studio session accessing SAP HANA 2.0SPS04. Be aware that user interfaces may vary, dependent on the specific SAP HANA release.

 

Disclaimer: This article and the associated screenshots are taken from an SAP HANA v2.0 system recovery as set up in the Microsoft test environment for SAP HANA on Azure Large Instance. Anyone following this guide is responsible for ensuring the recovery process works in their own environment as expected.

 

Assumptions

The administrator following this artcile has experience with SAP HANA and HANA Studio because not all details are provided as screenshots to follow (e.g. logging in to HANA Studio, etc.).

 

The administrator is familiar with SAP HANA backup processes, including the Backup Catalog and Storage Snapshots.

 

The administrator has the appropriate permissions at a Linux shell to copy files as the <sid>adm user into the SAP HANA Data Area.

 

Terms and Definitions

Terms used in this documentation: 

  • SID: A System Identifier for SAP HANA installation, typically 3 characters long. 
  • HLI: SAP HANA on Azure Large Instance Unit.

 

System status

The system layout used for this documentation has a “primary” SID (C31) and another second tenant (C32). 

The second tenant (C32) was created using the SQL commands:

  • CREATE DATABASE C32 SYSTEM USER PASSWORD <SomePassword>

 

The primary data area is under “/hana/data/C31/mnt00001”.  Further explanation of the SAP HANA persistent data storage area is in the Appendix.

 

Recover the database to its most recent state

In this case the goal is to restore the complete system (SYSTEMDB, C31, C32) from a snapshot to the most recent database state, including any log replay.

 

  1. First step is to stop the database
    GeertVanTeylingen_0-1646833579732.png
    GeertVanTeylingen_1-1646833589533.png
    When this is finished, the Processes tab should display as follows:
    GeertVanTeylingen_2-1646833608105.png
  2. Start the recovery process from the menu.
    GeertVanTeylingen_3-1646833719839.png

    Note, the recovery wizard can take several seconds to launch (see the following status)

    GeertVanTeylingen_4-1646833758289.png

     

  1. Choose the recovery type, in this case “Recover the database to its most recent state”
    GeertVanTeylingen_6-1646833801349.png

     

 

  1. Choose the location of the backup catalog, which is needed for recovery.
    GeertVanTeylingen_7-1646833823580.png

 

  1. The backup catalog will be fetched to display the appropriate backup to recover from (this can take a minute or two to load).
    GeertVanTeylingen_8-1646833852062.png

 

  1. The first time the backup catalog is refreshed, its likely no suitable snapshot will be found to restore from.  This is because the administrator will need to copy/restore the files from the snapshot into the data area.
    GeertVanTeylingen_9-1646833887753.png
  1. In this example, the files are copied from the “hidden” snapshot location in the filesystem.
    # su - c31adm
    
    > cp -pr /hana/data/C31/mnt00001/.snapshot/hana_hourly.2019-09-15_2100.1/* /hana/data/C31/mnt00001/.

     

  1. When the copy is complete, refresh the view of the backup catalog to ensure the snapshot we are restoring from is listed.
    GeertVanTeylingen_10-1646833986716.png

 

  1. Now select the available SNAPSHOT shown in green to recover from.
    GeertVanTeylingen_11-1646834017875.png

     

  1. Choose the location of the Log Backups.
    GeertVanTeylingen_12-1646834047656.png

     

  1. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_13-1646834096188.png

     

  1. On the summary page, review any final details and press Finish to restore the system database.
    GeertVanTeylingen_14-1646834126679.png

     

  1. When the recovery has finished a Recovery Execution Summary provides details of the recovery.  The following screen shows a completed recovery of the SYSTEMDB.

    GeertVanTeylingen_15-1646834155517.png

     

    (!) NOTE:

    Note the message stating “recovering the system database from a storage snapshot invalidates all the tenant databases”. Tenant databases must now be recovered.
  1. Start the recovery of the Tenant database.
    GeertVanTeylingen_16-1646834253483.png

      

  1. Choose the Tenant to recover from.
    GeertVanTeylingen_17-1646834283716.png

     

  1. Choose to recover the tenant database to its most recent state (same as for the system database).
    GeertVanTeylingen_18-1646834315032.png

     

  1. Provide the location of the Backup Catalog (same as for the system database).
    GeertVanTeylingen_19-1646834343104.png

     

  1. Allow the tenant database to be stopped for recovery.
    GeertVanTeylingen_20-1646834366932.png

     

  1. Wait for the Backup Catalog to be refreshed and displayed.
    GeertVanTeylingen_21-1646834396089.png

     

  1. When recovering the tenant database there should already be a valid snapshot to recover from (unlike the system database where we needed to restore the snapshot files into the data area and refresh the view).  Select this snapshot and click next.
    GeertVanTeylingen_1-1646922245804.png

     

  2. Specify any locations for log backups to include in the recovery process.
    GeertVanTeylingen_2-1646922444006.png

     

  3. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_3-1646922472296.png

     

  4. On the summary page, review any final details and press Finish to restore the tenant database. Select Finish to proceed with the recovery.
    GeertVanTeylingen_4-1646928818247.pngGeertVanTeylingen_5-1646922561805.png

     

     

  5. The recovery process can take a few minutes, depending on database size and log files to process.
    GeertVanTeylingen_6-1646922602592.png

     


  6. When the recovery has finished a Recovery Execution Summary provides details of the recovery. The following screen shows a completed recovery of the TENANT DB.
    GeertVanTeylingen_7-1646922625419.png

     


  7. The following screenshot shows the database after recovery with some services running.
    GeertVanTeylingen_9-1646922662937.png

     

    Note, there is no process for C32 running, this tenant still needs to be recovered.

 

Repeat the steps 14-25 to recover any other tenants.

 

In our example, after recovering tenant C32, the process list looks like the following:
GeertVanTeylingen_6-1646834966161.png

 

A process listing can also be retrieved form the command line when logged in as the <sid>adm user.

 

 

 

 

> /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList

15.09.2019 23:51:43
GetProcessList
OK
name, description, dispstatus, textstatus, starttime, elapsedtime, pid
hdbdaemon, HDB Daemon, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 28998
hdbcompileserver, HDB Compileserver, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29598
hdbindexserver, HDB Indexserver-C31, GREEN, Running, 2019 09 15 23:21:34, 0:30:09, 31935
hdbindexserver, HDB Indexserver-C32, GREEN, Running, 2019 09 15 23:37:51, 0:13:52, 36538
hdbnameserver, HDB Nameserver, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 29017
hdbpreprocessor, HDB Preprocessor, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29601
hdbwebdispatcher, HDB Web Dispatcher, GREEN, Running, 2019 09 15 23:09:29, 0:42:14, 29648
hdbxsengine, HDB XSEngine-C31, GREEN, Running, 2019 09 15 23:21:53, 0:29:50, 32071

 

 

 

 

Recover the database to the following point in time

This process allows recovery of the database to a specific point in time, perhaps just prior to an invalid transaction.

 

  1. First step is to stop the database.
    GeertVanTeylingen_0-1646924119541.png
    GeertVanTeylingen_1-1646924139860.png

    When this is finished, the Processes tab should display as follows:

    GeertVanTeylingen_2-1646924177058.png

  2. Start the recovery process from the menu.
    GeertVanTeylingen_3-1646924219159.png

    Note, the recovery wizard can take several seconds to launch (see the following status):

    GeertVanTeylingen_5-1646924259985.png

  3. Choose the recovery type, in this case “Recover the database to the following point in time”, in this example the time stamp chosen is 16-September-2019 05:00:00 (in 24 hour UTC/GMT).
    GeertVanTeylingen_6-1646924287329.png
    (!) NOTE:

    The time used is based on UTC/GMT.
  4. Confirm the recovery to continue, noting the potential for lost data.
    GeertVanTeylingen_7-1646924406675.png

  5. Choose the location of the backup catalog, which is needed for recovery.
    GeertVanTeylingen_8-1646924422933.png

  6. The backup catalog will be fetched to display the appropriate backup to recover from (this can take a minute or two to load).
    GeertVanTeylingen_9-1646924456923.png

  7. The first time the backup catalog is refreshed, its likely no suitable snapshot will be found to restore from.  This is because the administrator will need to copy/restore the files from the snapshot into the data area.
    GeertVanTeylingen_10-1646924483022.png

  8. In this example, the files can be copied from the “hidden” snapshot location in the filesystem.
    su – c31adm
    
    > cp -pr /hana/data/C31/mnt00001/.snapshot/hana_hourly.2019-09-15_2100.2/* /hana/data/C31/mnt00001/.
    

  9. When the copy is complete, refresh the view of the backup catalog to ensure the snapshot we are restoring from is listed.
    GeertVanTeylingen_11-1646924531117.png

  10. Now select the available SNAPSHOT shown in green to recover from.
    GeertVanTeylingen_12-1646924555610.png

  11. Choose the location of the Log Backups.
    GeertVanTeylingen_13-1646924581320.png

  12. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_14-1646924606640.png

  13. On the summary page, review any final details and press Finish to restore the system database.
    GeertVanTeylingen_15-1646924629017.png

  14. When the recovery has finished a Recovery Execution Summary provides details of the recovery.  The following screen shows a completed recovery of the SYSTEMDB.
    GeertVanTeylingen_16-1646924653114.png
    (!) NOTE:

    Note the message stating “recovering the system database from a storage snapshot invalidates all the tenant databases”. Tenant databases must now be recovered.
  15. Start the recovery of the Tenant database.
    GeertVanTeylingen_17-1646924703869.png

  16. Choose the Tenant to recover from.  At the time of writing, only a single tenant database is supported by SAP to recover from. 
    GeertVanTeylingen_19-1646924756349.png

  17. Choose to recover the tenant database to the following point in time (same as for the system database). 
    GeertVanTeylingen_20-1646924779996.png
    (!) NOTE:

    The time used is based on UTC/GMT.

     

  18. Provide the location of the Backup Catalog (same as for the system database).
    GeertVanTeylingen_21-1646924824101.png

  19. Allow the tenant database to be stopped for recovery.
    GeertVanTeylingen_22-1646924844682.png

  20. Wait for the Backup Catalog to be refreshed and displayed.
    GeertVanTeylingen_23-1646924866938.png

  21. When recovering the tenant database there should already be a valid snapshot to recover from (unlike the system database where we needed to restore the snapshot files into the data area and refresh the view).  Select this snapshot and click next.
    GeertVanTeylingen_24-1646924895958.png

  22. Specify any locations for log backups to include in the recovery process.
    GeertVanTeylingen_25-1646924922964.png

  23. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_26-1646924946954.png

  24. On the summary page, review any final details and press Finish to restore the tenant database. Select Finish to proceed with the recovery.
    GeertVanTeylingen_27-1646924975289.png

  25. The recovery process can take a few minutes, depending on database size and log files to process.
    GeertVanTeylingen_28-1646925005586.png

  26. When the recovery has finished a Recovery Execution Summary provides details of the recovery. The following screen shows a completed recovery of the TENANT DB.
    GeertVanTeylingen_29-1646925078895.png

  27. The following screenshot shows the database after recovery with some services running.
    GeertVanTeylingen_30-1646925100037.png

    Note, there is no process for C32 running, this tenant still needs to be recovered.

 

Repeat the steps 14-25 to recover any other tenants.

 

In our example, after recovering tenant C32, the process list looks like the following:
GeertVanTeylingen_4-1646836730918.png

 

A process listing can also be retrieved form the command line when logged in as the <sid>adm user.

 

 

 

 

> /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList

15.09.2019 23:51:43
GetProcessList
OK
name, description, dispstatus, textstatus, starttime, elapsedtime, pid
hdbdaemon, HDB Daemon, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 28998
hdbcompileserver, HDB Compileserver, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29598
hdbindexserver, HDB Indexserver-C31, GREEN, Running, 2019 09 15 23:21:34, 0:30:09, 31935
hdbindexserver, HDB Indexserver-C32, GREEN, Running, 2019 09 15 23:37:51, 0:13:52, 36538
hdbnameserver, HDB Nameserver, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 29017
hdbpreprocessor, HDB Preprocessor, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29601
hdbwebdispatcher, HDB Web Dispatcher, GREEN, Running, 2019 09 15 23:09:29, 0:42:14, 29648
hdbxsengine, HDB XSEngine-C31, GREEN, Running, 2019 09 15 23:21:53, 0:29:50, 32071

 

 

 

 

Recover the database to a specific data (snapshot) backup

This process recovers the database to a specific snapshot only (i.e. no log replay).

 

  1. First step is to stop the database. 
    GeertVanTeylingen_1-1646928613171.pngGeertVanTeylingen_2-1646928628476.png

    When this is finished, the Processes tab should display as follows:

    GeertVanTeylingen_3-1646928656394.png

  2. Start the recovery process from the menu.
     
    GeertVanTeylingen_5-1646928827324.png

    Note, the recovery wizard can take several seconds to launch (see the following status):

    GeertVanTeylingen_6-1646928856424.png

  3. Choose the recovery type, in this case “Recover the database to a specific data backup”.
    GeertVanTeylingen_7-1646928873727.png

  4. Confirm the recovery to continue, noting the potential for lost data.
    GeertVanTeylingen_8-1646928895524.png

  5. As there will be no log replay, continue to “Recover without the backup catalog”.
    GeertVanTeylingen_9-1646928914886.png

  6. Specify the Backup to Recover, Destination Type = Snapshot.
    GeertVanTeylingen_10-1646928939399.png

  7. Note this restore method will Initialize Log Area. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_11-1646928962676.png

  8. Restore the snapshot files to the data area.  In this example, the files can be copied from the “hidden” snapshot location in the filesystem.
    # su – c31adm
    > cp -pr /hana/data/C31/mnt00001/.snapshot/hana_hourly.2019-09-15_2100.2/* /hana/data/C31/mnt00001/.

  9. On the summary page, review any final details.  Make sure you have copied/restored the snapshot files to the data area, if the copy has completed then press Finish to restore the system database.
    GeertVanTeylingen_12-1646929033733.png

  10. When the recovery has finished a Recovery Execution Summary provides details of the recovery.  The following screen shows a completed recovery of the SYSTEMDB.
    GeertVanTeylingen_13-1646929063472.png
    (!) NOTE:

    Note the message stating “recovering the system database from a storage snapshot invalidates all the tenant databases”. Tenant databases must now be recovered.
  11. Start the recovery of the Tenant database.
    GeertVanTeylingen_14-1646929104815.png

  12. Choose the Tenant to recover from.  At the time of writing, only a single tenant database is supported by SAP to recover from.
    GeertVanTeylingen_16-1646929161650.png

  13. Choose to recover the tenant database to a specific data backup.
    GeertVanTeylingen_17-1646929183689.png

  14. As there will be no log replay, continue to “Recover without the backup catalog”.
    GeertVanTeylingen_18-1646929208294.png

  15. Specify the Backup to Recover, Destination Type = Snapshot.
    GeertVanTeylingen_19-1646929334763.png

  16. Note this restore method will Initialize Log Area. Check any appropriate “Other Settings”, the following screen is the defaults.
    GeertVanTeylingen_20-1646929354814.png

  17. There is no need to restore the snapshot files to the data area as this was done when recovering the system database.

  18. On the summary page, review any final details and press Finish to restore the system database.
    GeertVanTeylingen_21-1646929381465.png

  19. When the recovery has finished a Recovery Execution Summary provides details of the recovery.  The following screen shows a completed recovery of the tenant database.
    GeertVanTeylingen_22-1646929400025.png

  20. The following screenshot shows the database after recovery with some services running.
    GeertVanTeylingen_23-1646929427795.png

    Note, there is no process for C32 running, this tenant still needs to be recovered.

 

Repeat the steps 11-20 to recover any other tenants.

 

In our example, after recovering tenant C32, the process list looks like the following:

A process listing can also be retrieved form the command line when logged in as the <sid>adm user.

 

 

 

 

> /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList

15.09.2019 23:51:43
GetProcessList
OK
name, description, dispstatus, textstatus, starttime, elapsedtime, pid
hdbdaemon, HDB Daemon, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 28998
hdbcompileserver, HDB Compileserver, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29598
hdbindexserver, HDB Indexserver-C31, GREEN, Running, 2019 09 15 23:21:34, 0:30:09, 31935
hdbindexserver, HDB Indexserver-C32, GREEN, Running, 2019 09 15 23:37:51, 0:13:52, 36538
hdbnameserver, HDB Nameserver, GREEN, Running, 2019 09 15 23:08:57, 0:42:46, 29017
hdbpreprocessor, HDB Preprocessor, GREEN, Running, 2019 09 15 23:09:28, 0:42:15, 29601
hdbwebdispatcher, HDB Web Dispatcher, GREEN, Running, 2019 09 15 23:09:29, 0:42:14, 29648
hdbxsengine, HDB XSEngine-C31, GREEN, Running, 2019 09 15 23:21:53, 0:29:50, 32071

 

 

 

 

Appendix – SAP HANA Data Volume locations

 

A detailed explanation of persistent data storage can be found in the “SAP HANA Administration Guide for SAP HANA Platform” - “Persistent Data Storage in the SAP HANA Database” section.

 

The following diagram is taken from the “Data and Log Volumes” sub-section. This shows the Directory Hierarchy for Persistent Data Storage (System with Multitenant Database Containers) for SAP HANA.  Note the separation of System DB and Tenant DB files into logically grouped sub-directories.  The volume names of tenant databases have a suffix to represent the database. For example, the indexserver volume for the first tenant database is hdb00002.00002, for the second database hdb00002.000003, and so on.  For example, Tenant DB 1 data storage is grouped into both “hdb00002.00003” and “hdb00003.00003” sub-directories for the indexserver and xsengine respectively. 

GeertVanTeylingen_24-1646840056152.png

Posted at https://sl.advdat.com/3CUxfgkhttps://sl.advdat.com/3CUxfgk