Perform backup and recovery for SAP HANA using disk snapshots

This guide shows you how to perform backup and recovery operations for SAP HANA by using the disk snapshot feature of Google Cloud's Agent for SAP.

For information about this feature, see Disk snapshot based backup and recovery for SAP HANA.

Before you begin

Set permissions

To use Google Cloud's Agent for SAP for performing disk snapshot based backup and recovery for your SAP HANA system, you must set the following permissions:

  • To create disk snapshots, enable the following IAM permissions:
    • For the Google Cloud project where your SAP HANA system runs, enable the compute.snapshots.create permission.
    • For the service account used by your Compute Engine VM instance, enable the following permissions: compute.disks.createSnapshot, compute.snapshot.list, and compute.disk.list.
  • To create disk snapshot based backups, the SAP HANA database user used by the agent must have the BACKUP OPERATOR or BACKUP ADMIN privilege. For more information, see the SAP document Authorizations Needed for Backup and Recovery
  • To perform the backup and recovery operations, the operating system user running the agent's commands must either be the root user, or have sudo access to run the following commands. You can also provide sudo access by creating a group in your /etc/sudoers.d directory, for example:

    %sapagent_snapshot_sudoers ALL=(ALL:ALL) NOPASSWD:/sbin/lvdisplay, /sbin/vgscan, /sbin/dmsetup, /sbin/lvscan, /usr/sbin/xfs_freeze, /usr/bin/google_cloud_sap_agent

Create a disk snapshot based backup

  • To create a disk snapshot based backup for the /hana/data volume of your SAP HANA database, run the hanadiskbackup command of Google Cloud's Agent for SAP:

    sudo /usr/bin/google_cloud_sap_agent hanadiskbackup \
        -project=DESTINATION_PROJECT_ID \
        -host=HANA_HOST_ADDRESS \
        -port=HANA_PORT_NUMBER \
        -sid=SID \
        -hana-db-user=HANA_USERNAME \
        -password-secret=HANA_USER_PWD_SECRET_NAME \
        -source-disk=SOURCE_DISK_NAME \
        -source-disk-zone=SOURCE_DISK_ZONE

    Replace the following:

    • DESTINATION_PROJECT_ID: the ID of the Google Cloud project in which you want to create the disk snapshot
    • HANA_HOST_ADDRESS: the hostname or IP address of the Compute Engine VM instance that hosts your SAP HANA database

      In a high-availability (HA) system, specify the hostname or IP address of the local host in the primary SAP HANA node. Don't use the virtual IP (VIP) used in the cluster to identify the primary node. In a disaster recovery (DR) deployment, specify the hostname or IP address of the local host in the primary SAP HANA instance.

    • HANA_PORT_NUMBER: the SAP HANA port that accepts the backup and recovery requests

    • SID: the SAP system identifier (SID) of your SAP HANA system

    • HANA_USERNAME: the SAP HANA database username using which you want to create the backup

    • HANA_USER_PWD_SECRET_NAME: if you're using Secret Manager to store the SAP HANA database user's password, then specify the corresponding secret name

    • SOURCE_DISK_NAME: the name of the Persistent Disk or Hyperdisk volume that hosts the /hana/data volume

    • SOURCE_DISK_ZONE: the name of the zone where the disk hosting the /hana/data volume is deployed

    The following table describes the arguments supported by the hanadiskbackup command:

    Argument Description
    -port Specify the SAP HANA port that accepts the backup and recovery requests.
    -sid Specify the SAP system identifier (SID) of your SAP HANA system.
    -hana-db-user Specify the SAP HANA database username using which you want to create the backup.
    -password

    Specify the password of the SAP HANA database user that you use to create the backup.

    Don't specify this argument if you're using the -password-secret argument. We recommend that you use -password-secret.

    -password-secret

    Optional. If you're using Secret Manager to store the SAP HANA database user's password, then specify the corresponding secret name.

    In Secret Manager, make sure that the Secret value, which is the password, contains at least 8 characters and includes at least one uppercase letter, one lowercase letter, and a number.

    Don't specify this argument if you're using the -password argument.

    -host Optional. Specify the IP address of the Compute Engine VM instance that hosts your SAP HANA system. The default value is localhost.
    -project Optional. Specify the ID of the Google Cloud project where you want to create the disk snapshot. By default, the snapshot is created in the Google Cloud project where your SAP HANA system is running.
    -abandon-prepared Optional. Specifies whether to ignore any existing disk snapshot or not. The default value is false.
    -snapshot-name

    Optional. Specify the name for the disk snapshot that you're creating.

    By default, the snapshot is named in the following format: snapshot-SOURCE_DISK_NAME-YYYYMMDD-HHMMSS.

    -source-disk Specify the name of the Persistent Disk or Hyperdisk volume that hosts your /hana/data volume.
    -source-disk-zone Specify the zone where the disk hosting the /hana/data volume exists.
    -source-disk-key-file Optional. If the disk hosting the /hana/data volume is encrypted by an RSA-wrapped customer-supplied encryption key, then specify the absolute path to that key's JSON file.

    This argument is supported from version 3.2 of the agent.

    -storage-location Optional. Specify the Cloud Storage multi-region or Cloud Storage region where you want to store your disk snapshot.
    -snapshot-description Optional. Specify a description for the disk snapshot.
    -labels Optional. Specify one or more label-value pairs that you want to associate with the disk snapshot you're creating. For example: -labels="label1=value1,label2=value2".
    -send-metrics-to-monitoring Optional. Specifies whether or not the execution status of the snapshot creation is sent to Cloud Monitoring. The default value is TRUE.
    -loglevel Optional. Specify the logging level for the snapshot creation operation. The default logging level is info. The available log levels are: debug, info, warn, and error.

