4 4 3 Tigon:SAP HANA Backup

From SEPsesam
Jump to: navigation, search
Other languages:
Deutsch • ‎English

Copyright © SEP AG 1999-2020. 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.

Draft.png WORK IN PROGRESS
This page is a draft. Treat the information on this page with caution as it may be incomplete.


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.


Overview

SEP sesam provides efficient data protection for your SAP HANA 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.

Prerequisites

To ensure error-free operation of SEP sesam and improve performance, make sure that the following conditions are met:

  • Check the support matrix for the list of supported SAP HANA versions.
  • Installed SAP HANA database.
  • Installed SEP sesam Client for Linux version ≥ 4.4.1.14 on the SAP HANA server (≥ 4.4.3.12 for IBM ppc64).
  • Regular file backups must work (the sample /etc backup has to be successful). For details on backup configuration, see Standard Backup Procedure.

Configuring SAP HANA as a client on SEP sesam Server

  1. Add the SAP HANA server as a SEP sesam Client in the SEP sesam GUI and check that access mode is SM SSH.
  2. Create a backup task HANA <DB_SID> with SAP HANA task type and <DB_SID> as a source. For general details on backup procedure, see Creating a Backup Task. Note that SAP HANA task cannot be used for regular file backups. It is necessary only for enabling the SEP sesam Server to accept backups from the SAP HANA system; once all configuration steps are performed, this task is used to transport the database and log backups to the SEP sesam Server or RDS.
  3. Create a backup task to back up SAP HANA config files and all other required files by specifying all files except the database files and HANA_CONFIG as a source.
  4. The files are located in the following directories:

    • Global config files: /usr/sap/<sid>/SYS/global/hdb/custom/config
      Example: /usr/sap/SEP/SYS/global/hdb/custom/config
    • Local config files (on each host): /usr/sap/<sid>/HDB<instance>/<host>
      Example:/usr/sap/SEP/HDB00/saphanix1
  5. Once you created a task, create a schedule to specify when you want to back up your data. Then you must create a new backup event. Select FULL as a backup level to perform a full backup. For general details, see Creating a Backup Event.
  6. Optionally, create a separate media pool to store the backups.

Installing and configuring SAP HANA module on the database server

