You are on page 1of 30

SAP HANA Best

Practices Guide
THIS PAGE INTENTIONALLY LEFT BLANK.
Contents
INTRODUCTION / 4

PROTECTING SAP HANA / 5

PREPARATION / 5

INSTALLATION / 6
Command Line Installation / 6

Push Install / 6

CONFIGURATION / 7
Backint for HANA Parameter File / 7

Commvault GUI Configuration / 8

SAP HANA Studio Configuration / 9

BACKUPS /11
Triggered by SAP HANA Studio / 11

Scheduling of Backups / 12

Scheduling via SAP DB13/DBACOCKPIT / 14

HANA-SIDE TROUBLESHOOTING AND MONITORING / 15

RESTORES / 17
Restoring via SAP HANA Studio / 17

Restoring HANA via Commvault GUI / 19

HANA Database Copy / 20

Commvault GUI / 20

SAP HANA Studio / 21

INTELLISNAP FOR HANA / 24


Preparation / 24

Backup / 26

Restore / 27

MULTI-TENANT DATABASE CONTAINERS / 28


Configuration / 28

Backup / 28

Restore / 29
INTRODUCTION
SAP HANA is a new and innovative in-memory database platform and SAPs answer to the
question on how to analyse Big Data in near real time. HANA takes full advantage of all-new
hardware technologies by combining columnar data storage, massively parallel processing of
modern CPUs and in-memory computing. This puts HANA in a position to be able to support
numerous use cases in the real-time analytics space. Above that, SAP HANA can also be deployed
as the underlying database of SAP Business Suite applications.

A HANA database is identified by a unique SID. Up to four so-called servers (depending on HANA
SPS level) form a HANA database. Each of these servers has its own data and log volume. In case
of increasing workloads, a HANA database can be scaled up by adding more memory and CPUs to
the local node its running on.

HANA SID
NAME SERVER STATS SERVER XS ENGINE INDEX SERVER
MEMORY

LOG DATA LOG DATA LOG DATA LOG DATA


Vol Vol Vol Vol Vol Vol Vol Vol
PERSISTANCE LAYER CONFIG FILES
BACKINT FOR HANA

CLOUD

Figure 1: SAP HANA Single Node Configuration

There is also a scale-out option which works through adding additional nodes leading a single
database being spread across multiple nodes.

HANA SID
INDEX SERVER INDEX SERVER INDEX SERVER INDEX SERVER
STATS SERVER STATS SERVER STATS SERVER STATS SERVER
XS ENGINE XS ENGINE XS ENGINE XS ENGINE
NAME SERVER NAME SERVER NAME SERVER NAME SERVER
CONFIG CONFIG CONFIG CONFIG
FILES FILES FILES FILES
NODE 1 NODE 2 NODE 3 NODE 4

BACKINT FOR HANA

CLOUD

Figure 2: SAP HANA Multi Node Configuration

4
In order to protect against power failures and system crashes, HANA has the concept of persisting
all changed data of the four HANA servers along with their logfiles to disk as so-called savepoints.
Those savepoints are scheduled to happen periodically (typically every 5 minutes). Savepoints are
consistent images of the database. After a crash the in-memory database gets loaded from the
last savepoint and is rolled forward to the latest transaction using the externalized logfiles.

PROTECTING SAP HANA


There are basically three main protection options for SAP HANA:

File-level backup, where the data gets written to a local storage location
Snapshots using storage-level snapshot technologies
Backint for HANA, which is a SAP-defined streaming backup interface for connecting centralized
3rd party backup solutions to backup HANA

As of now, Backint for HANA is the backup approach preferred by many HANA users as it is the
only way for connecting a SAP HANA landscape to the existing centralized backup solution like
Commvault software in a SAP-certified way.

Commvault, as a market leading solution for enterprise backup, not only implements Backint for
HANA but also supports SAP HANA Snapshot interface as part of the Commvault iDataAgent for
SAP HANA. Commvault software protects scale-up and scale-out configurations for standalone
SAP HANA deployments alongside with SAP Business Suite Powered by HANA and SAP S/4 HANA
environments.