Verify the disk snapshot

You can verify that the disk snapshot is created by using the following options:

  • In the Google Cloud console, go to the Compute Engine Snapshots page, and then filter the entries using the disk or snapshot name.

    Go to Snapshots

  • Alternatively, you can also view the disk snapshot details in the following log file of Google Cloud's Agent for SAP:

    /var/log/google-cloud-sap-agent/hanadiskbackup.log

Review the SAP HANA backup catalog

In addition to creating the disk snapshot, the hanadiskbackup command creates an entry for the snapshot in your SAP HANA backup catalog. The following is an example SQL query to view the disk snapshot entries in the SAP HANA backup catalog:

SELECT BACKUP_ID, STATE_NAME, COMMENT FROM M_BACKUP_CATALOG WHERE ENTRY_TYPE_NAME = 'data snapshot'

The output is similar to the following example:

BACKUP_ID,STATE_NAME,COMMENT
BACKUP_ID,"successful","snapshot-SOURCE_DISK_NAME-YYYYMMDD-HHMMMSS"

This output includes the following values:

  • BACKUP_ID: the backup ID assigned to the disk snapshot in your SAP HANA backup catalog
  • SOURCE_DISK_NAME: the name of the disk hosting your /hana/data volume, for which you created a snapshot
  • YYYYMMDD-HHMMMSS: the date and time when the snapshot was created

Perform recovery by using a disk snapshot

To perform disk snapshot based recovery using Google Cloud's Agent for SAP, see the instructions for your scenario:

Recover the database for a scale-up system

