There is nothing more important than securing your data. Although SAP HANA studio provides a way to automatically back up your database, it is best to have those backup files saved offsite.

Here we provide a way to back up your HANA database and save it to the ftp server.

The file structure is shown here:

/usr/sap/NDB/HDB00/backup/autobackup/MTC     The folder to save temporary backup data and logs files. 

/usr/sap/NDB/HDB00/backup/autobackup/MTC.sql  HANA database backup query script.

/usr/sap/NDB/HDB00/backup/autobackup/autobk.sh Main script to back up automatically. 

/usr/sap/NDB/HDB00/backup/autobackup/ftp.sh   Script to upload tar files to ftp server.

MTC.sql

EXPORT "MTC"."*" AS BINARY INTO '/usr/sap/NDB/HDB00/backup/autobackup/MTC' WITH REPLACE THREADS 10;

autobk.sh

#!/bin/bash
cd /usr/sap/NDB/HDB00/backup/autobackup
rm -fr MTC/*
echo "Starting backup MTC"
/usr/sap/NDB/HDB00/exe/hdbsql -u SYSTEM -p Password -i 00 -c ";" -I "/usr/sap/NDB/HDB00/backup/autobackup/MTC.sql"
tar cf "MTC-$(date '+%Y-%m-%d').tar.gz" MTC/
echo "Backup MTC Done"
rm -fr MTC/*
chmod 755 -R *.tar.gz
echo "Upload to FTP"
./ftp.sh run ftp.sh script
echo "Done"

ftp.sh

#!/bin/bash
HOST=ftpserveripaddress
USER=ftpusername
PASS=ftppassword
ftp -inv $HOST <<EOF
user $USER $PASS
cd /usr/sap/NDB/HDB00/backup/autobackup
bin
cd /Shares/Backup/HANASERVER remote ftp folder
mput *.tar.gz
bye
EOF

Finally create a cron job to run the autobk.sh daily.

crontab -e

3 22 * * * /usr/sap/NDB/HDB00/backup/autobackup/autobk.sh  &gt;&gt; /var/log/HanaDB-Backup.log 2&gt;&amp;1

Test: every day 9:03PM, the cron job will run, back up the database, compress the whole backup folder, and update the tar file to the ftp server.

Hope this can help.

by MTC Systems on Mar 27, 2017 8:04:33 PM

Leave a comment

Related posts

SAP Business One Browser Access Installation

Browser Access is an important feature in SAP Business One 9.2. The installation is pretty easy and can be explained in a few...

MTC Systems
By MTC Systems - August 14, 2016
SAP Business One SBO Mailer resend failed Emails

Note: it is not recommend by SAP to manually change system table fields value but besides use Diapi or Service layer to resend...

MTC Systems
By MTC Systems - August 5, 2016