Backup of enterprise applications (Microsoft stack, IBM Db2, MongoDB, Oracle, PostgreSQL, SAP)
Post Reply
janschulenburg
Influencer
Posts: 10
Liked: 3 times
Joined: Nov 21, 2019 8:04 am
Full Name: Jan Schulenburg
Contact:

SAP HANA pre-freeze and post-thaw scripts

Post by janschulenburg »

Hi,

First of all; I'm a noob on SAP HANA and barely can create backups and restores.. I'm running SAP HANA on virtual SLES 15 for SAP Applications VM's and I'm possible to use the Veeam SAP HANA Backint plugin to create backups and do restores. But wouldn't it be possible to use just Veeam Backup & Replication to backup the VM itself in a consistent state using these scripts: https://www.veeam.com/blog/optimize-bac ... ckint.html.

I've tried to implement them on Veeam B&R server using the root account for the SLES server but that doesn't seem to work.

Does anybody have this working and can assist me in getting this working?
Egor Yakovlev
Product Manager
Posts: 2578
Liked: 707 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by Egor Yakovlev »

Hi Jan,
Local team will contact you soon to assist!
/Cheers!
janschulenburg
Influencer
Posts: 10
Liked: 3 times
Joined: Nov 21, 2019 8:04 am
Full Name: Jan Schulenburg
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by janschulenburg »

As addition to this post I've got a question who is maintaining the pre-freeze and post-thaw scripts? The scripts do work fine but what I see is that snapshots for the systemdb are removed (triggered by the ) but snapshots for the production data aren't?
StefanZ
Veteran
Posts: 370
Liked: 99 times
Joined: Mar 04, 2019 10:31 am
Full Name: Stefan Zimmermann
Location: Germany
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by StefanZ »

Hi Jan,

yes, you can use the pre- and post-scripts from Github to have a consistent VM backup. However with a snapshot backup you get not database validation which you get when running backint. For productive environments we recommend to combine these functionalities.

As you've not mentioned what kind of error you encounter on SLES15 maybe check the following two things because I've seen these before:

- Is the script properly executed? As it's copied from the VBR server we've seen issues with end of line (eol) conversions between Linux and Windows formats. If you have \r\n line endings in the file it won't be interpreted correctly and you will get an error like "cannot execute /bin/bash^M" or so. Make sure to have Linux style line endings in the .sh file.

- root is good to start the script (though not necessary), but we need a database user to take the DB snapshot - that will be likely the <SID>adm user - you can specify this user in the script/hana.conf or in the hdbuserstore.

The scripts are provided examples and community supported. If you think you can make improvements to them feel free to create a pull request with your changes. Of course we try to provide working examples, but we don't claim to fulfill every need with these scripts.
Kind regards, Stefan
johannesk
Expert
Posts: 159
Liked: 37 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by johannesk »

Hi,

We upgraded our SAP HANA few days ago. After the upgrade the hana-pre-freeze.sh does not detect the HANA instance and thus the freeze operation is not done on the database.
Note that the Veeam Image backup that has the hana-pre-freeze.sh configured as pre-script, will not Error on the task 'Running pre-freeze script in the guest OS'
thus the Veeam backup job won't alarm this.

We detected this issue with the checkmk check for SAP HANA
https://checkmk.com/integrations/sap_hana_backup
It alerts the backup is not up to date.
'SAP HANA Backup HBT 00 SYSTEMDB - data snapshot'

I post this both, to warn other users so they can be aware of this. Also I would like to know if @StefanZ is working on updating the script?
https://github.com/VeeamHub/application ... s/sap-hana
I see this has been registered as an issue on the giphub page and there is a linke to a SAP note that relates to the issue
https://me.sap.com/notes/3139184

Regards,
Jóhannes
PetrM
Veeam Software
Posts: 3625
Liked: 608 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by PetrM »

Hi Johannes,

Please keep in mind that these scripts are shared by Veeam enthusiasts and are not included in the official quality control process, thus we cannot guarantee stable functioning of these scripts in every specific environment: it's up to the end user to modify scripts accordingly. Currently, nobody works with this script but we will discuss it internally and maybe would be able to find someone.

Thanks!
johannesk
Expert
Posts: 159
Liked: 37 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by johannesk » 1 person likes this post

Sure Petr, I realize that the script is outside of Veeam development.
We have adapted the script by hardcoding the SAP instance name to the script, and thus have a script for each SAP instance. That was the easy way to adapt. The cool way would be to fix the dynamic functionality that had been working until now.
janschulenburg
Influencer
Posts: 10
Liked: 3 times
Joined: Nov 21, 2019 8:04 am
Full Name: Jan Schulenburg
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by janschulenburg » 1 person likes this post

I've been using the pre-freeze and post-thaw scripts for more than 2 years now with full satisfaction. I do have the SAP names coded in the scripts which was easier. SureBackup tests run succesfull every month.
StefanZ
Veteran
Posts: 370
Liked: 99 times
Joined: Mar 04, 2019 10:31 am
Full Name: Stefan Zimmermann
Location: Germany
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by StefanZ » 1 person likes this post

