Sunday, 20 March 2016

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.

SAP HANA Certifications and Material

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.

SAP HANA Backup and Recovery


Source: scn.sap.com