The installation procedure differs depending on your SAP HANA version and SEP sesam version. The following instructions are relevant for Beefalo V2. To get the latest sm_install_saphana2.sh script, email SEP sesam support.

  1. On the HANA server, login as root user and run sm_install_saphana script. The script installs the module and generates the parameter according to the values you entered during its execution. Proceed as follows according to your version:
  2. SAP HANA v. ≥ 2.0
    You can run the following sm_install_saphana2 script by using either SAP (root) user key or SAP HANA backup user password.

    Information sign.png Note
    You have to run the script for each database in your instance (SYSTEMDB, TenantDB1, TenantDB2, ... TenantDB<number>).
    • Running the script by using the SAP user key
    • sm_install_saphana2 -s <SID_name> -i <instance_number> -U <user_key> -D <database> -j <backup_task_name> -m <media_pool_for_DB_backup> -C <server_hostname>
      

      For example:

      sm_install_saphana2 -s SEP -i 90 -U BackupUser -D SYSTEMDB -j HANA_SystemDB -m MP_HANA -C backup-srv.sep.de
      
      <SID_name>= SEP
      <instance_number>= 90
      <user_key>= BackupUser (For details, see Using a User Key when Logging On to a Database.)
      <database>= SYSTEMDB
      <backup_task_name>= HANA_SystemDB
      <media_pool_for_DB_backup>= MP_HANA
      <server_hostname>= backup-server.sep.de
      
    • Running the script by using the SAP HANA backup user password
    • sm_install_saphana2 -s <SID_name> -i <instance_number> -u <username> -p <password> -D <database> -j <backup_task_name> -m <media_pool_for_DB_backup> -l <media_pool_for_log_backup> -C <server_hostname> -S <RDS_hostname> -d <drive_number>
      

      For example:

      sm_install_saphana2 -s SH2 -i 01 -u SYSTEM -p secret! -D PRD -j HANA_Production_DB -m MP_HANA_DB -l MP_HANA_LOG -C backup-server.sep.de -S rds01.sep.de -d 7
      
      <SID_name>= SH2
      <instance_number>= 01
      <username>= SYSTEM
      <password>= secret!
      <database>= PRD
      <backup_task_name>= HANA_Production_DB
      <media_pool_for_DB_backup>= MP_HANA_DB
      <media_pool_for_log_backup>= MP_HANA_LOG
      <server_hostname>= backup-server.sep.de
      <RDS_hostname>= rds01.sep.de
      <drive_number>= 7 (exclusive reserved drive for SAP HANA backups, for best performance create a separate drive)
      

    For details on parameters, see section SAP HANA parameter file. Then proceed to step 2.

    SAP HANA v. < 2.0

    The command differs for single and multi instance as follows:

    • SAP HANA single instance
    • /opt/sesam/bin/sesam/sm_install_saphana -C <server_hostname> -j hana_backup_task -m sesam_media_pool -l sesam_media_pool -s <SID_name> -i <instance_number> -u <username> -p <password>
      

      where hana_backup_task is the name of the task you created before and the same sesam_media_pool is specified twice in the given command!

    • SAP HANA multi instance
    • For each instance, run the following command:

      /opt/sesam/bin/sesam/sm_install_saphana -C <server_hostname> -j hana_backup_task -m sesam_media_pool -l sesam_media_pool -s <SID_name> -i <instance_number> -u SYSTEM -p <password> -M
      

      where hana_backup_task is the name of the task you created before, <SID_name> is for example H02, <instance_number> is for example 04, and the same sesam_media_pool is specified twice in the given command!

    For details on parameters, see section SAP HANA parameter file. Then proceed to step 2.

  3. Start SAP HANA Studio, click one instance to open it and double-click Backup in the systems view on the left. Select Configuration, expand Backint Settings and verify that the following is set:
    • Backint Agent should be /opt/sesam/bin/sesam/hdbbackint.
    • Make sure that the Destination type has changed from file to BACKINT.
    • Hana studio01.PNG

Configure backup for SAP HANA backup catalog

The SAP HANA backup catalog registers all backups and contains all backup history details. It enables SAP HANA to check and validate whether recovery is possible, which backups are required for recovery and which backups are no longer needed. Note that the backup catalog does not record the progress of a backup; this is done by the backup.log.

SEP Warning.png Warning
Backup catalog is mandatory to be able to restore the SAP HANA instance to a different system! Make sure that you configure backup for SAP HANA catalog as described below.

The following screenshot shows the parameters that have to be set in order for SAP HANA to write its backup catalog to SEP sesam. The backup catalog will then be backed up during the LOG backup of the HANA instance.

20181024 catalog-via-backint.png

Backing up SAP HANA

  1. To verify the configuration, start 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.
  2. Hanastudio-startbackup2.jpg

    You have to wait for backup to be completed successfully (BACKUP STATUS: Backup was successful). You should also see the corresponding backup activity on the SEP sesam Server side.

    • If this first backup completes successfully, you can proceed and configure automatic backups.
    • If the first backup fails, check the following:
      • Open the /var/opt/sesam/var/ini/backint_saphana.utl file and check that the path and the directory names are correct (directory names are case sensitive).
      • Make sure that /var/opt/sesam/var/log/lgc is writable for your <sid>adm operating system user. You can also work around this issue by executing chmod 777 /var/opt/sesam/var/log/lgc in the command line. Note that it is strongly recommended to give the write permissions only to your <sid>adm user.
      • You can find additional troubleshooting information in the hdbbackint log file in the /var/opt/sesam/var/log/lgc directory and in the SAP HANA troubleshooting.
  3. To create scheduled full backups, 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).
  4. 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".
  5. Create a new command event: GUI -> Configuration -> Command -> New -> name: hanabackup_DB_SID. As shown in the screenshot below, a user must be root and a command must be /opt/sesam/bin/sesam). The command event will execute the backup script. For general details on command event configuration, see Creating a Command Event.
  6. Hana-commands.jpg

  7. 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).
  8. Change the log backup and get a new log file from backint file.
  9. Check if FDI log backup chain varies, for example, IFFIIIFIIFII.
  10. Information sign.png Note
    The FDI backup chain can be orphaned in case of problems with the operations order or the time. For example, when FDI is diplayed as IIIIIIIII, EOL is disabled.