Data transfer via Backint for HANA works through named pipes. Communication between HANA
and the backup tool is done facilitated using the so-called input and output files. For instance, for
a backint backup call, HANA allocates named pipes and passes their full path via the input file.
Once the backup has completed, Commvault software returns backup status information (like
the backup IDs) and return codes via the output file back to HANA. According to the standard, the
Commvault SAP HANA agent executable is named backint and is accessed via a logical link in a
defined directory

PREPARATION
Before the installation of the Commvault agent for SAP HANA can start, we need to find out the SID
of the SAP HANA database. Above that, we also need to make sure that two directories exist, which
are required during and after installation:

SAPHANAEXE directory, which will hold the symbolic link to Commvault SAP HANA agent later-on
- /usr/sap/<SID>/SYS/global/hdb/opt
Backint for HANA agent configuration file directory
- /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig

If either one of these directories is missing, it needs to be created manually as user <SID>adm.
This activity needs to be repeated on all SAP HANA nodes in a multi-node environment.

5
INSTALLATION
Commvault SAP on HANA agent can be installed from command line or using push install.
Remember, this needs to be done on all SAP HANA nodes.

COMMAND LINE INSTALLATION


Command Line Installation needs to be performed using cvpkgadd. When running cvpkgadd, select
SAP HANA agent. During installation specify:

/usr/sap/<SID>/SYS/global/hdb/opt as SAPHANAEXE directory


sapsys as OS group (alternatively, you can create and specify on own group, but need to assign it
to <SID>adm as secondary group)

After installation, the link to Commvault backint executable should be available (if not, create it
manually as user <SID>adm, see also next section):

PUSH INSTALL
After selecting the SAP HANA agent, make sure you enter the correct OS group (see above) before
pushing out the agent.

For V11 up to SP3, you will not be asked for providing the path for SAPHANAEXE. Therefore, you
need to create the symbolic link to Commvault backint manually after completion of the push
install. Starting with SP4, SAPHANAEXE path will be requested during push install.

6
CONFIGURATION
Before you can run Backups and Restores, you need to complete configuration by creating and
linking a parameter file, creating a pseudo-client in Commvault GUI and switching on Backups via
Backint in SAP HANA Studio.

BACKINT FOR HANA PARAMETER FILE


Now that the installation is complete, you need to create the Backint for HANA parameter file
(containing parameters for the Commvault SAP HANA agent) and the associated symbolic link from
SAP HANA side.

With Commvault V11 it is important to name the parameter file param and place it under /opt/
commvault/iDataAgent. It should be given read-write permissions (664), assigned to group sapsys
and owned by user <SID>adm.

For single-node HANA, the minimum parameter set to be included is CvInstanceName and
CvClientName

Create required symbolic link in hdbconfig directory:

You need to run through this configuration procedure on EACH HANA node in a multi-node
environment. Please note that you can use a shared parameter file for HANA multi-node
configurations as CvClientName is not needed here.

7
COMMVAULT GUI CONFIGURATION
In Commvault GUI, you need to create a pseudo client for the SAP HANA instance.

You can give it whatever name that makes sense to you. In addition you need to enter

SID of the HANA database


<SID>adm HANA OS user
HANA instance number
Authentication credentials. There are two options here
Provide an existing HANA hdbuserstore key. When created using hdbuserstore CLI, it needs to
be associated with a database user having all privileges for backup and restore. In this case,
no password is required
Specify a database user which has all priviledges for running backup and restore operations
along with its password. Commvault software will then automatically create a hdbuserstore
key which is connected to this database user
Location of the hdbsql command (run which hdbsql as user SIDadm on HANA machine)

8
In Details tab you need to enter the physical hostname of all participating HANA nodes. In this
example we configure a single node environment and therefore only one hostname is entered.
Please note, for HA or HANA system replication setups, you also need to add the resolvable
name of the virtual IP.

