Create a Backup
- How to create a backup for you database using either HANA Cockpit, HANA Studio, or a SQL command line
- Step 1
This option requires an SAP HANA, express edition Server + Applications installation.
Open SAP HANA Cockpit and log in using
Open your system database in the Resource Directory window.
Scroll down to the System DB Monitoring and Administration section and click Manage database backups under Administration.
On the bottom right of the page, click Create Backup.
Select your Backup Type and Destination Type. You may also change the Backup Prefix and Backup Destination. By default the values for Backup Prefix and Backup Destination are
Click Back Up to create your backup.
A new page will open with a progress bar. Creating your backup will take a few minutes.
Once the backup is complete, a new page will show your successful backup. Two files are created:
How many backup files are created?
- Step 2
On SAP HANA Studio, log on to your SAP HANA, express edition installation.
Double-click the Backup icon.
If this is your first backup, under the Overview tab, click back up now. If this is not your first backup, click the Open Backup Wizard iconby Status of Currently Active Data Backup.
The backup window opens.
Choose your Backup Type and Destination Type as necessary. By default, the values are
Complete Data Backupand
Choose your Backup Destination and Backup Prefix. This will be where your files are stored and what they will be called. By default, the values are
When you are finished, click Next >.
Review your backup settings and click Finish to begin creating your backup. Creating your backup will take a few minutes.
What do you click to start your first backup?
- Step 3
In SAP HANA Studio or another connected SQL command line, create a backup user and grant it backup permissions.bashCopy
CREATE USER backup_operator PASSWORD <password> NO FORCE_FIRST_PASSWORD_CHANGE; GRANT BACKUP OPERATOR to backup_operator; ALTER USER backup_operator DISABLE PASSWORD LIFETIME;
This creates the user backup_operator with the given password and tells the system to not require a password change upon first login. It gives also gives backup_operator permission to make backups. You will be using this user to only create backups so logging in for each backup is not required. You only need to do this once.
Connect to your SAP HANA, express edition installation using a command line.
Log in as
su -l hxeadm
Create the backup key.
Execute the following command to create the user key backup.bashCopy
hdbuserstore -i SET backup <hostname>:3<instance_number>13 backup_operator
Create the file
Copy and paste the following code:bashCopy
## defines backup prefix TIMESTAMP="$(date +\%F\_%H\%M)" BACKUP_PREFIX="SCHEDULED" BACKUP_PREFIX="$BACKUP_PREFIX"_"$TIMESTAMP" # TENANT="<tenant_database_name>" ## runs the backup sequence using the backup key hdbsql -U backup "backup data using file ('$BACKUP_PREFIX')" # hdbsql -U backup "backup data for $TENANT using file ('$BACKUP_PREFIX')"
This script will be used to create your backups. If you need to backup more than one database (you have tenant databases, for example), use the commented sections as a template.
chmod u+x backup.sh
Wait while your backup is created.
(Optional) Check your backup repository to ensure your backup was created.bashCopy
A list of your backup files is displayed.
What is the code to use for creating a backup?