To recovery the database for an SAP HANA scale-up system deployed on Google Cloud, complete the following steps:

  1. Recover the disk hosting the /hana/data volume by running the agent's hanadiskrestore command:

    sudo /usr/bin/google_cloud_sap_agent hanadiskrestore \
        -project=SOURCE_PROJECT_ID \
        -sid=SID \
        -source-snapshot=SOURCE_SNAPSHOT_NAME \
        -data-disk-name=SOURCE_DISK_NAME \
        -data-disk-zone=SOURCE_DISK_ZONE \
        -new-disk-type=NEW_DISK_TYPE \
        -new-disk-name=NEW_DISK_NAME

    Replace the following:

    • SOURCE_PROJECT_ID: the ID of the Google Cloud project in which the disk snapshot exists
    • SID: the SAP system identifier (SID) of your SAP HANA system
    • SOURCE_SNAPSHOT_NAME: the name of the disk snapshot using which you're creating the new disk
    • SOURCE_DISK_NAME: the name of the source disk that is hosting your /hana/data volume
    • SOURCE_DISK_ZONE: the name of the zone where the source disk is deployed

    For information about the arguments that you can use with the hanadiskrestore command, see Supported arguments for disk restoration.

  2. Recover your SAP HANA database using the required option:

    Recover to snapshot time

    To recover you SAP HANA database by restoring it to the time the disk snapshot was created, follow these steps:

    1. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    2. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command="RECOVER DATA USING SNAPSHOT CLEAR LOG;"
    3. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    4. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATA FOR TENANT_SID USING SNAPSHOT CLEAR LOG

      Replace TENANT_SID with the SID of the tenant database.

    Recover to a specific point in time

    To recover you SAP HANA database by restoring it to a specific point in time, follow these steps:

    1. Verify that you have created a backup for the /hana/log volume in Cloud Storage by using the Backint feature of Google Cloud's Agent for SAP. For more information about this feature, see Backint based backup and recovery for SAP HANA.
    2. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    3. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command "RECOVER DATABASE UNTIL TIMESTAMP 'YYYY-MM-DD HH:MM:SS' CLEAR LOG USING SNAPSHOT"
    4. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    5. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATABASE FOR TENANT_SID UNTIL TIMESTAMP '2099-12-31 12:00:00' CLEAR LOG USING SNAPSHOT

      Replace TENANT_SID with the SID of the tenant database.

Supported arguments for disk restoration

The following table describes the arguments supported by the agent's hanadiskrestore command:

Argument Description
-sid Specify the SAP system identifier (SID) of your SAP HANA system.
-data-disk-name Specify the name of the source disk that hosts the /hana/data volume.
-data-disk-zone Specify the zone where the source disk that hosts the /hana/data volume, is deployed.
-source-snapshot Specify the name of the disk snapshot using which you want to recover the disk hosting your SAP HANA data volume.
-new-disk-name Specify the name that you want to set for the new disk.
-project Optional. Specify the ID of the Google Cloud project in which the source disk snapshot exists. By default, the snapshot is created in the Google Cloud project where your SAP HANA system is running.
-csek-key-file Optional. If you encrypted the source disk snapshot by using the -source-disk-key-file argument with the hanadiskbackup command, then specify the absolute path to the JSON file of the RSA-wrapped customer-supplied encryption key that corresponds to the source disk snapshot. The following is an example key file:
[
  {
    "uri": "https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/snapshots/SNAPSHOT_NAME",
    "key": "ieCx/NcW06PcT7Ep1X6LUTc/hLvUDYyzSZPPVCVPTVEohpeHASqC8uw5TzyO9U+Fka9JFHz0mBibXUInrC/jEk014kCK/NPjYgEMOyssZ4ZINPKxlUh2zn1bV+MCaTICrdmuSBTWlUUiFoDD6PYznLwh8ZNdaheCeZ8ewEXgFQ8V+sDroLaN3Xs3MDTXQEMMoNUXMCZEIpg9Vtp9x2oeQ5lAbtt7bYAAHf5l+gJWw3sUfs0/Glw5fpdjT8Uggrr+RMZezGrltJEF293rvTIjWOEB3z5OHyHwQkvdrPDFcTqsLfh+8Hr8g+mf+7zVPEC8nEbqpdl3GPv3A7AwpFp7MA==",
    "key-type": "rsa-encrypted"
  }
]

This argument is supported from version 3.2 of the agent.

-new-disk-type

Optional. Specify the type of Persistent Disk or Hyperdisk that you want to create. By default, the new disk is of the same type of as the source disk.