Under tab Storage Device tab enter Storage Policies, Dedupe and Compression settings as
needed. As for setting up a suitable Storage Policy, it is recommended to configure the primary
copy to go to a disk library. This is because HANA environments can easily generate thousands
of logfile backup jobs per day. Backing up every single logfile to tape library or VTL would
create a massive overhead and also wear out the hardware quickly. If a tape copy is desired, we
recommend to configure this as a secondary copy and run periodic auxcopy jobs every couple of
hours to copy all new logfiles to tape or VTL.

Please note that the HANA GUI instance is simpler in Version 10. This product version also does not
support subclients and Intellisnap for HANA. With Version 10 HANA backups can be scheduled by
using a little script only.

SAP HANA STUDIO CONFIGURATION


What you need to accomplish here is to make sure Backint is enabled and to configure this backup
method both for data and log file backup. Now start SAP HANA Studio GUI and open the backup
console und respective SID.

After clicking on Configuration and Backint Settings, you will notice that HANA has already 9
detected Commvault SAP HANA agent as it has found the symbolic link in the expected place. The
previously created parameter file should have been detected as well (if not just enter the HANA-
side path to symbolic link). Tick the box that instructs HANA to use the parameter file both for
HANA data and log backup.

Now all data backups will go to Commvault, but logfile backups will still go to file (which is the
default). In order to change the log file backup destination to backint, go to Log Backup Settings.
In order Under Log Backup Settings, select Backint as Destination type, then enable automatic
log backups and specify an appropriate backup interval. For testing, a 5 minute interval should be
fine in order to see quick results.

Finally, dont forget to save your settings in SAP HANA Studio. After a while you will notice logfile
backups are coming in

10
BACKUPS

TRIGGERED BY SAP HANA STUDIO


Full database backups can be currently initiated from SAP HANA Studio GUI only. Alternatively, a
shell script using the respective HANA hdbsql command can be used.

For running a full backup to SAP HANA Studio, right click your SID and select Back Up

Select Backint as Destination Type and decide on backup type (full, differential or incremental).
You can also decide on a specific backup prefix, then hit continue:

On the next screen, hit Finish. Note that the backup is starting. You can watch all four HANA
servers being backed up in parallel.

11
In Commvault GUI a new job is displayed of the type Application Command Line Backup as this
was started from the HANA machine. By checking Commvaults backup history we can see the
successful differential backup and a number of logfile backups which happened in the meantime.
Please note that HANA Backup Catalog Backups also show up as logfile backups (marked as log_
backup_0_0_0_0 in HANA backup catalog details)

When you open HANAs backup catalog, you can easily correlate the listed jobs with the Commvault
job history by clicking on a single job and looking at the backup identifier (EBID). The last number
in the identifiers is the Commvault job ID (in this example job 12699 and EBID 62852948_12699,
see below). You can also see that the highlighted job is a differential backup consisting of multiple
backup pieces, representing the different HANA servers. By right-clicking on a specific job it can
be deleted from SAP HANA history and optionally from Commvault backup history at the same
time.

SCHEDULING OF BACKUPS
After saving the new HANA instance in Commvault GUI a default subclient will be created
automatically. You can use this subclient or create your own subclients for scheduling full,
differential and incremental HANA backups or for using Intellisnap. Please note that using SAP
HANA incremental and differential backups requires SAP HANA SPS10 or higher. Scheduling
can be configured at subclient level or via a schedule policies. HANA logfile backups are always
initiated on the HANA side and cannot be scheduled using Commvault.

12
For scheduling with Commvault Version 10, you need to create a little shell script, which invokes
the HANA hdbsql tool. First step for this is to create a backup user in SAP HANA Studio (having
all backup and restore privileges). In order to avoid having to specify a password clear text in
the script, a special key (BACKUPOPERATOR in our example below) needs to be created in HANA
hdbuserstore (with a password) and associated with the database backup user. This allows to
use -U option of hdbsql in the script which doesnt ask for a password. The script should also
create and pass a unique identifier which will be shown in HANA Backup Catalog and allows to
understand which backup was run by whom and when. Here is a complete example script for a
HANA instance HSB:

#!/bin/bash

TIMESTAMP=$(date +\%F\_%k\%M)
BACKUP_PREFIX=SCHEDULED
BACKUP_PREFIX=$BACKUP_PREFIX_$TIMESTAMP

