SAP HANA backup with Veeam: snapshot and Backint plug-in
Install and configure SAP HANA backup on Linux with Veeam: pre-freeze/post-thaw scripts, SAP HANA plug-in, retention and Ansible update.
This article describes how to back up an SAP HANA database on Linux with Veeam Backup & Replication: VM snapshot backup (pre-freeze / post-thaw scripts) and the Veeam Plug-in for SAP HANA (Backint). Official references: Configure the SAP HANA plug-in and SAP HANA plug-in garbage collector.
Prerequisites
- The Veeam server (
veeamserver01) holds thehana-pre-freeze.shandhana-post-thaw.shscripts in a folder reachable by the jobs (for exampleC:\tools\Database\Scripts\). - A dedicated Linux account (
veeam_svc) is declared in Veeam to access the HANA machine. - A plug-in account (
hana_veeam) has access to the relevant backup repositories, with matching permissions in Veeam. - The plug-in RPM package (
VeeamPluginforSAPHANA-<version>.x86_64.rpm) is available. - For snapshot backup, the virtual machine must be in the vSphere folder or tag set aside for the HANA jobs.
Snapshot backup: preparing the HANA server
- Create the user Veeam will use, with a fixed uid and the SAP groups:
sudo useradd veeam_svc -g sapsys -G sapsys,hhdshm -u 8502
sudo passwd veeam_svc
The hhdshm group is your HANA SID's group (<sid>shm); adapt the name.
- Put the SSH public key in the user's authorized keys:
sudo su - veeam_svc
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
chmod 700 ~/.ssh
# copy the authorized public key, for example from another host
scp adminhost:~/.ssh/authorized_keys ~/.ssh/
- Allow the user in sudoers:
sudo visudo -f /etc/sudoers.d/veeam_svc
veeam_svc ALL=(ALL) NOPASSWD:ALL
- Create the configuration file read by the pre-freeze / post-thaw scripts:
sudo mkdir -p /etc/veeam
sudo vim /etc/veeam/hana.conf
# Config file for HANA pre-freeze/post-thaw scripts
# To use standard username/password, set values here
username="SYSTEM"
password=<PASSWORD>
# To use key-based authentication, enter a key prefix here (default is HDB)
keyprefix="HDB"
# Log purge options
purgelogs="false"
purgedays="3"
sudo chmod 775 /etc/veeam
sudo chmod 664 /etc/veeam/hana.conf
- In Veeam, create the VM backup job with application-aware processing enabled, referencing the
hana-pre-freeze.shandhana-post-thaw.shscripts.
Installing the plug-in
- Copy the RPM to
/tmp(for example with WinSCP), then install it as root:
sudo rpm -i /tmp/VeeamPluginforSAPHANA-<version>.x86_64.rpm
- Identify the
<sid>admuser that owns the HANA processes:
ps -ef | grep hdb
The owner of the hdb... processes (for example hhdadm) is the relevant SAP user. It is referenced in the configuration and used for the post-installation steps.
- Run the plug-in configuration wizard:
sudo SapBackintConfigTool --wizard
The wizard asks for:
- the backup server name or address (for example
veeamserver01.example.com); - the backup server port (for example
10006); - the user name and its password;
- the backup repository to use.
At the end, the message SID <sid> has been configured should appear.
- Check the configuration file:
cat /opt/veeam/VeeamPluginforSAPHANA/veeam_config.xml
Example content, with the retention (backupExpiredTimeDays) and a repository free-space warning threshold (repositoryFreeSpacePercentWarning) added to PluginParameters:
<Config>
<CAVerificationParameters />
<AdditionalCertificatePaths />
<ProxyConfig />
<VBRConnectionParams vbrHostName="veeamserver01.example.com" vbrPort="10006" vbrUser="hana_veeam" vbrDomain="" vbrPassword="<PASSWORD>" />
<Certificate />
<BackupForRestoreParams />
<AgentParams />
<RepositoryParams>
<Repository repositoryName="Backup Repository" repositoryID="00000000-0000-0000-0000-000000000000" />
</RepositoryParams>
<PluginParameters backupExpiredTimeDays="365" repositoryFreeSpacePercentWarning="3" />
<ClusterParams isCluster="false" />
<SourceServerParams />
</Config>
For the Oracle RMAN plug-in, the same principle applies in /opt/veeam/VeeamPluginforOracleRMAN/veeam_config.xml.
Scheduled backup script
To drive the backup from a scheduler (for example a job scheduler):
- Copy the backup script (full / differential) to a dedicated directory, for example
/home/<user>/scripts/backupFullDiff_hana.sh. - Give the user access rights to the HANA database.
- Make the script executable:
chmod 775 /home/<user>/scripts/backupFullDiff_hana.sh. - Test it manually, then from the scheduler.
Check that the SAP service is running:
systemctl status sapinit
Post-installation
- Create the directories needed by
failbackint(local Backint fallback) under the HANA backup folder and give ownership to the<sid>admuser:
sudo chown <sid>adm:sapsys -R /hana/backup/
ls -altr /hana/backup/
- Enable forced deletion of expired backups (see the garbage collector link above):
./SapBackintConfigTool --set-force-delete
with a retention of 365 days in this example.
- Check that the database log mode is
normal. - Check that the SAP HANA backup catalog lists the Backint backups.
Deployment and update with Ansible
If you manage your servers with Ansible, the plug-in and its configuration file can be deployed or updated with dedicated playbooks:
ansible-playbook -i inventory/hana.yml playbooks/update_veeam_hana_plugin.yml
ansible-playbook -i inventory/hana.yml playbooks/update_hana_config.yml
Notes
- Never write a real password in an article or repository: keep secrets in a password manager.
- Host names, accounts, SIDs and paths above are generic examples.
- The Ansible playbook names are illustrative.