Skip to Content

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 ./backup.sh –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,

Richard

To report this post you need to login first.

11 Comments

You must be Logged on to comment or reply to a post.

  1. 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!

    (0) 
  2. 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 ๐Ÿ˜€

    (0) 
  3. Amit Chaturvedi

    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

    (0) 
    1. Richard Bremer 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,

      Richard

      (0) 
  4. Jacques Engelbrecht

    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.

    (0) 
  5. 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?

    Regards

    (0) 
  6. 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 “


    Regards

    Venkat

    (0) 
  7. Gladson Jacob

    Hello.

    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!!!

    (0) 
  8. Gladson Jacob

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

    and B.SERVICE_TYPE_NAME='indexserver'

    to

    and ( B.SERVICE_TYPE_NAME='indexserver' or B.SERVICE_TYPE_NAME='nameserver' )
    (0) 
  9. Jing-Feng Tan

    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.

    (0) 
  10. Jing-Feng Tan

    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}
    SUFFIX=COUNT_$((DAYOFYEAR_NUMERIC%RETENTION_TIME))

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

     

    (0) 

Leave a Reply