Archive:SAP Hana Backup

From SEPsesam
Jump to: navigation, search

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

Icon archived docs.png THE CONTENT OF THIS PAGE IS OUTDATED
SEP AG has discontinued support for obsolete SEP sesam versions. 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. For the latest version of SEP sesam documentation, see documentation home.

Installation

Technical advantages of using the SEP sesam HDBBackint integration to backup your SAP HANA Database

  • Certified and supported by SAP
  • Data consistency checks on block level
  • Ease of use due to integration into SAP HANA Studio
  • Integration into your existing backup infrastructure
  • Additional features like deduplication
  • Backups are immediately available for recovery
  • Only allocated data size has to be backed up
  • High automation possible

Prerequisites for the installation of the SEP sesam SAP HANA Backup Module

  • Installed SAP HANA database
  • SEP sesam backup client for Linux version >= 4.4.1.14 installed on the SAP HANA server (>=4.4.3.12 for IBM ppc64)
  • Regular file backups must be working (an example backup of /etc has to be successful)

On the SEP sesam server

  1. Add the SAP HANA server as a backup client in the SEP sesam GUI
    • To avoid problems, please ensure that SEP sesam file backups work
  2. Create a task to backup the global and local SAP HANA config files
    • 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
  3. Create another two tasks with the task type SAP HANA and record their task names. One of these will be for data backups, one for log backups. You will need the exact, case-sensitive task names for the configuration steps on the database server.
    • As backup source, you may enter anything (we recommend that you insert the HANA DB SID here).
    • The data that actually is saved depends on the respective SAP HANA backup calls (e.g. FULL, DIFF, INC).
    • The task created in this step can't be used for regular file backups. It's necessary only for enabling the SEP sesam server to accept backups from the SAP HANA system.
  4. (Optional) Create a separate media pool to store the backups.

On the database server

Automatic installation

To install all needed files and symlinks automatically, please execute the script sm_install_saphana from the SEP sesam bin directory (default: /opt/sesam/bin/sesam) and continue with the configuration section further below. This one-line installation utility can also be used for automatic rollout purposes. If errors occur during the installation, please proceed to the manual installation section of this guide. If you're using Multi-Tenancy, please double-check the backint settings in SAP HANA Studio as shown in the section On database level (via SAP HANA Studio).

Usage of sm_install_saphana:


optional arguments:

 -h, --help            show this help message and exit
 -C <server hostname>  SEP Sesam Server hostname
 -j    Backup task name
 -m <mediapool>        Target media pool for DB backup
 -l <mediapool>        Target media pool for log backup
 -S <rds hostname>     SEP Sesam Remote Device Server
 -d <drivenum>         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)


You can proceed to the Configuration section below after executing the installation routine.

Manual Installation of the SAP HANA module on the database server

Note: These instructions work with the default SAP HANA directories. You may have to adjust every path in the commands to the path you 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.
    Usually root permissions are required to do this. 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.

On the SAP HANA server

Please note:

If you have used the sm_install_saphana setup utility to install the module, this is just for your information. The parameter file has already been generated and registered for you, 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 couldn't be met.

All specified parameters are case sensitive!


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 has been copied to /var/opt/sesam/var/ini/backint_saphana.utl. This file is used in this guide, so if you're installing the extension, you'll have to edit this file and adjust the parameters to your environment.

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 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

Further 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 can not be used.
PORT=<Sesam Server Communication Port>
Only necessary if the STPD port was changed during the installation of the SEP sesam server.
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. Please note that the hostname entered 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_data.utl:

 SESAM_SERVER=diagnostix
 SESAM_JOB=sep-hana-sesam-data
 SESAM_DRIVE=2
 SESAM_POOL=Daily
 SSB_LOGFILE=/var/opt/sesam/var/log/lgc/backint_saphana.log

backint_saphana_log.utl:

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

On database level (via SAP HANA Studio)

Please note:

If you have used the script sm_install_saphana setup utility to install the module, this is just for your information. The parameter file has already been generated and registered for you by the script, according to the values you entered during its execution.

  1. Start SAP HANA Studio and double-click Backup in the systems view on the left
  2. Select Configuration and expand Backint Settings
  3. --> Backint Agent should be /opt/sesam/bin/sesam/hdbbackint

  4. Insert the path to the backint parameter file (backint_saphana.utl) as shown here:
  5. SAP HANA Studio, "Backup" view

    You can use one of the following pathes to specify the parameter file copied during the installation:

    /var/opt/sesam/var/ini/backint_saphana.utl
    /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig/backint_saphana.utl
    

    This complies to the recommendations from the SAP HANA Administration Guide regarding the configuration of third-party backup tools.

  6. After making these adjustments, save the configuration and close the Backup tab.

Backup