Hi Johannes, I am not with Veeam anymore, so I won't update the script (as I do not need it for my work). But Petr has the request already covered, so you'll be fine.
Great to see that the script is working well for years.
Kind regards, Stefan
rfa
Lurker
Posts: 2
Liked: never
Joined: Jun 13, 2024 11:57 am
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by rfa »

Hi guys
May you tell me where and how you hard coded the instance name in the script?
--> "We have adapted the script by hardcoding the SAP instance name to the script"

Many thanks for your help!

Best regards
Reto
PetrM
Veeam Software
Posts: 3625
Liked: 608 times
Joined: Aug 28, 2013 8:23 am
Full Name: Petr Makarov
Location: Prague, Czech Republic
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by PetrM »

Hello and Welcome to Veeam R&D Forums!

My assumption is that the part with the dynamic discovery was removed (read_sapservices function) and the array with the instance names was filled manually. But I didn't test it so it would be awesome if @johannesk could clarify how he had managed to modify the script.

Thanks!
johannesk
Expert
Posts: 159
Liked: 37 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by johannesk » 1 person likes this post

@petrm and @rfa

After the SAP upgrade the instance name changed from HDB to SMDA98. That has something to do with the upgrade process. Probably the SAP specialist could have kept the instance name, but I'm not sure. Anyway, we had to change this line.

was
expression="/usr/sap/[[:alnum:]]{3}/HDB.*sapstartsrv *${subexp} *${subexp} *${subexp}"

and now
expression="/usr/sap/[[:alnum:]]{3}/SMDA98.*sapstartsrv *${subexp} *${subexp} *${subexp}"

then this part.

Was
# Initialize variables and arrays
hdbpath=()
hdbpf=()

now
hdbpath=/usr/sap/HBP/HDB00/exe/
hdbpf=/usr/sap/HBP/SYS/profile/HBP_HDB00_HostnameOfServerHere

This works for us.

Hope it helps.

Regards,
Jóhannes
rfa
Lurker
Posts: 2
Liked: never
Joined: Jun 13, 2024 11:57 am
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by rfa »

Hi Johannes

Many thanks for your input. We have tried to adapt the expressions but we get now the error "command not found" after the script has executed the command "snapid=$(LD_LIBRARY_PATH=${hdbpath[$i]} ${hdbsqlcmd[$i]} "${statussql}")".
We are running on HANA version 2.00.073.

May you also explain what the following two lines do as we do not understand the ":alnum:" part:
subexp="(pf\=.*|-u *[[:alnum:]]{6}|-D)"
expression="/usr/sap/[[:alnum:]]{3}/SMDA95.*sapstartsrv *${subexp} *${subexp} *${subexp}"

Best
rfa
johannesk
Expert
Posts: 159
Liked: 37 times
Joined: Jan 19, 2016 1:28 pm
Full Name: Jóhannes Karl Karlsson
Contact:

Re: SAP HANA pre-freeze and post-thaw scripts

Post by johannesk » 1 person likes this post

Hi @rfa

I'm sorry, there is a bit more that is different in our custom script that I forgot to mention, the loop that starts in line 239 needs to be disabled. So in total it's like this.

line 148
was
expression="/usr/sap/[[:alnum:]]{3}/HDB.*sapstartsrv *${subexp} *${subexp} *${subexp}"

and now
expression="/usr/sap/[[:alnum:]]{3}/SMDA98.*sapstartsrv *${subexp} *${subexp} *${subexp}"

then this part that starts in line 229
Was
# Initialize variables and arrays
hdbpath=()
hdbpf=()

now
hdbpath=/usr/sap/HBP/HDB00/exe/
hdbpf=/usr/sap/HBP/SYS/profile/HBP_HDB00_HostnameOfServerHere

and the loop that starts in line 238
was
# Loop through every instance found in SAP services
for line in "${sapservices[@]}"
do
[[ $line =~ $sapservices_regex ]]
hdbpath[$i]="${BASH_REMATCH[1]}"
hdbpf[$i]="${BASH_REMATCH[2]}"
hdbpflines=`cat ${hdbpf[$i]} | grep "SAPSYSTEM"`
for hdbpfline in "${hdbpflines}"
do
[[ $hdbpfline =~ $hdbinst_regex ]] && hdbinst[$i]="${BASH_REMATCH[1]}"
done

and now
# Loop through every instance found in SAP services
#for line in "${sapservices[@]}"
#do
# [[ $line =~ $sapservices_regex ]]
# hdbpath[$i]="${BASH_REMATCH[1]}"
# hdbpf[$i]="${BASH_REMATCH[2]}"
hdbpflines=`cat ${hdbpf[$i]} | grep "SAPSYSTEM"`
for hdbpfline in "${hdbpflines}"
do
[[ $hdbpfline =~ $hdbinst_regex ]] && hdbinst[$i]="${BASH_REMATCH[1]}"
done

and finally in line 275, we disable the done

was
((i++))
done

and now
((i++))
#done
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests