Automatically Backup Your Data With Windows


With a few clicks, you can automatically backup your data with Windows.

Why Backup Your Data?

Anyone that has used a computer regularly, has experienced some sort of program crash, power failure, or the dreaded computer crash. All come with the loss of data and time, and costing you money. These are just the issues we face in today’s technology driven world. Fortunately, you can take steps to protect your data from loss.

Anyone Can Configure Windows to Backup Data

All versions of Windows have a user interface for setting up automatic backups with just a few clicks. You can customize the system to backup daily, weekly, continually. You can designate the target drive such as an inexpensive backup drive you can attach to your PC. As of this writing you can find backup drives for as little as $75 with 1 terabyte of storage!

How To Backup Your Data

There are several options available to set your data backups on automatic. As I said, Windows has a built in user interface for setting this up. Look for Windows Backup or Backup in the Start menu, do a search or even look in the Control Panel. Point the target drive to your local external drive or a network drive.

Beyond Windows Backup

With the growing popularity of the “cloud”, many cloud-based backup services are becoming available and affordable. So in addition to backing up your data, this will add an extra layer of security in being stored remotely. What’s the advantage? If you’re doing local backups to your external drive and there is a fire at your home/office, your system and backups may be destroyed. Storing your backups remotely removes this issue from the equation. Dropbox, Drive, Carbonite…these are popular options on the cloud.












HANA Database Backup using Cron

HANA Database Backup using Cron

To create backups using HANA we

  1. create a user
  2. create a user key
  3. create a script
  4. schedule the script to run via cron job

1) Create a HANA user to use specifically for Cron Job – Daily HANA Database Backup

Open an SQL Window and run the following to create a user,  give them access to backup,  and then remove their password so they can not connect via login.

create user backup_operator password Xxxxxxxx1;
grant backup operator to backup_operator;
alter user backup_operator disable password lifetime;

2)  Create a HANA user key to be used for automated connection to the HANA database by the Backup User

Login to the server console using putty.
Under the hdbclient/ directory use the hdbuserstore command to create a key, -i makes it so you will then have to type in a password key from the command above

#/vol/vol_HDB/sysfiles/hana/shared/HDB/hdbclient/hdbuserstore -i SET cronbackupkey localhost:30015 backup_operator

Next,  list all keys so that we know where the keys are that we will use to run the cron job automatically.

#/vol/vol_HDB/sysfiles/hana/shared/HDB/hdbclient/hdbuserstore list
DATA FILE : /home/backupuser/.hdb/sid-hdb/SSFS_HDB.DAT

 ENV : localhost:30015
 USER: backup_operator

Run a quick check of the new key by running a test command, this is where the password you entered above will be used

#/vol/vol_HDB/sysfiles/hana/shared/HDB/hdbclient/hdbsql -U cronbackupkey "select now() from dummy;"|more
"2014-12-26 21:46:24.799000000"
1 row selected (overall time 600 usec; server time 98 usec)

If you run into a situation where the password is wrong, you may end up with a message usage as this:

* 416: user is locked; try again later: lock time is 1440 minutes; user is locked until 2014-12-27 21:35:34.3170000 (given in UTC) [1440,2014-12-27 21:35:34.3170000] SQLSTATE: HY000

If that happens, fix the password by running the hdbuserstore -i DELETE cronbackupkey and hdbuserstore -i SET command above with the correct password than run the following commands to allow the user access again.

alter user backup_operator RESET CONNECT ATTEMPTS;

Using these method the automated method finally came together. Keep in mind the the password for connecting to the database is stored in the key, so if you update the password in the database for the user, you will need to also update the password stored in the key.


3) Create a bash script to backup the HANA database to a time and date file

Create a bash script file you can run from a cron job,  that does the work of creating a backup file.  I create a wrapper script instead or running  a command from the cron job,  so I can decide in the script whether I would like to receive an email with the output of the command.

#touch /customcommands/hanabackup
#chown hdbadm.sapsys /customcommands/hanabackup
#chmod 754 /customcommands/hanabackup
#vi /customcommands/hanabackup
tmpfile=/tmp/`date +s`
sqlcommand="BACKUP DATA USING FILE ('$(date +F_%k%M)')"
/vol/vol_HDB/sysfiles/hana/shared/HDB/hdbclient/hdbsql -U CRONBACKUPKEY $sqlcommand>$tmpfile
#look up the backup that just completed"
/vol/vol_HDB/sysfiles/hana/shared/HDB/hdbclient/hdbsql -U CRONBACKUPKEY "SELECT top 1 *
 WHERE ENTRY_TYPE_NAME = 'complete data backup'
 ORDER BY UTC_START_TIME desc">>$tmpfile
success=`grep $textsearch $tmpfile`
if [ "$success" == "" ]; then
 echo "HANA BACKUP FAILED: `date`"
 echo "SQL COMMAND: $sqlcommand"
 echo "TEXT NOT FOUND:$textsearch"
 echo "File Out Put Below"
 echo ---------------------------------
 cat $tmpfile
 exit 10
exit 0

This script will output a message ONLY if the HANA backup fails,  if it is successful,  it just quietly completes


4) Finally setup a cron job which runs the HANA database backup once a day

create a crontab entry to run one time per day at 1:01 am

#crontab -e
1 1 * * * /customcommands/hanabackup

In order to test that this works, you can force a test failure by setting a data_backup_buffer that is to high for your system see a recent post where we corrected this issue.
You can set a much higher limit than you system allows, and you can confirm that you have the CRON process send you an email each time that the process fails.

HANA error [447] backup could not be completed, [1000002] Allocation failed – Solution

HANA error [447] backup could not be completed, [1000002] Allocation failed  – Solution

When attempting to backup a HANA database, I received an error which stopped the backup from progressing

[447] backup could not be completed, [1000002] Allocation failed ; $size$=536870912; $name$=ChannelUtils::copy; $type$=pool; $inuse_count$=1; $allocated_size$=536870912

When I looked at which files were created as part of the backup I found that the entire backup did not fail,  actually it was only the ‘statisticsserver’ file that would have failed.

While the exact reasons for failure are still a mystery,  I found several posts online encouraging me to reduce the size of the data_backup_buffer_size.
Since I had already had several successful backups using the default information,  I was skeptical.   Turns out it did work,  by reducing the size of the buffer to only 256MB instead of 512MB,  the backup started to work again


But the thing that had changed in my HANA installation was the license,  so what was it about the reduction that made it work,  I have 33GB of space I can use in the system.

So,  while I have been able to resolve the issue and I can now create backups,   I do still have an open question to HANA to find out what it is about the data_backup_buffer_size that prevented me from using the default 512  to run the system after it has worked previously?

  • Do I now have full memory?
  • Am I only licensed to use a certain amount of memory and I can’t exceed it?
  • Do I have another setting in one of the other .ini files which limits how the data can be used?


Any comments on how i can control how this setting is used is appreciated!


Call Now Button(208) 344-1115


Join our email list

and get your free whitepaper