Make sure that you specify an SSD-based disk type that is certified by SAP for use with SAP HANA. For more information, see Supported disk types.

-hana-sidadm Optional. Specify the SIDadm - the operating system user of your SAP HANA system.
-force-stop-hana Optional. If you want to forcefully stop SAP HANA before the initiating the recovery operation, then specify this argument and set its value to true. The default value is false.
-provisioned-iops Optional. If you're creating a Hyperdisk volume, then specify the IOPS (input/output operations per second) that it must handle.
-provisioned-throughput Optional. If you're creating a Hyperdisk volume, then specify the throughput it must support.
-disk-size-gb

Optional. Specify the size, in GB, for the new disk. By default, the new disk is of the same size as the existing disk.

The new disk must not be smaller in size than the existing disk.

-loglevel Optional. Specify the logging level for all the actions performed by the hanadiskrestore command. The default logging level is info. The available log levels are: debug, info, warn, and error.

Recover the database for a scale-up HA system

To recover the database for an SAP HANA scale-up system deployed in a high-availability (HA) cluster on Google Cloud, complete the following steps:

  1. Verify that you have a snapshot of the disk hosting the /hana/data volume in your primary SAP HANA node.

  2. As the root user, put the HA cluster in maintenance mode. If you're using Pacemaker, then run the following command:

    RHEL

    pcs property set maintenance-mode=true

    SLES

    crm configure property maintenance-mode=true
  3. Stop your SAP HANA database instances by running the following command on both the primary and standby nodes of your HA cluster:

    HDB stop
  4. Switch to the primary node of your SAP HANA HA system.

  5. Recover the disk hosting the /hana/data volume by running the agent's hanadiskrestore command:

    sudo /usr/bin/google_cloud_sap_agent hanadiskrestore \
        -project=SOURCE_PROJECT_ID \
        -sid=SID \
        -source-snapshot=SOURCE_SNAPSHOT_NAME \
        -data-disk-name=SOURCE_DISK_NAME \
        -data-disk-zone=SOURCE_DISK_ZONE \
        -new-disk-type=NEW_DISK_TYPE \
        -new-disk-name=NEW_DISK_NAME

    Replace the following:

    • SOURCE_PROJECT_ID: the ID of the Google Cloud project in which the disk snapshot exists
    • SID: the SAP system identifier (SID) of your SAP HANA system
    • SOURCE_SNAPSHOT_NAME: the name of the disk snapshot using which you're creating the new disk
    • SOURCE_DISK_NAME: the name of the source disk that is hosting your /hana/data volume
    • SOURCE_DISK_ZONE: the name of the zone where the source disk is deployed

    For information about the arguments that you can use with the hanadiskrestore command, see Supported arguments for disk restoration.

  6. Unregister the secondary node of your SAP HANA HA system:

    hdbnsutil -sr_unregister
  7. On the primary node of your SAP HANA HA system, disable the SAP HANA system replication:

    hdbnsutil -sr_disable
  8. On the primary node, recover your SAP HANA database using the required option:

    Recover to snapshot time

    To recover you SAP HANA database by restoring it to the time the disk snapshot was created, follow these steps:

    1. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    2. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command="RECOVER DATA USING SNAPSHOT CLEAR LOG;"
    3. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    4. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATA FOR TENANT_SID USING SNAPSHOT CLEAR LOG

      Replace TENANT_SID with the SID of the tenant database.

    Recover to a specific point in time

    To recover you SAP HANA database by restoring it to a specific point in time, follow these steps:

    1. Verify that you have created a backup for the /hana/log volume in Cloud Storage by using the Backint feature of Google Cloud's Agent for SAP. For more information about this feature, see Backint based backup and recovery for SAP HANA.
    2. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    3. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command "RECOVER DATABASE UNTIL TIMESTAMP 'YYYY-MM-DD HH:MM:SS' CLEAR LOG USING SNAPSHOT"
    4. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    5. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATABASE FOR TENANT_SID UNTIL TIMESTAMP '2099-12-31 12:00:00' CLEAR LOG USING SNAPSHOT

      Replace TENANT_SID with the SID of the tenant database.

  9. On the primary node, enable the SAP HANA system replication:

    hdbnsutil -sr_enable --name=PRIMARY_SITE_NAME
  10. Re-register the standby node with the primary node:

    hdbnsutil -sr_register
       --name=SECONDARY_SITE_NAME
       --remoteHost=PRIMARY_HOST_NAME
       --remoteInstance=INSTANCE_NUMBER
       --replicationMode=sync
       --operationMode=logreplay
  11. Verify that database in the standby node is fully synchronized with the database in the primary node.

  12. As the root user, exit the HA cluster maintenance mode. If you're using Pacemaker, then run the following command:

    RHEL

    pcs property set maintenance-mode=false

    SLES

    crm configure property maintenance-mode=false

