Skip to Content
Author's profile photo Richard Bremer

New and final version of backup script

One of the most stupid things I’ve done in my life was to create SAP Note 1651055 (SAP Service Market Place login required) and the script attached to that note. I’m very pleased to say that today I’ve released a new version of that script, and that it is also the final version. The last one. Terminally. For good. And all eternity. After all, the world was has been going to have been deleted in order to make room for a hyperspace bypass on a Thursday.

The backup script was created as a workaround for missing functionality, when there were no professional backup tools supporting the SAP HANA system. With the not-new-anymore BACKINT interface that has been adopted by all major backup management solutions, the script is in fact not needed anymore except for a few scenarios such as

  • HANA systems in a landscape without a good backup solution
  • Some people seem to want to use it for scheduling log backup deletion
  • Other reasons that may or may not be good.

The new version (version 04) of the script comes with the following major changes:

  • There was a change in the syntax in hdbsql which made the listing of log backups fail. The script has been adapted to the new syntax.
  • The script configuratoin has been moved to an external configuration file. Through this, the script itself is now system-independent. You can create configuration files for all your HANA systems and simply run the script via ./ –config-file=<file_name> [other options]
  • The script can now make use of HANA’s SQL syntax for deleting from the backup catalog: BACKUP CATALOG DELETE … – for details of that syntax read the admin guide or Lars Breddemann‘s and my book. This is offered in addition to the old functionality.
    The new command-line switch -cd (for catalog delete) implicitly invokes the BACKUP CATALOG DELETE command. It has to be paired with an option to specify a data backup ID: either –backup-id=<ID> or -od -cl as for the old option -ll. With -od -cl, the script determines the ID of the oldest data backup that still exists on disk in its original file system location.
    The BACKUP CATALOG DELETE command can delete only from the catalog, or also from the file system. This behavior can be customized in the script via an option in the configuraiton file.
  • We now clean up all temporary files (I think).
  • And most importantly: there are three switches cunningly hidden within the script that will stop the script from working unless one explicitly acknowledges that the script is not SAP-supported software; that one may not create SAP support tickets related to the script; and that there will be no further development on the script. If you run into trouble using the script, this scn blog post may be a good location for help. But please do not e-mail me; and please do not create SAP support tickets related to the backup script.

Have a good thanksgiving or – if that doesn’t mean anything to you – have fun,


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Lars Breddemann
      Lars Breddemann

      Hear! Hear!

      I'd say you're doing pretty alright if that was one of the things on the stupid side of life for you 😀 .

      I am really happy to see you took this step as it will - in case we're lucky - stop the emails that I always used to get in cc...

      For all the fans and heavy users of the script out there: remember that if anything doesn't seem to go your way, whatever you do, DON'T PANIC!

      Author's profile photo Sadanand Bhat
      Sadanand Bhat

      For all other reasons It was a great work Richard.

      And it helped and saved us in many ways.

      Time for SAP to come up with a similar solution now 😀

      Author's profile photo Former Member
      Former Member

      That's great Richard.

      This will be of great help. 🙂

      When this note will be released to general users?

      As of now the status is "Document is not released"

      Author's profile photo Richard Bremer
      Richard Bremer
      Blog Post Author

      Hi Amit,

      well spotted, thank you for alerting me. I thought I had already released the changes - looks like I'd made a mistake. It's now released.

      Best regards,


      Author's profile photo Former Member
      Former Member

      The ini-file customizing backup part of this script I think is still missing functionality. I know you can back up the files on OS level but I think this script does it more elegantly and also provide a good reference of what settings are not default, so its value go beyond simply having a backup.

      Author's profile photo Juan de la Cruz Arellano Royo
      Juan de la Cruz Arellano Royo

      Hi Richard,

      Thank you very much for your effor creating this script. Just a question regarding HOSTNAME paramter into config-file. How to specify all host in a scale-out scenario with stand-by host? Is it necessary to specify all systems with any separator?


      Author's profile photo V. Hariharan
      V. Hariharan

      Dear Richard,

      I am looking for a mechanism to delete entries only from backup catalog ( House keeping Section).

      1. Both the options (Deletion SQL using  backu-id and “-od” ) looks like , they delete only the logbackup and not databackup ?
      2. Moreover , the option “-od” looks like it will work with a logic to select the oldest existing data backup on DISK. But we are performing backups using BACKINT which are not stored in the DISK.  Extract from the documentation “In this case, the system will determine the oldest full data backup that still resides in its original location on disk. The backup ID of this data backup will be used in the BACKUP CATALOG DELETE command “



      Author's profile photo Gladson Jacob
      Gladson Jacob


      I'm testing the script, great job!!

      When executing the script with the parameters -cd -od (or -cd -od -cl) , shows this error:
      * 257: sql syntax error: incorrect syntax near "BACKUP_ID": line 1 col 44 (at pos 44) SQLSTATE: HY000

      Could you please assist?
      Thank you!!!

      Author's profile photo Gladson Jacob
      Gladson Jacob

      Modified the following statement in 3 SELECT statements as below and the problem was fixed.

      and B.SERVICE_TYPE_NAME='indexserver'


      and ( B.SERVICE_TYPE_NAME='indexserver' or B.SERVICE_TYPE_NAME='nameserver' )
      Author's profile photo Werner Flamme
      Werner Flamme

      This is needed always if you try to backup a SYSTEMDB. While the tenants have indexserver files, SYSTEMDB has nameserver instead. Just found out 😉

      Author's profile photo Former Member
      Former Member

      Hello Richard,

      Thanks for implementing the script. We have a requirement to take full backup along with the incremental backup, but I cant find any option for taking incremental backup. Could you please help us.

      Author's profile photo Former Member
      Former Member

      Hello Richard,

      I have also observed that the backup retention period may not work at the end of the year, since you are using date +%j for the current year. with next year it may lead to wrong backup suffix:

      declare -i RETENTION_TIME=${SUFFIX}
      DAYOFYEAR_STRING=$(date +%j)
      # strip leading zeros for numeric conversion:
      DUMMY=$(expr "${DAYOFYEAR_STRING}" : '0*\([1-9][0-9]*\)');
      declare -i DAYOFYEAR_NUMERIC=${DUMMY}

      Could you please check and let me know if I am wrong?


      Author's profile photo Aniket Walke
      Aniket Walke

      Hi All,

      I am very new to HANA  and my background is of SYBASE ASE . I found this script and i am trying to test  it but somehow i am getting errors in authentication phase itself. I am not using hdbuserstore . using the hdbsql syntax  but getting below eror ----


      + /usr/sap/DOD/HDB00/exe/hdbsql -a -c ';' -I /tmp/backup_DOD_sql_temp.tKh -o /tmp/backup_DOD_sql_out_temp.fQY
      Single Sign-On authentication failed


      can anyone tell how to resolve this ?



      Author's profile photo Amit Pimple
      Amit Pimple

      use hdbuserstore and this script should work fine.

      Author's profile photo Former Member
      Former Member

      Hi Guys, how to proceed to have Access to this script? I'm concerned about this log backup issue and I'm new to Sap Hanna but I've noticed that the log backup is being generated instantly and filling the filesystem in a very short period of time.