Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
pgangadharappa
Associate
Associate
0 Kudos
This blog would give an overview of how to perform HANA Database Backup using script and move the older backups to GCP bucket for future use in case of disasters or issues with Database.

In the first part, let us look into how to perform HANA database backup. This has been explained in many blogs but in any case will do it again 🙂

Part 1 : HANA Database backup

Firstly you will need to create a user with backup operator role in both SYSTEM and tenant DB as below.

Here I have created user backup_operator.





Next, you will create a key using hdbuserstore which will be used in script to perform backup.

Below is the command which needs to be executed. With new versions, we all have MDCs but in any case, I have added command to be used for single DBs

backup_operator is the user which we created in previous step

Single DB 3<instance. no>15 ,

./hdbuserstore –i SET host:3<instance.no>15 backup_operator

MDC - 3<instance. no>13

./hdbuserstore –i SET host:3<instance.no>13 backup_operator

Here, key name is backup. You can select any other name as well but make sure to update the script with right key name



Finally you can run the below script to run HANA Database backup. Make sure you run the script with user <SID>adm



Part 2 : Moving Database backup files to GCP Bucket

It usually happens that HANA Database backup files fill up the space soon and you will need to move it to different location to save it for future use based on your retention strategy.

Here, I am using an example of GCP Bucket.

gsutil is a powerful tool which we can use to copy, move files to and from GCP bucket.

Before proceeding further, ensure you follow below link and install gsutil in your system.

https://cloud.google.com/storage/docs/gsutil_install

Run the below script to move files older than three days to GCP bucket. You can ofcourse modify -mtime based on your retention strategy.



This way we can move old backup files to GCP bucket.

I am providing a wiki link here where the script files have been uploaded for easier use.

https://wiki.scn.sap.com/wiki/display/Snippets/HANA+Database+Backup+and+GCP+Upload?flashId=596011570

Mind you, these scripts can be scheduled using crontab in Linux for automatic running. Ensure your uploding to GCP script runs first so you have enough space for performing backup.

Hope this information helps to automate complete data backup for a day or month or week.
1 Comment
Labels in this area