Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

SAP differential backup

Created: 12 Nov 2012 | 11 comments

Hi community,

yesterday I configured the backup of our Oracle based SAP servers (ERP6) using the SAP agent with backint (no RMAN).
I followed the instructions of the "NetBackup for SAP Administrator's Guide" and generally it is working, now.

I used the script "sap_online_backup" as a base and customized it to fit our environment.
Then I created a policy with the following schedules:
- Default-Application-Backup
- Differential-Inc
- Full

Unfortunately the schedule "Differential-Inc" (additional to the archive logs) always backs up the whole database.
Therefore every differential backup has a size of about 100 GB, though only a few MBs were changed since the last backup.

Is this a known problem?
Did I forget something during configuration or do I need to change anything within the backup script?

Thanks for your help,
Matt

Comments 11 CommentsJump to latest comment

Andy Welburn's picture

yesterday I configured the backup

>>>>> many subsequent backups? <<<<<

Therefore every differential backup has a size of about 100 GB, though only a few MBs were changed since the last backup.

Did you run a Full first?

mbodsch's picture

Of course, I ran a full backup first.
About two hours later I started a differential backup (about 90 MB archive logs were written during this time) and it backed up the whole database + archive logs.

Nicolai's picture

Application backup work different that file systems backup. It's the brbackup command used that decide what to backup and not the schedule used. So if both Diffrential-inc and Full point to the same script the outcome will be the same.

Netbackup will also kick off all schedules if the backup window is open - not like file system where only one schedule is run for a server.

If the script call sap_online_backup the brbackup command look like:

# Full online backup with dynamic BEGIN/END BACKUP switch
 
CMD_LINE="$SAP_ENV brbackup -c -d util_file_online -t online -m all"
 
And it look to me  like full backup every time it's called.

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

mbodsch's picture

The brbackup command in my script indeed looks very similar:
CMD_LINE="$SAP_ENV brbackup -u / -c -d util_file_online -t online -m all"

I only added the "-u /" switch because at first it used the wrong login credentials to the Oracle DB.

Later on in the script the following command is executed:
# save and delete archive logs
CMD_LINE="$SAP_ENV brarchive -u / -c -d util_file -sd > $br_out_file"

Therefore I thought, the script is able to make a difference between full and incremental schedules initiated from Netbackup.

Does this mean, I need an additional policy and script for incremental backups?

I only know application backups from our Oracle policies where full / incremental schedules are working flawless using only one backup script.

Nicolai's picture

The brarchive command is used to make the datbase backup consistent  (no need to backup the table spaces if you can't perform media recovery). 

Incremental backup is not supported with BRtools and backint. You need to use brtools with RMAN for level 1 backups. Had to checks the docs - my SAP is a little rusty blush

http://help.sap.com/saphelp_nwpi71/helpdata/en/47/...

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

mbodsch's picture

Thanks a lot, Nicolai!
I'm very sure, this is exactly my problem.

Unfortunately using RMAN I need to reconfigure the whole backup procedure on the SAP servers (backup script, oracle linking, initSAP.utl, initSAP,sap, ...).
But as long as this solves my problem, I'm very happy!

I don't know if I find the time today, but I'll definately post my results when finished.

Nicolai's picture

BRtools with RMAN is very complicated and the learning curve is almost vertical. Even the smalles misconfiguration and the backup/restore do not as intended. Better to switch to "pure" RMAN is possible.

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

mbodsch's picture

Okay, today I had the chance to reconfigure everything for BRTools + RMAN.
I'm aware that this is more complicated, but I decided to go this route for a better SAP integration.

Full backups initiated from the NetBackup console are already working.
But when starting an incremental backup from the NetBackup console, it just finishes after a few seconds with status 0 without writing any data.
If I start the following command on the csh console, an application backup shows up in the NetBackup console which indeed writes incremental data:
brbackup -u / -d rman_util -t online_cons -m incr -c

Within the backup script (sap_rman_backup) this command is executed within an if statement:
if [[ $SAP_FULL -eq 1 ]]; then
        CMD_LINE="$SAP_ENV brbackup -u / -d rman_util -t online_cons -m full -c"
elif [[ $SAP_CINC -eq 1 ]]; then
        CMD_LINE="$SAP_ENV brbackup -u / -d rman_util -t online_cons -m incr -c"
fi

So I assume the variable "$SAP_CINC" isn't properly set by NetBackup during an incremental backup.
Is there a way I can check which variables are set during a backup?

Another problem I have using BRTools + RMAN is the fact that the /oracle/SID/oraarch/ directory isn't beeing deleted during a backup.
Is it necessary to add a "brarchive" command within the script? In the example NetBackup script for RMAN this command isn't used.

Thanks,
Matt

mbodsch's picture

I found solutions for both problems...I hope it doesn't lead to new problems (for example during a restore).

The brbackup line from my previous post was only called when performing a "cumulative incremental" backup ($SAP_CINC).
The correct variable used by Netbackup for "differential incremental" backups is $SAP_INCR.
Therefore I added the following to the if condition:

elif [[ $SAP_INCR -eq 1 ]]; then
        CMD_LINE="$SAP_ENV brbackup -u / -d rman_util -t online_cons -m incr -c"
fi
I just copied the same command line which is used for cumulative incremental backups, so I assume it's not exactly what I need...at least the differential backup initiated from the Netbackup console is working.
How can I customize this command to only backup differential incremental data?

For backing up the archive logs (and therefore cleaning them up afterwards) I added the following at the end of my script:

CMD_LINE="$SAP_ENV brarchive -u / -d rman_util -c -sd"
echo "Execute $CMD_LINE"
su - oraimt -c "$CMD_LINE"

I copied this command from the sap_online_backup script and just changed the option "util_file" to "rman_util".
Is this a good way to handle archive logs or are there any drawbacks?

Thanks,
Matt

jim dalton's picture

As AndyW...incr will be full if theres never been a full. Its no different for flat file backups, it being SAP is not the issue I believe. Would be interested in knowing the outcome as I run lots of SAP in the same way, but always do fulls.

Jim

mbodsch's picture

Because I ran a full backup before, I'm very sure that I made a mistake at some point.
It's the first time I configured a SAP policy and I had many problems before it was even running the way it is at the moment.