There are different ways to start (and schedule) backups of the SAP HANA database. They all trigger one thing: A SQL statement to the HANA database. This section describes how to manually make backups using the SAP HANA Studio and how you can execute scheduled backups with SEP sesam.

Backing up the backup catalog via Logbackup:

We recommend to also backup the HANA logbackups with SEP sesam hdbbackint because they contain the HANA backup catalog. This catalog contains identifiers of all backups that have been made for this database. In case of a restore, SAP HANA checks the available data backups via the backup catalog from the log backup and provides the choice of data backups in the SAP HANA recovery assistant accordingly. If you choose to write the log backups to a different destination (e.g. filesystem), please make sure that these log backups are available in case of a restore.

Starting the first backup

Now that everything is set up, it's time to start a backup. To do so, open the SAP HANA Studio, right-click Backup under the desired system and select Back Up... from the context menu. The SAP HANA Studio backup wizard will open, guiding you through the steps to start a database backup. Remember to select Backint as backup target as shown in the screenshot below:

SAP HANA Studio, "Start backup" wizard

If this first backup finishes successfully, it's safe to proceed with the automation of the backup.

If the first backup fails:

If you have used sm_install_saphana to install the module and your backup fails, 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 on the command line but we strongly advise to give the write permissions only to your <sid>adm user. You may also find troubleshooting information in the hdbbackint logfile in the /var/opt/sesam/var/log/lgc directory.

Configuration of automatic backups

In general, there are several different ways to achieve the scheduling of SAP HANA backups. In this documentation, only the way to start a backup by calling a short script with a SEP sesam command event will be explained.

Database backup script

The following script is just an example and has to be adjusted to your needs. On execution, it triggers a full database backup using the backint interface configured earlier in this guide. Afterwards, it returns the exit code so that the command event will be shown with state "Error" if something goes wrong.

Create this script within using the for expl. vi hdbbackup.sh and insert the following lines

#!/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')"
# Different 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

The only line which has to be modified is
/usr/sap/<SID>/HDB<InstanceNumber>/exe/hdbsql -i 0 -n localhost -u SYSTEM -p <password> "BACKUP DATA USING BACKINT ('$PREFIX')"

  • chmod 700 hdbbackup.sh
  • cp hdbbackup.sh /opt/sesam/bin/sesam

Create a new command event: GUI -> Configuration -> Command -> see picture below (user must be root and command must be /opt/sesam/bin/sesam)

For further information about how to configure a command event, please see this entry in the FAQ section and this section about creating a command event. In this case, the command event should execute the backup script as shown below: SEP sesam GUI, List of command event commands

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

Restore and Disaster Recovery

Recovering a SAP HANA instance can easily be accomplished using the SAP HANA Studio.

Single Schema Restore for SAP BusinessOne

Please note that SAP HANA does not support the selective restore of a single database schema into the database. While database schemas are used massively for multi-tenancy on hosted SAP BusinessOne installations, there is only one possibility to get back data in a single schema in case of a recovery.

  1. Prepare an SAP HANA installation as big in size as your productive one
  2. Restore the database as shown below
  3. Start the database in an isolated environment
  4. Export the schema you need to restore via SAP HANA Studio
  5. Import the schema data on the productive SAP HANA environment

Point-in-Time Recovery of a SAP HANA Database

  1. In case of a disaster, restore the operating system or start off with a fresh HANA installation and execute the SEP sesam HANA module installation as described above. Afterwards, right-click your server/instance in the Systems view and select Recover... Please note: Opening the recovery wizard will stop the database!
  2. SAP HANA Studio - Systems view

  3. In the wizard that opens, select the option desired (in this guide, we'll choose a point-in-time recovery because this will apply in most cases)
  4. SAP HANA recovery wizard

    Backint System Copy:

    The function Backint System Copy can be used to restore backups from a system with a different identifier (SID). A typical use case for this feature is to restore a data backup from the productive system to a test instance.

  5. After specifying the location of the log backup area, you can decide which backup should be used to restore. To ensure that the backup is still stored on the sesam media, you can select a backup and use the Check Availability button. This will trigger an inquire to the SEP sesam Server to see if the backup is still in the SEP sesam database (respectively on the media).
  6. SAP HANA recovery wizard

  7. The next step enables the user to let the system perform an availability check for log backups, trigger a purge of the log area during the restore if desired and install a new license key in case this restore goes to a fresh, plain system.
  8. SAP HANA recovery wizard

  9. Now, the summary with all the options made is displayed prior to starting the recovery:
  10. SAP HANA recovery wizard

  11. During the process, a status window will be displayed until the recovery is finished:
  12. SAP HANA recovery status

  13. When the procedure has been completed successfully, the database is ready for use again.

Troubleshooting

For troubleshooting SAP Hana backup issues, see SAP Hana Backup troubleshooting.