How to backup SAP MaxDB with Veeam

This post focuses on how to backup SAP MaxDB databases with Veeam Backup & Replication. I came across a SAP MaxDB installation during my last projects and wanted to share with you how to backup these databases.

Introduction on pre-freeze and post-thaw scripts

Since there is no native integration of SAP MaxDB in Veeam, we need to use pre-freeze and post-thaw scripts within the guest processing options.

Pre-freeze and post-thaw scripts are being used, when an application does not support VSS for example. The pre-freeze script is used to quiesce the VM file system or the application prior Veeam triggers a VMware snapshot. After the VMware snapshot is created, the post-thaw script triggers and brings the VM and the corresponding application back to the initial state.

How do the scripts work ?

Pre-freeze and post-thaw scripts are used on backup jobs, replication jobs and VM copy jobs.

Furthermore, you need to create the scripts beforehand. When the specific job starts, Veeam uploads the script to the guest operating system of your VM and executes it with the credentials you specified in the “Guest OS credentials” section of the job settings. Keep that in mind, as Veeam copies the script to the “admin$” share over the network or by using VIX API to execute them from there (on Windows). So your account needs to have sufficient permissions.

For linux, the scripts are copied over SSH or the VIX API to “/home/<username>” of the credentials you specified in the “Guest OS credentials” section of the job settings.

In addition, make sure that your scripts return a “0” when they execute, because Veeam expects that as successful. Furthermore, the default time period for script executions is 10 minutes.

For Microsoft Windows, the folowing script file formats are supported: “EXE, BAT, CMD, WSF, JS, VBS, and PS1”

For Linux, Veeam supports only shell scripts in the “SH” file format.

In the picture below you can see where to add those scripts for guest processing operations.

backup MaxDB with Veeam

How to backup SAP MaxDB with pre-freeze and post-thaw scripts

To process the SAP MaxDB with a VMware Veeam job, we need to suspend the MaxDB logwriter, prior of a VM snapshot. To achieve this, we need to use the dbmcli of the MaxDB database to suspend the logwriter and afterwards resume it again. The scripts posted below use a code snippet of Ben Gripka to run a script in an elevated command line window. Thanks to Ben for this awesome script ! I had the case, that I was using a service account which didn’t have the proper permissions to run an administrative script from the “admin$” share.

Also, this post in the Veeam forums helped me aswell on achieving my goal to backup the SAP MaxDB databases. I need to add that the solution of disabling the UAC was not usable at the customer where we needed to backup the MaxDB. That’s why I was searching for another solution and used the snippet from Ben Gripka to achieve this !

The SAP MaxDB part of these scripts start at line 26 with the path to the “dbmcli”.

Here is the pre-freeze script to suspend the logwriter prior of the VMware snapshot to backup SAP MaxDB with Veeam.

After the VMware snapshot is successful, the post-thaw script resumes the logwriter again.

Make sure to provide the correct path to the “dbmcli” and name the correct MaxDB instance. As an example this could look like this:

Conclusion on how to backup SAP MaxDB

By using these scripts I was able to create image level backups of the SAP MaxDB. A restore test afterwards was successful as well.

You can find these scripts on my Github repository as well: Here is the link to the repository

Furthermore, I’d like to add the recommendation to test out the single “dbmcli” command at first. Simply use the one-liner to suspend the logwriter and a message like “OK” will return. Just make sure to check if the script is working before you waste time with waiting for backup jobs.

As always, thanks for reading, stay safe and have an awesome day !

About Falko Banaszak

Falko is a consultant based in Germany working for SVA GmbH. He has a strong focus on virtualization, data backup, disaster recovery infrastructures and a passion for Microsoft 365 & storage systems. He´s a VMware vExpert & Veeam user group leader in Germany. VCP-DCV, VMCE, VMCA.

Check Also

VeeamON 2020

VeeamON 2020 – Same experience but ONLINE !

VeeamON 2020 is moving online for free ! Due to the fact of the current …

Leave a Reply

Your email address will not be published. Required fields are marked *