su hsbadm -c hdbsql -i 0 -U BACKUPOPERATOR \backup data using backint ($BACKUP_PREFIX)


ASYNCHRONOUS \
RETURN_CODE=$?
exit $RETURN_CODE

In Commvault GUI, you need to create a subclient under the File System agent on the HANA node
(or control node in a scale-out setup). In the content tab, enter all HANA config file paths (we need
to back up theses files separately as they are not covered by the HANA DB backup).

13
In a final step, you need to integrate the previously created script into the subclient. It is
recommend to add it as PreScan script, as this this will ensure that the scripts will be executed
even if the file system backup fails.

Once a backup of this subclient is initiated, you will get a file system backup job along with a HANA
full backup.

The name tag that was assembled by the script becomes the prefix of the backup name in HANA
Backup Catalog, which makes it easy to differentiate between manual and scheduled backups.

SCHEDULING VIA SAP DB13/DBACOCKPIT

If you want to schedule HANA backups using transaction DB13/DBACOCKIT, for instance in a SAP
Business Suite powered by SAP HANA setup, you need to create a new action, select the desired
action type (e.g. Complete Data Backup) and choose Backint at Destination Type and make sure
that Backup Destination and UTL File have the same values as in HANA Studio. Please note that
UTL File is called Parameter File in HANA Studio.

14
HANA-SIDE TROUBLESHOOTING AND MONITORING
In case of issues, its always good to understand whats going and whats happened. On the SAP
HANA side its useful to lock into backint.log and backup.log.

15
While backup.log is more of a summary of the backup activity, backint.log shows the actual backint
(i.e. Commvault SAP HANA Agent) invocation and the CLI output of the agent. This log for instance
allows you to see if your parameter file was found and all parameters were correctly passed over
to Commvault.

Those logs can be found in SAP HANA Studio and also under

/usr/sap/<SID>/HDB<Inst No>/<hostname>/trace/backup.log
/usr/sap/<SID>/HDB<Inst No>/<hostname>/trace/backint.log
16
RESTORES

RESTORING VIA SAP HANA STUDIO


In order to bring up the SAP HANA Recovery restore and process, right-click on the HANA instance
and select Recover.

As HANA needs to be offline for the restore, you will be asked to agree to shut it down. In the
following screen, you can select between full and point-in-time recovery. You can also select to
restore a backup taken from a different HANA system.

17
After selecting the recovery option, you need to pick the desired full backup from a list of backups
which is taken from HANA backup catalog.

In the next screen, please make sure you instruct HANA to use backint for searching for required
log files. HANA will conduct this search before the restore is initiated.

18
All HANA services are restored at the same time.

After the restore is finished, HANA automatically requests all logs which are required to recover
the database.

After the database recovery (according to initial settings) has finished, all HANA services are
automatically started and the database is made available.

RESTORING HANA VIA COMMVAULT GUI


As with other Commvault agents HANA restores can be initiated via selecting Browse and
Restore when right-clicking on the HANA instance.

19
In terms of restore granularity it is currently only possible to restore the entire database. In the
final screen you can decide between full and PIT recovery, enable a data-only restore or optionally
remove all existing logs for log area. Once you hit OK, the restore job will automatically shutdown
the database, transfer the data and startup HANA again after the recovery phase.

HANA DATABASE COPY


Database copy is an out of place restore in conjunction with a change of the SID. You can create the
database copy on the same host or on a different host, for instance in order to create or refresh a
HANA test or development system. Please note that any SAP-side restrictions affecting database
copies using a third-party backup tool based on the backint interface apply. Please check SAP
HANA Administration Guide and SAP notes for more details.

COMMVAULT GUI

A HANA database copy is a cross system restore from Commvaults perspective. For this, you
need to start the restore dialog in the GUI from the source HANA instance. As an example, we
restore database TR2 running on host hana3 to TD2 running on host hana4. So we select browse
and restore on instance TR2. In the final screen we need to select the correct destination client
(HANA_TD2) from the drop down. This will also populate the Destination Instance field. If
more than one HANA instance runs on the destination, make sure you select the correct one.
Furthermore, please make sure you select the Initialize Logs option which we clean up the log

