Skip to Content
Author's profile photo Denys van Kempen

Backup the Database(s) for SAP HANA Express – by the SAP HANA Academy

Recently, we have published a number of new tutorial videos to the SAP HANA Express edition playlist on our SAP HANA Academy YouTube Channel.

In this playlist you will find video tutorials on miscellaneous topics; some included in the Getting Started with SAP HANA express edition guide (PDF) that comes with the download, others not (yet).

How to backup a (tenant) database is such a topic.

If you are not familiar yet with the topic of backup and recovery for SAP HANA in general, please see my blog or check out the Backup and Recovery playlist on the Academy: http://bit.ly/2eNfXJf

There a three tools you can use to make a backup of your SAP HANA database:

  • SAP HANA cockpit
  • SAP HANA studio
  • hdbsql

For the VM, I should maybe add that you can also – of course – create a snapshot of the VM but this does require quite a bit of hard disk space.

SAP HANA cockpit

Using the SAP HANA cockpit is probably the easiest way to perform database backups.

To enable this, you have to add the backup administrator role.

call GRANT_ACTIVATED_ROLE ('sap.hana.backup.roles::Administrator', 'SYSTEM');

This will add the SAP HANA backup catalog to the cockpit and add the Data Backup tile to the dashboard.

You can access the SAP HANA cockpit with URL:

http://hxehost:8000/sap/hana/admin/cockpit

See below for a tutorial video on how you can add the hostname of the VM to the hosts file of your PC or Mac.

Select the tile to open the Backup Catalog app and click Create Backup. Optionally, edit the backup type, prefix, or destination and select Back Up.

SAP HANA studio

To backup a database using SAP HANA studio, just open the Backup Editor in the Systems View and open the Backup Wizard. The SYSTEM user already has the BACKUP ADMIN system privilege so there is no need to add any privileges to use this tool.

See below for a tutorial video on how you can connect SAP HANA studio to the SAP HANA express edition VM.

In the wizard you can then specify the backup settings, same as for SAP HANA cockpit.

Command line (hdbsql)

Finally, you can use the command line tool to perform the backup using SQL. This way you can easily automate the backup to be executed at a set time (using cron), for example, each time you start the VM.

To do this securely, it is recommended to use a secure store key file and use the restricted privileges of the BACKUP OPERATOR role.

## execute command with user key
# hdbuserstore -i SET backup hxehost:30013 backup_operator
hdbsql -U backup "backup data using file ('$BACKUP_PREFIX')"
hdbsql -U backup "backup data for $TENANT using file ('$BACKUP_PREFIX')"

If you have setup shared folders for the VM, you can even copy a zipped backup directly to the host computer.

So how can you do this? It is simple.

1. Watch the video

2. Use the code sample from Github

https://github.com/saphanaacademy/HXE/blob/master/backup/backup.sh

How to?


Blog Series

This blog is part of a series:

 

Help Portal

SAP HANA Database Backup and Recovery

SAP Notes

1642148 – FAQ: SAP HANA Database Backup & Recovery

 

Thank you for watching

The SAP HANA Academy provides free online video tutorials for the developers, consultants, partners and customers of SAP HANA.

Topics range from practical how-to instructions on administration, data loading and modeling, and integration with other SAP solutions, to more conceptual projects to help build out new solutions using mobile applications or predictive analysis.

For the full library, see SAP HANA Academy Library – by the SAP HANA Academy.

For the full list of blogs, see Blog Posts – by the SAP HANA Academy.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Denys,
      hope the next part of your series will be the restore.
      CU
      Gregor

      Author's profile photo Arndt Sieburg
      Arndt Sieburg

      Hi Denys,

      backup for tenant databases is different. I understood following with SPS 12 :

      HANA Cockpit: you can only backup the SystemDB, but not tenant databases.

      HANA Studio: you need to connect to the SystemDB in order to backup tenant databases.
      The backup wizard can backup the SystemDB only.
      In order to backup tenant databases, you need to right-click on the SystemDB connection or on the Backup folder underneath. In the Pop-Up context menu there's an entry "Back Up Tenant Database ..." with a separate wizard for Tenants.
      Connecting HANA Studio to a Tenant Database, the Backup Console is read-only.

      (I haven't tested command line backup)

      Best regards
      Arndt