4 4 3 Tigon:SAP HANA Backup: Difference between revisions

From SEPsesam
(Marked this version for translation)
(Corrected obsolete version note (Tigon).)
Line 8: Line 8:


<!--T:354-->
<!--T:354-->
{{Outdated_Version/en}}</div></translate><br />
{{Outdated_Version/en|[[SEP_sesam_Release_Versions|4.4.3 ''Tigon (V1 and V2)'']]}}</div></translate><br />


<translate>==Overview== <!--T:5--></translate>
<translate>==Overview== <!--T:5--></translate>

Revision as of 12:21, 21 January 2021

Other languages:

Copyright © SEP AG 1999-2024. All rights reserved.

Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.

Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3 Tigon/4.4.3 Beefalo V2. For previous documentation version(s), check SAP HANA archive.


Information sign.png SEP AG has discontinued support for SEP sesam version 4.4.3 Tigon (V1 and V2). Instructions are still available for these SEP sesam products, however, SEP AG accepts no responsibility or liability for any errors or inaccuracies in the instructions or for the incorrect operation of obsolete SEP sesam software. It is strongly recommended that you update your SEP sesam software to the latest version.


Overview

SEP sesam provides efficient data protection for your SAP HANA V1 and V2 environment. Among the main technical advantages for using the SEP sesam HDBBackint integration to back up your SAP HANA database are:

  • SEP sesam HDBBackint integration is certified and supported by SAP.
  • Data consistency checks at the block level.
  • Ease of use due to integration into SAP HANA Studio.
  • Integration into your existing backup infrastructure.
  • Additional backup-efficient features, such as deduplication for eliminating redundant backup data.
  • Backups are immediately available for recovery.
  • Only allocated data size has to be backed up.
  • High automation is possible.

As of SEP sesam v. 4.4.3 Beefalo V2, you can perform SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for a recovery, based on a defined retention policy. For details, see section SAP HANA housekeeping.

Backing up SAP HANA

The SAP HANA backup is always performed by the database itself and is started with an HDBSQL command. However, you can start the database backup by using a single command in the command line, a shell script or from the SAP HANA Cockpit or SAP HANA Studio. The command and shell scripts can be started by any scheduler, e.g., the SEP sesam SEPuler.

The SAP HANA Logbackup is performed by the database automatically. It is not possible or required to trigger the Logbackup.

The SAP HANA database engine uses the configured *.utl files to communicate with SEP sesam via the backint interface.

Starting a database backup from the HANA Studio (SAP HANA V1 and V2)

To start a full backup from HANA studio, open the SAP HANA Studio, right-click Backup under the desired system and select Back Up... from the context menu. Then select Backint as backup target, as shown in the screenshot below.

Hanastudio-startbackup2.jpg

Starting a database backup from the command line (SAP HANA V1 and V2)

You can start a database backup manually from the command line by using HDBSQL command. For details, check SAP portal for SAP HANA SQL and System Views Reference/SAP HANA SQL Reference Guide for SAP HANA Platform documentation, relevant for your SAP HANA version.

Simple examples for starting a database backup

Replace the -u and -p parameters with the values of your backup user and the <SID> and <instance number> fitting your SAP HANA system.

  • SAP HANA V1, complete backup, single instance:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -u SYSTEM -p PASSWORD "BACKUP DATA USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup.
  • SAP HANA V1, complete backup, multiple instances, DB TENANT1:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TENANT1 USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the tenant DB with the name TENANT1.
  • SAP HANA V2, complete backup, DB SYSTEMDB:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR SYSTEMDB USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the SYSTEMDB database.
  • SAP HANA V2, complete backup, DB TD1:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TD1 USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the tenant DB TD1.

Starting a scheduled database backup using a script, optionally SAP HANA backup catalog housekeeping (SAP HANA V2)

As of SEP sesam Client 4.4.3 Beefalo V2, SEP sesam provides useful bash script for backing up SAP HANA V2 which also enables housekeeping of the SAP HANA backup catalog.

The housekeeping function cleans up (purge) the internal SAP HANA backup catalog in relation to available backups in SEP sesam. All SAP HANA DB backups older then the oldest in SEP sesam available SAP HANA Backup ID (BID) are removed from the SAP HANA backup catalog.

The script obtains information about the oldest available backup in SEP sesam from the SEP sesam Server or from a local file on the SAP HANA host. This file is written after every FULL database backup for each database.

Information sign.png Note
  • The script removes ALL entries from the SAP HANA backup catalog, also entries from the backup to a local file, if the BID is older then the oldest in SEP sesam available BID.
  • The script does not remove physical backups from the disk.

For detailed information, see SAP HANA SQL Reference Guide for SAP HANA Platform: SQL command BACKUP CATALOG DELETE Statement. Make sure that you select relevant documentation for your SAP HANA version.

The script sbc_hana.sh is located in /opt/sesam/bin/sesam. It is an editable bash script which can be started with different parameters.

Script syntax