Recover the database for a scale-up DR deployment

To recover the database for an SAP HANA scale-up system that is deployed with a disaster recovery solution on Google Cloud, complete the following steps:

  1. Stop your SAP HANA databases by running the following command on both the primary and standby instances of your DR deployment:

    HDB stop
  2. Switch to the primary instance of your SAP HANA DR deployment.

  3. Recover the disk hosting the /hana/data volume by running the agent's hanadiskrestore command:

    sudo /usr/bin/google_cloud_sap_agent hanadiskrestore \
        -project=SOURCE_PROJECT_ID \
        -sid=SID \
        -source-snapshot=SOURCE_SNAPSHOT_NAME \
        -data-disk-name=SOURCE_DISK_NAME \
        -data-disk-zone=SOURCE_DISK_ZONE \
        -new-disk-type=NEW_DISK_TYPE \
        -new-disk-name=NEW_DISK_NAME

    Replace the following:

    • SOURCE_PROJECT_ID: the ID of the Google Cloud project in which the disk snapshot exists
    • SID: the SAP system identifier (SID) of your SAP HANA system
    • SOURCE_SNAPSHOT_NAME: the name of the disk snapshot using which you're creating the new disk
    • SOURCE_DISK_NAME: the name of the source disk that is hosting your /hana/data volume
    • SOURCE_DISK_ZONE: the name of the zone where the source disk is deployed

    For information about the arguments that you can use with the hanadiskrestore command, see Supported arguments for disk restoration.

  4. On the primary instance, disable the SAP HANA system replication:

    hdbnsutil -sr_disable
  5. On the primary instance, recover your SAP HANA database using the required option:

    Recover to snapshot time

    To recover you SAP HANA database by restoring it to the time the disk snapshot was created, follow these steps:

    1. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    2. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command="RECOVER DATA USING SNAPSHOT CLEAR LOG;"
    3. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    4. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATA FOR TENANT_SID USING SNAPSHOT CLEAR LOG

      Replace TENANT_SID with the SID of the tenant database.

    Recover to a specific point in time

    To recover you SAP HANA database by restoring it to a specific point in time, follow these steps:

    1. Verify that you have created a backup for the /hana/log volume in Cloud Storage by using the Backint feature of Google Cloud's Agent for SAP. For more information about this feature, see Backint based backup and recovery for SAP HANA.
    2. Switch to the SIDadm user:
      su - SID_LCadm

      Replace SID_LC with the SID of your SAP HANA system. Use lowercase for any letters.

    3. Recover the system database by running the following command:
      HDBSettings.sh recoverSys.py --command "RECOVER DATABASE UNTIL TIMESTAMP 'YYYY-MM-DD HH:MM:SS' CLEAR LOG USING SNAPSHOT"
    4. Connect to the system database. For example, you can run the following command:
      hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

      Replace the following:

      • SYSTEM_DB_PASSWORD: your system database password
      • INSTANCE_NUMBER: your SAP HANA instance number
    5. Recover the tenant databases by running the following command for each tenant database:
      RECOVER DATABASE FOR TENANT_SID UNTIL TIMESTAMP '2099-12-31 12:00:00' CLEAR LOG USING SNAPSHOT

      Replace TENANT_SID with the SID of the tenant database.

  6. On the primary instance, enable the SAP HANA system replication:

    hdbnsutil -sr_enable --name=PRIMARY_SITE_NAME
  7. Register the standby instance with the primary instance:

    hdbnsutil -sr_register
       --name=SECONDARY_SITE_NAME
       --remoteHost=PRIMARY_HOST_NAME
       --remoteInstance=INSTANCE_NUMBER
       --replicationMode=sync
       --operationMode=logreplay
  8. Verify that database in the standby instance is fully synchronized with the database in the primary instance.

