0% found this document useful (0 votes)
151 views

Backups Script Sap Hana

This document provides an example script for backing up an SAP HANA database. The script uses the hdbsql command to trigger a full database backup using the BACKINT interface. It creates a unique backup file prefix based on the current timestamp and hostname. The script collects the exit code of the hdbsql command and exits with the same code to indicate success or failure of the backup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Backups Script Sap Hana

This document provides an example script for backing up an SAP HANA database. The script uses the hdbsql command to trigger a full database backup using the BACKINT interface. It creates a unique backup file prefix based on the current timestamp and hostname. The script collects the exit code of the hdbsql command and exits with the same code to indicate success or failure of the backup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

BACKUPS SCRIPT SAP HANA

/usr/sap/NDB/HDB00/exe/./hdbsql -S HDB -n localhost:30015 -u system


-p CLAVE -I EXPORT "SBODEMOUS"."*" AS BINARY INTO '/usr/backup'
WITH REPLACE THREADS 10;

Database backup script


The following script is just an example and has to be adjusted to your needs. On execution,
it triggers a full database backup using the backint interface configured earlier in this guide.
Afterwards, it returns the exit code so that the command event will be shown with state
"Error" if something goes wrong.
Create this script within using the for expl. vi hdbbackup.sh and insert the following
lines

#!/bin/sh
# Example script for starting a full SAP HANA database backup

# Create a unique backup prefix using the current timestamp


PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname
-s`"
echo "Backup Prefix is: $PREFIX"

# Start backup via hdbsql query


echo "Starting backup via hdbsql..."

/usr/sap/<SID>/HDB<InstanceNumber>/exe/hdbsql -i 0 -n localhost -u
SYSTEM -p <password> "BACKUP DATA USING BACKINT ('$PREFIX')"
# -i <instanceNumber>, -n <node>, -u <dbuser>
# Multi Tenancy only: -d <database> has to be added and the SQL
command is "BACKUP DATA FOR <tenant_db_name> USING BACKINT
('$PREFIX')"
# Different possible backup levels are DIFFERENTIAL and
INCREMENTAL. --> example: "BACKUP DATA DIFFERENTIAL [FOR
<tenant_db_name>] USING BACKINT ('$PREFIX'_DIFF)"

# Collect exit code of hdbsql and pass it as exit code of this


backup script
EXIT_CODE=$?
exit $EXIT_CODE

The only line which has to be modified is


/usr/sap/<SID>/HDB<InstanceNumber>/exe/hdbsql -i 0 -n localhost -u
SYSTEM -p <password> "BACKUP DATA USING BACKINT ('$PREFIX')"
 chmod 700 hdbbackup.sh
 cp hdbbackup.sh /opt/sesam/bin/sesam

You might also like