sbc_hana.sh <ACTION> <OPTIONS> <HANA>
Available actions:
            -b  backup (default)
            -A  purge: HANA backup catalog housekeeping

         OPTIONS:
             for backup
               -l  Level (full/diff/incr)
               -U  User or user key
               -P  Password for a user
               -o  purge: Start HANA backup catalog housekeeping after a FULL backup
               -C  SEP sesam Server: SEP sesam Server to contact for housekeeping
               -J  Task event: Related backup event for housekeeping
               -j  Task: Related backup task for housekeeping
 

     for housekeeping
               -U  User or user key
               -P  Password for user
               -s  HANA backup ID (BID)
               -C  SEP sesam Server: SEP sesam Server to contact for housekeeping
               -J  Task event: Related task event for housekeeping
               -j  Task: Related task for housekeeping

         HANA
          <SID>/<INSTANCE>/<DATABASE>

         sbc_hana.sh -b -l <full|diff|incr> -U  <user> -P  <password> <SID>/<instance>/<DB>

Backup examples

  • FULL backup of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm and password is secret.
  • Incremental backup of the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -b -l incr -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey.

Backup examples with SAP HANA backup catalog housekeeping

  • FULL backup with housekeeping of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -o purge -C backup-srv -j HANA-PRD -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm, password is secret, SEP sesam Server is backup-srv and the task is HANA-PRD (get oldest FULL from SEP sesam Server).
  • FULL backup with housekeeping of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -o purge -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm, password is secret (get oldest FULL from a local file, written by last FULL backup).

Examples for SAP HANA backup catalog housekeeping (w/o backup)

  • Housekeeping for the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -A purge -C backup-srv -j HANA-DEV -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey, SEP sesam Server is backup-srv and the task is HANA-DEV (get oldest FULL from SEP sesam Server).
  • Housekeeping for the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -A purge -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey (get oldest FULL from a local file, written by last FULL backup).
  • Housekeeping for the database DEV with SID HX4, instance 01 and Backup ID 1567001886606:
  • sbc_hana.sh -A purge -U bckuserkey -s 1567001886606 H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey. Script will remove all backups older then BID 1567001886606 from the HANA backup catalog.

Scheduling start of the script

You can schedule start of the script by configuring a command event in the SEP sesam GUI: Configuration -> Command -> New -> name: unique name. As shown in the screenshot below, a user must be root and the script must be in /opt/sesam/bin/sesam.

Hana-commands.jpg


A command event will execute the backup script. For general details on command event configuration, see Creating a Command Event.

Starting a scheduled database backup using a script (SAP HANA V1)

To configure a scheduled full backup, proceed as follows:

  1. Create the file hdbbackup.sh with vi or vim and then paste one of the following HANA backup scripts into in (depending on you SAP HANA installation: single- or multi-instance).
  2. SAP HANA single instance installations only: #!/bin/sh # Example script for starting a full SAP HANA database backup # Create a unique backup prefix using the current timestamp PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`" echo "Backup Prefix is: $PREFIX" # Start backup via hdbsql query echo "Starting backup via hdbsql..." /usr/sap/<SID>/HDB<InstanceNumber>/exe/hdbsql -i 0 -n localhost -u SYSTEM -p PASSWORD" BACKUP DATA USING BACKINT ('$PREFIX')" # -i <instanceNumber>, -n <node>, -u <dbuser> # Multi tenancy only: -d <database> has to be added and the SQL command is "BACKUP DATA FOR <tenant_db_name> USING BACKINT ('$PREFIX')" # Possible backup levels are DIFFERENTIAL and INCREMENTAL. --> example: "BACKUP DATA DIFFERENTIAL [FOR <tenant_db_name>] USING BACKINT ('$PREFIX'_DIFF)" # Collect exit code of hdbsql and pass it as exit code of this backup script EXIT_CODE=$? exit $EXIT_CODE
    1. In the example script above, change the text in red to match your settings
      • <SID>/HDB<InstanceNumber> – make sure that you use the correct directory
      • -u SYSTEM -p PASSWORD – specify username of the system user (which is most of the time SYSTEM) and the password
    2. Save the script file to keep your changes.
    3. Change the permission of the script with "chmod 700 hdbbackup.sh".

    SAP HANA multi instance installations:

    #!/bin/sh
    # Example script for starting a full SAP HANA database backup
    
    # Create a unique backup prefix using the current timestamp
    PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
    echo "Backup Prefix is: $PREFIX"
    
    # Start backup via hdbsql query
    echo "Starting backup via hdbsql..."
    
    #Backup of the first tenant over the system DB
    /usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TDW USING BACKINT ('$PREFIX')"
    #The following lines are examples to backup more tenants. In case you need it, remove the #
    #/usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD #"BACKUP DATA FOR TD1 USING BACKINT ('$PREFIX')"
    #/usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD #"BACKUP DATA FOR TD2 USING BACKINT ('$PREFIX')"
    #Backup of the SYSTEMDB
    /usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR SYSTEMDB USING BACKINT ('$PREFIX')" 
    # Collect exit code of hdbsql and pass it as exit code of this backup script
    EXIT_CODE=$?
    exit $EXIT_CODE
    
    1. In the example script above, change the text in red to match your settings:
      • H02/HDB10 – make sure that you use the correct directory
      • -u SYSTEM -p PASSWORD – specify username of the system user (which is most of the time SYSTEM) and the password
      • TDW – the actual name of the tenant/DB
    2. Save the script file to keep your changes.
    3. Change the permission of the script with "chmod 700 hdbbackup.sh".
  3. Schedule start of the script by configuring a command event in the SEP sesam GUI, as described in the above section Scheduling start of the script.
  4. You also have to wait for the SAP HANA system - SEP sesam results table displays an information about a completed full backup (end backup time).