Perform a system copy or system refresh

To use a disk snapshot based backup of an SAP HANA system to perform recovery in another SAP HANA system, complete the following steps:

  1. In the source system, create a snapshot based backup by running the agent's hanadiskbackup command. For instructions, see Create a disk snapshot based backup.
  2. If the SIDs of the source and target systems are different, then rename the /hana/data/SID directory in the source system so that it matches the target system:

    mv /hana/data/SOURCE_SID /hana/data/TARGET_SID

    Replace the following:

    • SOURCE_SID: the SID of the source SAP HANA system
    • TARGET_SID: the SID of the target SAP HANA system
  3. In the target system, recover the disk hosting the /hana/data volume by running the agent's hanadiskrestore command.

  4. In the target system, recover the system database:

    HDBSettings.sh recoverSys.py --command "RECOVER DATABASE UNTIL TIMESTAMP '2099-12-31 12:00:00' CLEAR LOG USING SOURCE 'SYSTEMDB@SOURCE_SID' USING CATALOG BACKINT USING SNAPSHOT"
  5. If you want your tenant database to have the source system's SID, then you can rename it by following the instructions in the SAP HANA document Rename a Tenant Database.

  6. In the target system, connect to the system database. For example, you can run the following command:

    hdbsql -d SYSTEMDB -u system -p "SYSTEM_DB_PASSWORD" -i INSTANCE_NUMBER

    Replace the following:

    • SYSTEM_DB_PASSWORD: your system database password
    • INSTANCE_NUMBER: your SAP HANA instance number
  7. In the target system, recover the tenant databases by running the following command for each tenant database:

    RECOVER DATABASE FOR TARGET_SID UNTIL TIMESTAMP '2023-12-08 23:59:00' CLEAR LOG USING SOURCE 'TARGET_SID@SOURCE_SID' USING CATALOG BACKINT USING SNAPSHOT

Validate snapshot consistency

This section describes how you can validate the consistency of the data in your disk snapshot by using the hdbpersdiag tool from SAP. For information about other best practices recommended by Google Cloud for disk snapshot based backup and recovery operations, see Best practices.

