Wednesday 9 November 2016

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

There a three tools you can use to make a backup of your SAP HANA database:
  1. SAP HANA cockpit
  2. SAP HANA studio
  3. 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.
1. 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.

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

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.

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

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

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

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

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

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


Source: go.sap.com

No comments:

Post a Comment