Skip to Content
Author's profile photo SAP HANA Academy

SAP HANA Academy: Backup and Recovery – Backup Configuration Files

The SAP HANA Academy has published a new video in the series SAP HANA SPS 7 Backup and Recovery.

Backup and Recovery – Backup Configuration Files | SAP HANA

In this video you can view how to generate the ALTER SYSTEM ALTER CONFIGURATION statement for changed parameters.

The SQL file is attached to this document.

SQL.png

Syntax


select 'ALTER SYSTEM ALTER CONFIGURATION  ('''|| file_name ||''', '''||
        case layer_name
            when 'SYSTEM' then layer_name
            when 'HOST' then layer_name ||''', '''|| host
        end ||
        ''') SET ('''|| section ||''', '''|| key ||''') = '''||value ||''' WITH RECONFIGURE;'
        as "Configuration File Backup"
  from m_inifile_contents
where layer_name != 'DEFAULT'



We also show a simple sample backup script that copies HOST and SID configuration files.

The backup.sh file is attached to this document.


#!/bin/bash
# Simple sample backup script
# SAP HANA Academy
# http://academy.saphana.com
# Twitter: @saphanaacademy
# define backup prefix
TIMESTAMP="$(date +\%F\_%H\%M)"
BACKUP_PREFIX="SCHEDULED"
BACKUP_PREFIX="$BACKUP_PREFIX"_"$TIMESTAMP"
# source HANA environment
. /usr/sap/shared/DB1/HDB01/hdbenv.sh
# execute command with user key
# asynchronous runs job in background and returns prompt
hdbsql -U backup "backup data using file ('$BACKUP_PREFIX') ASYNCHRONOUS"
# create backup directory
BACKUP_DIR="$DIR_INSTANCE/backup"
BACKUP_DIR="$BACKUP_DIR"/INIFILE/"$TIMESTAMP"
SYS_BACKUP_DIR="$BACKUP_DIR/$SAPSYSTEMNAME"
HOST_BACKUP_DIR="$BACKUP_DIR/$VTHOSTNAME"
mkdir -p $BACKUP_DIR $SYS_BACKUP_DIR $HOST_BACKUP_DIR
# copy host configuration files
HOST_INI_DIR="$DIR_INSTANCE/$VTHOSTNAME"
cp $HOST_INI_DIR/*.ini $HOST_BACKUP_DIR
# copy system configuration files
SYS_INI_DIR="$DIR_INSTANCE"
SYS_INI_DIR="$(dirname "$SYS_INI_DIR")"
SYS_INI_DIR="$SYS_INI_DIR/SYS/global/hdb/custom/config"
cp $SYS_INI_DIR/*.ini $SYS_BACKUP_DIR
cp $SYS_INI_DIR/hdbconfiguration_* $SYS_BACKUP_DIR



Finally, we briefly discuss the SAP HANA hdbparam tool, which – for as far as I know – has not yet been documented.

/wp-content/uploads/2014/01/hdbparam_369321.png

SAP HANA Academy

Denys van Kempen

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kartik Natarajan
      Kartik Natarajan

      Hi Denys,

      Do we have backup script for c-shell(.csh)

      Author's profile photo Denys van Kempen
      Denys van Kempen

      Hi Kartik,

      Does the script return errors when executed in a C shell? BASH is an superset for C; typically this should work. \

      Regards,

      Denys

      Author's profile photo Kartik Natarajan
      Kartik Natarajan

      Hi Denys,

      I haven't used the above script, but tried with script attached with SAP note 1651055. It didn't work in my system.

      Regards,

      Kartik

      Author's profile photo Denys van Kempen
      Denys van Kempen

      Hi Kartik,

      I see.

      The note appears to date from the early days of SAP HANA:

      Please note: the script is only intended to demonstrate how backup control could be implemented. The responsibility to implement a backup solution appropriately lies with the implementation team. The script is also not intended to replace other scheduling mechanisms for database backups of SAP HANA Database such as the scheduling calendar of dbacockpit. Support for this script will not be provided via E-Mail or SAP Support tickets. Since its initial release, the script has only been provided by means of a consulting note. If have any questions regarding this script, please make use of the SAP HANA community in SAP Community Network (SCN). Version 4 from November 2014 is the final version of the script. There will not be any further changes.

      Have you studied the script?

      What exactly does not work?

      Why would you want the script for the C-shell?


      Regards,

      Denys