To validate the consistency of a snapshot, complete the following steps:

  1. Create a disk from a snapshot that you created by using the agent's hanadiskbackup command. Use the gcloud compute disks create command:

    gcloud compute disks create DISK_NAME \
       --size=SIZE \
       --source-snapshot=SNAPSHOT_NAME \
       --type=DISK_TYPE \
       --zone=ZONE
    

    Replace the following:

    • DISK_NAME: the name of the temporary disk
    • SIZE: the size of the temporary disk
    • SNAPSHOT_NAME: the name of the source snapshot
    • DISK_TYPE: the disk type for the temporary disk
    • ZONE: the Compute Engine zone where you want to deploy the temporary disk
  2. Attach the disk to a VM other than your SAP HANA host. Use the gcloud compute instances attach-disk command:

    gcloud compute instances attach-disk VM_INSTANCE_NAME \
       --disk=DISK_NAME \
       --zone=ZONE
    

    Replace the following:

    • VM_INSTANCE_NAME: the name of the VM where you want to deploy the disk you created
    • DISK_NAME: the name of the disk you created
    • ZONE: the Compute Engine zone where your VM is deployed
  3. Connect to your VM using your preferred SSH method.

  4. Mount the new disk as a temporary file system:

    1. At the OS level, find the volume group that doesn't have any active logical volume:

      vgdisplay
      

      The output is similar to the following example:

      --- Volume group ---
      VG Name               vg_hana_data
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  2
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                1
      Open LV               0
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               250.00 GiB
      PE Size               4.00 MiB
      Total PE              63999
      Alloc PE / Size       63999 / 250.00 GiB
      Free  PE / Size       0 / 0
      VG UUID               Fa52zl-AROR-LH2k-aG4z-LbrB-cvTz-TZhEfR
    2. Rename the volume group using the VG UUID. In the preceding example it's Fa52zl-AROR-LH2k-aG4z-LbrB-cvTz-TZhEfR.

      vgrename Fa52zl-AROR-LH2k-aG4z-LbrB-cvTz-TZhEfR vg_hana_data_temp
      
    3. Activate the volume group and the logical volume:

      vgchange -a y vg_hana_data_temp
      lvchange -a y /dev/vg_hana_data_temp/data
      
    4. Mount the logical volume in a temporary file system, for example, /hana/data_temp:

      mkdir /hana/data_temp
      mount /dev/vg_hana_data_temp/data /hana/data_temp
      
    5. Verify that all the disks are properly mounted:

      lsblk
      

      The output is similar to the following example:

      NAME                     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
      sda                        8:0    0   30G  0 disk
      ├─sda1                     8:1    0    2M  0 part
      ├─sda2                     8:2    0   20M  0 part /boot/efi
      └─sda3                     8:3    0   30G  0 part /
      sdb                        8:16   0  350G  0 disk
      └─vg_hana_data_temp-data 254:5    0  250G  0 lvm  /hana/data_temp
      sdc                        8:32   0  104G  0 disk
      └─vg_hana_log-log        254:2    0  104G  0 lvm  /hana/log
      sdd                        8:48   0  208G  0 disk
      └─vg_hana_shared-shared  254:0    0  208G  0 lvm  /hana/shared
      sde                        8:64   0   32G  0 disk
      └─vg_hana_usrsap-usrsap  254:3    0   32G  0 lvm  /usr/sap
      sdf                        8:80   0  416G  0 disk
      └─vg_hanabackup-backup   254:4    0  416G  0 lvm  /hanabackup
      sdh                        8:112  0  250G  0 disk
      └─vg_hana_data-data      254:1    0  250G  0 lvm  /hana/data
  5. As the SIDadm user, run the hdbpersdiag tool for the data volumes that are included in the temporary file system:

    for directory in $(find /hana/data_temp/SID/mnt00001/hdb* -type d); do hdbpersdiag -c -e 'check all' $directory; done
    
  6. Verify the output from the hdbpersdiag tool.

  7. If you plan on performing this consistency check in the future, then you can leave the new volume group as it is. If not, then delete it.

  8. Detach the disk from the VM. Use the gcloud compute instances detach-disk command:

    VM_INSTANCE_NAME \
       --disk=DISK_NAME \
       --zone=ZONE
    
  9. Delete the disk. Use the gcloud compute disks delete command:

    gcloud compute disks delete DISK_NAME \
       --zone=ZONE
    

Troubleshooting

While Google Cloud's Agent for SAP is designed to take care of most issues that can occur during disk snapshot based backup and recovery operations for SAP HANA, there are a few scenarios where manual intervention is required.

To troubleshoot any issue with the disk snapshot feature of Google Cloud's Agent for SAP, see Issue with a disk snapshot based backup or recovery operation.

Get support

If you need help resolving a problem with Google Cloud's Agent for SAP, then gather the required diagnostic information and contact Cloud Customer Care. For more information, see Google Cloud's Agent for SAP for SAP HANA diagnostic information.