For further information, please refer to the SAP HANA Administration Guide and the SAP HANA SQL and System Views Reference (SQL Statements -> BACKUP DATA).

SAP HANA housekeeping

With 4.4.3 Beefalo V2, you can use SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for recovery. SEP sesam handles the housekeeping of backups by deleting the stored savesets and their corresponding entries from the list of available backups.

There are three different ways to perform SAP HANA housekeeping by running the relevant commands on the SAP HANA server.

  • Purge only
  • sbc_hana.sh -A purge -C <SEP_sesam_Server> -j <SEP_sesam_task> <db_name>
    

    For example:

    /opt/sesam/bin/sesam/sbc_hana.sh -A purge -U backupuser -C http://meteorologix2.sep.de:11051 -j sap-hana-systemdb  HDB/00/SYSTEMDB
    
  • Purge after a FULL backup
  • sbc_hana.sh -b -o purge  -C <SEP_sesam_Server> -j <SEP_sesam_task> <db_name>
    

    For example:

    /opt/sesam/bin/sesam/sbc_hana.sh -b -l FULL -U backupuser -C http://meteorologix2.sep.de:11051 -j sap-hana-hdb -o purge /HDB/00/HDB
    
  • If recent hdbbackint is installed on the SAP HANA server, the backup ID of the oldest FULL backup, as listed in the SEP sesam database, is written into a file. Purge is executed immediately after a backup job, initiated by sbc_hana.sh, finishes.
  • sbc_hana.sh -b -o purge <db_name>
    

    For example:

    /opt/sesam/bin/sesam/sbc_hana.sh -b -l FULL -U backupuser -o purge HDB/00/HDB
    

    Details of script and parameters

    Usage of sm_install_saphana script

    sm_install_saphana is one-line installation utility that can be executed from the SEP sesam bin directory (default: /opt/sesam/bin/sesam. If you encounter errors during the installation process, you may have to manually install the SAP HANA extension, as described in section Manual installation. If you are using multi-tenancy feature, double-check the backint settings in the SAP HANA Studio as shown in step Verify Backint Settings.

    Optional arguments of sm_install_saphana script:

     -h, --help                         show this help message and exit
     -C <server_hostname>               SEP sesam Server hostname
     -j <backup_task_name>              Backup task name
     -m <media_pool_for_DB_backup>      Target media pool for DB backup
     -l <media_pool_for_log_backup>     Target media pool for log backup
     -S <RDS_hostname>                  SEP sesam Remote Device Server
     -d <drive_number>                  SEP sesam drive number
     -M                                 SAP HANA Multitenancy
     -s <SID_name>                      SAP HANA SID
     -i <instance_number>               SAP HANA instance number
     -u <username>                      SAP HANA backup user
     -p <password>                      SAP HANA backup user password
     -n <hostname>                      SAP HANA hostname (hdbsql connection)
     -D <database>                      SAP HANA database name
     -U <user_key>                      SAP HANA key of the user
    

    SAP HANA parameter file

    Information sign.png Note

    If you have used the sm_install_saphana setup utility for installing the module, the parameter file has already been generated and registered, according to the values you entered during the execution of the script. You may have to go through these steps if some of the criteria for the automatic installation could not be met.

    You can use different parameter files for different purposes (e.g., to store backups in different media pools). The parameter file used is declared by the -P PARAMETERFILE option for hdbbackint. During installation, a template parameter file is copied to /var/opt/sesam/var/ini/backint_saphana.utl. You can edit the parameter file and adjust it to suite your environment. Note that all specified parameters are case sensitive.

    At least the following entries are mandatory to be configured in the parameter file:

    SESAM_SERVER=<Sesam Server>
    Hostname of the SEP sesam Server you want to send the backup to
    SESAM_JOB=<Sesam SAP Client Task>
    Name of the backup task created during configuration
    SESAM_DRIVE=<Sesam Drive Number>
    Number of the SEP sesam drive that you want the backup to be written to
    SESAM_POOL=<Sesam Mediapool>
    Exact name of the SEP sesam media pool that you want to store the backup in
    SSB_LOGFILE=<Log file name>
    Full path of the SEP sesam backint log file
    SEP Tip.png Tip
    Instead of having only one large log file, you can get a new log file from backint by specifying a date identifier in the log file name. The strftime function is used for expansion. The $u token is replaced by SAP DB user, set from SAP side in backint call.
    SSB_LOGFILE=/usr/sap/HDB/HDB00/saphanix1/trace/hdbbackint_sbc_backint_log_$u-%Y-%m-%d.log
    

    Additional optional configuration parameters are:

    SBC=<SESAM_PATH>
    Full path of the SEP sesam backup client executable. It only has to be set if the standard sbc cannot be used.
    PORT=<Sesam Server Communication Port>
    Only necessary if the STPD port was changed during SEP sesam Server installation.
    SESAM_TAPESERVER=<Remote device server>
    Hostname of the RDS that you want to send the backup to. The backup net to be used can be chosen by this entry. Note that the specified hostname here has to match the hostname of the device server which is visible in the used drive's properties.

    Example of a parameter (.utl) file in /var/opt/sesam/var/ini:

    backint_saphana_log.utl:

     SESAM_SERVER=Serverix
     SESAM_JOB=sep-hana-sesam-log
     SESAM_DRIVE=2
     SESAM_POOL=Daily
     SSB_LOGFILE=/var/opt/sesam/var/log/lgc/backint_saphana_log.log
    

    Troubleshooting installation: Manual installation

    Note that these instructions work with the default SAP HANA directories. You may have to adjust every path in the commands to the path that you have used in a customized installation.

    1. Create the directories needed for the hdbbackint binary and utility file:
    2. root@hanasrv:~# mkdir -p /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig
      
    3. Copy the parameter file template from the skel/templates to the SEP sesam ini directory.
    4. root@hanasrv:~# cp /opt/sesam/skel/templates/backint_saphana.utl /var/opt/sesam/var/ini/
      
    5. Adjust the permissions of the SEP sesam logging directory.
    6. root@hanasrv:~# chmod 777 /var/opt/sesam/var/log/lgc
      
    7. Create a symbolic link from /opt/sesam/bin/sesam/hdbbackint to the directory where SAP HANA expects the backint executable.
      Note that usually root permissions are required. The configuration has to be adjusted accordingly. The file must be executable for the SAP HANA user.
    8. root@hanasrv:~# ln -s /opt/sesam/bin/sesam/hdbbackint /usr/sap/<SID>/SYS/global/hdb/opt/hdbbackint
      
    9. Create another symbolic link from /var/opt/sesam/var/ini/backint_saphana.utl to the directory where SAP HANA expects the parameter file:
    10. root@hanasrv:~# ln -s /var/opt/sesam/var/ini/backint_saphana.utl /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig/
      
    11. Check if the programs sbc and sbc_com_interface in the directory <SESAM DIR>/bin/sesam are executable for the SAP HANA user.
    12. Repeat steps 1-6 on every node of a scale-out system, if given.