20
destination so that no remaining logs from the old target instance can prevent proper recovery
after the database copy. Once you hit OK, the database copy will run fully automated. There is no
need to apply changes the the HANA parameter file. Everything will be handled automatically in the
background.

SAP HANA STUDIO

In the next example, we do it the other way around and restore database TD2 to TR2 using SAP
HANA Studio. The major differences between creating a database copy via Commvault GUI and via
HANA Studio are:

A SAP-defined, special naming convention for the HANA parameter file on the target machine
needs to be followed (see SAP HANA Administration Guide, chapter 7 for more details). The SID
of the source database as part of the parameter file name of the target database instance
The two parameters SrcCrossClient and srcCrossDbName need to be present and point to the
source database instance. Please note that these parameters are set automatically if you restore
via Commvault GUI

21
This means for our example:

The correct parameter file needs to be configured in HANA Studio as well:

The database copy can now be initiated on the target system by selecting Backup and Recovery
-> Recover System. After deciding between full and point-in-time revovery you need to enable the
Backint System Copy option on the following screen and enter the SID of the source system.

22
Now HANA requests (from Commvault) the backup catalog of the source database which
eventually gets discplayed in the following screen, where you need to select the desired full
backup to be restored.

Make sure that the correct source system gets displayed. In the next screen it is important to
enable the initialize log area option again.

23
This screen indicates that the database copy was successful.

INTELLISNAP FOR HANA


As part of Commvault V11 SP3, Intellisnap for SAP HANA was introduced. This feature is based
on the SAP HANA snapshot interface and fully SAP-integrated. Before you start, please note that a
couple of restrictions/caveats are important to understand. As of V11 SP3 only single-node (scale
up) HANA configurations are supported by Commvault. From the SAP side, snapshot backups of
HANA Multi-Tenant Database Container (MDC, see next section) setups are currently not supported.
Please see SAP Note 2096000 for details and possible changes with future SAP HANA releases.

PREPARATION
Using Intellisnap for HANA requires some preparation. First of all, you need to install a Commvault
Media Agent instance on the HANA client machine (in addition to the HANA agent) and apply SP3
on all Commvault components. Secondly, it is important to understand that Commvault snaps
the HANA persistent data storage area only. On the HANA side, you need to find out where the
persistent data storage area is located. You can find this information in the persistence section
of global.ini file. Look for parameter basepath_datavolumes. You need to make sure that the
persistent data storage area sits on a storage LUN which is supported by Commvault Intellisnap.
Please note that HANA log backups will always run in the streaming fashion.

24
In case you are running SAP HANA in a virtual machine and want to use Intellisnap technology, you
should be aware that the HANA persistent data area cannot reside on a VMDK disk. Intellisnap only
supports storage mapped into VMs via:

NFS
iSCSI
Raw Device Mapping (RDM)

It is sufficient to only place the HANA persistent data area on such a LUN or NFS share.

Once the storage-level configuration on the HANA side is done, you need to do some configuration
work on the Commvault GUI. First of all you need to enable Intellinsap on the pseudoclient level in
advanced client properties area. Then you need to configure the storage array hosting the HANA
snapshot LUNs. Klick on Manage Array for this. It can be sufficient to enter here a user and a
password, but depending on the storage product in use it might be required to enter additional
information. See Commvault Online Documentation for more details. This configuration is pretty
much the same for all Commvault agents supporting Intellinsap.

In a next step you need to create a new subclient under the HANA instance. Make sure you
associate this sublient with a storage policy that has a primary snap copy configured. In the
Intellisnap Operations tab, you need to enable Intellisnap technology on the subclient level and
also select the correct snap engine for your storage product in use. Finally select a so-called proxy
which will create snapshot copies to disk or tape by mounting the snapshots. Any media agent
running the same OS as the HANA clients can be leverage for this.

25
BACKUP
When you manually initiate a new HANA snapshot, you will notice that only full backups are
available (and supported). By checking the job monitor, you will notice that the job is marked as a
snapshot backup:

In HANA Studio, you can also follow the snapshot creation while the job is running:

Once the job has finished, it is correctly displayed as a snapshot in HANA backup catalog.

Using List Snaps (on HANA instance level), you can monitor snapshot operations conducted by
Commvault.

HANA Snapshots can be selectively copied to disk/tape using the Backup Copy function of the
storage policy.

26
RESTORE
Restoring from HANA snapshots follows the described procedure via Commvault GUI. All you need
to do is select a snapshot backup job, go through the dialog and start the restore. In this case, the
relevant snapshot will be mounted on the target system and all files will be copied from there.
The performance of this restore variant is largely depending on configuration and throughput
of the entire data path (Storage, SAN, LAN, etc.). Many storage vendors also support a so-called
revert restore, where no data is transferred. Instead, the snapshot is transformed into the primary
data volume. This restore option is usually much faster as it usually takes only minutes. It is
recommended to take a new snapshot backup immediately after the revert restore has finished.
This is because the revert operation usually invalidates all newer snaphots which were taken
after the snapshot which was used for the restore. Revert restore can be enabled under advanced
restore options (Use hardware revert capability if available).

Please note that restoring from Commvault Snapshots is currenty not supported via HANA Studio.

In case you want to restore from a snapshot copy (residing on tape or disk) using via HANA Studio
or command line, you need to include the parameter CV_restCopyPrec alongside with the
number of the storage policy copy in the parameter file. When restoring from snapshot copy using
Commvault GUI, you need to configure the Copy Precedence tab under advanced restore options.
In this case, the parameter file can remain unchanged.

27
MULTI-TENANT DATABASE CONTAINERS
SAP HANA Multi-Tenant Database Container (MDC) installations consist of a system database
and a number of so-called tenant databases. The system database is the central component
is it manages the global configuration. Tenant databases are isolated from each other and can
be assigned to different applications, users or customers. All backup and restore operations
(including tenants) go through the system database. However, tenant database have their individual
backup catalogs.

A couple of SAP-side requirements and caveats are in place when is comes to protecting SAP
HANA MDC installations via backint agents. First of all, HANA SPS 09 Rev 94 or higher is required.
Please also note that currently only streaming backup is possible at this time (no snapshots) and
restores can be in place only. See SAP Note 2096000 for more details.

CONFIGURATION
Configuring a HANA MDC instance on the OS level (installing the agent, symbolic links, parameter
file) and in Commvault GUI is done via using the SID of the MDC instance and is not different from a
non-MDC setup. In HANA Studio you will notice that only the system database has a configuration
tab as part of the backup console. This is the place where you need to put your configuration in
place as described before.

BACKUP
As of Commvaut V11 SP3, it is not (yet) supported to run and schedule backups out the GUI. This is
planned for a later V11 Service Pack. Backups can be initiated via HANA Studio or using a script. In
HANA Studio, when you select Backup and Recovery on the level of the system database, you can
kick-off backups of the system or a tenant database.

28
After selecting tenant, you can now pick which tenant database you want to back up

Afterwards, the backup is started and progressing just like we are used to it. When the job has
finished it is recorded in the backup catalog of the tenant database.

Please consult Commvault online documentation for an example of a tenant backup script.

RESTORE
Restores of SAP HANA MDC setup is supported via HANA Studio or via script. Restoring via HANA
Studio starts with picking the desired tenant.

In the following screen you are presented with the backup catalog of that tenant. After selecting
the backup to restore from you can start the process.

Please consult Commvault online documentation for an example of a script-based tenant restore.

29
2016 Commvault Systems, Inc. All rights reserved. Commvault, Commvault and logo, the C hexagon logo, Commvault Systems, Commvault
OnePass, CommServe, CommCell, IntelliSnap, Commvault Edge, and Edge Drive, are trademarks or registered trademarks of Commvault
Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to
identify the products or services of their respective owners. All specifications are subject to change without notice.

PROTECT. ACCESS. COMPLY. SHARE.


COMMVAULT.COM | 888.746.3849 | GET-INFO@COMMVAULT.COM
2016 COMMVAULT SYSTEMS, INC. ALL RIGHTS RESERVED.