cancel
Showing results for 
Search instead for 
Did you mean: 

Need urgent help on setting up different retention periods for full db2 online backups

jbdb
Level 3
Partner

I wish to backup a db2 database in 3 schedules with different retention periods

daily - 2 weeks

weekly - 2 months

monthly - infinite

 

I already have setup the three schedules with the "Automatic Full Backup" and the "Default-Application-Backup" with the "Application Backup" schedule type all in one policy. Have also configured the db2.conf file. However, the three backup schedules all have the same image retention periods when I browse them in the Images on media, all following the retention period for the "Default-Application-Backup" schedule.

 

How can I configure netbackup to set the correct retention periods on the images generated by each schedule. Any help on this will be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

3sth3r
Level 3
Ok, I ended up doing this.  After monitoring the /usr/openv/netbackup/logs/bpdb2 log with verbosity level set at 5.  it shows exactly where it reads the db2.conf file and what it gets, or doesn't get from it.

So

This is what my db2.conf file looks like now

DATABASE CD2
OBJECTTYPE DATABASE
POLICY nbutest-DB
ENDOPER

DATABASE CD2
OBJECTTYPE ARCHIVE
POLICY nbutest-DB
ENDOPER

Then, on the netbackup side I created ONE policy of type DB2
Inside this policy there are FOUR schedules as follows

1) Name: Default-Application-Backup-Weekly
    Type: Application Backup
    Retention Period: 4 weeks
    Volume Pool: DBWeekly
    Start Window: Sun 7:00 - Mon 7:00

2) Name: DBWeeklyFull
     Type: Automatic Full Backup
     Retention Period: 4 weeks
    Volume Pool: DBWeekly
    Start Window: Sun 7:00 - Mon 7:00

3) Name: Default-Application-Backup-Daily
    Type: Application Backup
     Retention Period: 2 weeks
     Volume Pool: DBDaily
     Start Window: Mon 7:00 - Tu 7:00 etc

2) Name: DBWeeklyFull
     Type: Automatic Full Backup
     Retention Period: 2 weeks
     Volume Pool: DBDaily
     Start Window: Mon 7:00 - Tu 7:00 etc


View solution in original post

18 REPLIES 18

Dion
Level 6
Certified

Aah!  You've just met one of NetBackup's little caveats.  When it comes to database backups and the "special" application backup schedule, the following applies...  the user schedule that you create is the schedule that triggers the "default-application-backup".  The "default-application-backup" is a kind of remoted execution application that will start a client process to do the database backup on the client.  It is this special schedule that starts the process to run the .bch file specified in the files tab.  When it comes to retentions, it's the "default-application-backup" schedule's retention that gets used.

 

Because of this, you will need to create a policy for each retention requirement and set the "default-application-backup"'s retention for each.  Strangely, Exchange also has on of these special "application" schedules, but you can specify all your different retentions in one policy as the application schedule's retention does not get used.

 

In my scenario, I have to run Fulls, Diffs and Tx Log database backups for Daily, Weekly and Monthly.  I also have up to 4 cluster groups with an SQL instance in each.  Based on the above, I can have 4 SQL policies per instance running different .bch files which translates to 20 SQL policies to cover all my database servers (this includes stand-alone SQL servers).

 

Luckily, I created a GUI utilility that adds/removes all clients to and from NetBackup and also generates all the required .bch files depending on what choices the operator chooses.

 

Cheers

 

 

jbdb
Level 3
Partner

Thanks Dion.

 

I've actually tried to create a new policy with a different retention period on the "Default-Application-Backup", however, it still uses the one that is specified on the db.conf (this is actually a unix environment, sorry didn't mention it). I tried to add another entry on the db.conf but it still follows the first entry with the following

DATABASE smd
OBJECTTYPE DATABASE
POLICY SVXAPMEL210-BACKUP-02
SCHEDULE Default-Application-Backup
ENDOPER

 

DATABASE smd
OBJECTTYPE DATABASE
POLICY SVXAPMEL210-BACKUP_D-02
SCHEDULE Default-Application-Backup
ENDOPER

 

Dion
Level 6
Certified

Sorry mate.

 

You did mention that it was a db2 database so I was aware.  Don't have any of these on my side so just presumed that it followed the same methodology as SQL.  Anyway, you can use the info if you have any SQL backups in the future.

 

Good luck

 

jbdb
Level 3
Partner
Anyways, thanks for the info Dion, also have some clients with SQL Backups so it would still be helpful.

3sth3r
Level 3
jbdb, were you able to find an answer to this?  I have the same situation, one database but the customer wants different retention periods for daily / weekly backups

scorpy_582
Level 6
Hi,

Try this to see if it works.

with your current settings, comment out the line for schedule in db.conf and make sure that the schedules do not have overlapping backup windows.

jbdb
Level 3
Partner

3sth3r, still no luck. will have to try scorpy_582's suggestion.

jbdb, were you able to find an answer to this?  I have the same situation, one database but the customer wants different retention periods for daily / weekly backups

jbdb
Level 3
Partner
Hi Scorpy_582,

tried your suggestion, but kept on defaulting to the schedule indicated in the "objectype archive" part. cannot remove the schedule part in the archive part of the db2.conf. If you have any other ideas on this, it will be highly appreciated.

FrSchind
Level 5
Partner
you could write a bpstart_notify script on the database host that changes the db.conf to use the policy with the right retention level.

3sth3r
Level 3
I'm going to try the following.  I understood from scorpio that the schedule stays, but the policy goes

iow,

the db2.conf looks like this

DATABASE SAMPLE
OBJECTTYPE DATABASE
SCHEDULE Default-Application-Backup
ENDOPER

# Vendor method for archive logs

DATABASE SAMPLE
OBJECTTYPE ARCHIVE
#POLICY DB 2-daily
SCHEDULE Default-Application-Backup
ENDOPER


In my netbackup policies I created 2 differenc policies with times that do not overlap:

policy: db2-daily
   schedule: full_daily, start window 20:00 - 7:00, monday - saturday
   schedule: Default-Application-Backup, start window 20:00 - 7:00, monday - saturday

policy: db2-daily
   schedule: full_weekly, start window 15:00 - 22:00, sunday
   schedule: Default-Application-Backup, start window 15:00 - 22:00, sunday


Will let you know how it goes, we're first trying to fix something else that's not working.

(It never rains when it can pour)

3sth3r
Level 3
jbdb, ok, bad idea not to have both a policy and a schedule name in the db2.conf file.  Even though the manual says you can get away with not putting either in.

I'm now going to try the following:

Still keeping my 2 policies with times that don't overlap, renaming the default application backup in each policy to make more sense to me;  the db2.conf file looks like this.  In

DATABASE DBTEST
OBJECTTYPE DATABASE
POLICY host1-DBTEST-DBdaily
SCHEDULE Default-Application-Backup-Daily
ENDOPER

DATABASE DBTEST
OBJECTTYPE DATABASE
POLICY host1-DBTEST-DBweekly
SCHEDULE Default-Application-Backup-Weekly
ENDOPER

DATABASE DBTEST
OBJECTTYPE ARCHIVE
POLICY host1-DBTEST-DBdaily
SCHEDULE Default-Application-Backup-Daily
ENDOPER


jbdb
Level 3
Partner
Hi 3sth3r,

tried the configuration you gave earlier and still no success. since the schedules do not overlap, when the schedule weekly is executed, it fails as it still tries to use the "Default-Application-Backup-Daily".

Since all of my backups are set to infinite to avoid the scenario that a backup is needed and already expired, i"m starting to lack tapes for it. Need the solution urgently.


3sth3r
Level 3
well, try the bpstart_notify script? and move/copy the db2.conf files

it just seems like there should be an easier way to do all of this

3sth3r
Level 3
Ok, I ended up doing this.  After monitoring the /usr/openv/netbackup/logs/bpdb2 log with verbosity level set at 5.  it shows exactly where it reads the db2.conf file and what it gets, or doesn't get from it.

So

This is what my db2.conf file looks like now

DATABASE CD2
OBJECTTYPE DATABASE
POLICY nbutest-DB
ENDOPER

DATABASE CD2
OBJECTTYPE ARCHIVE
POLICY nbutest-DB
ENDOPER

Then, on the netbackup side I created ONE policy of type DB2
Inside this policy there are FOUR schedules as follows

1) Name: Default-Application-Backup-Weekly
    Type: Application Backup
    Retention Period: 4 weeks
    Volume Pool: DBWeekly
    Start Window: Sun 7:00 - Mon 7:00

2) Name: DBWeeklyFull
     Type: Automatic Full Backup
     Retention Period: 4 weeks
    Volume Pool: DBWeekly
    Start Window: Sun 7:00 - Mon 7:00

3) Name: Default-Application-Backup-Daily
    Type: Application Backup
     Retention Period: 2 weeks
     Volume Pool: DBDaily
     Start Window: Mon 7:00 - Tu 7:00 etc

2) Name: DBWeeklyFull
     Type: Automatic Full Backup
     Retention Period: 2 weeks
     Volume Pool: DBDaily
     Start Window: Mon 7:00 - Tu 7:00 etc


jbdb
Level 3
Partner
Hi 3sth3r,

I'm going to give it a try. I'm assuming the last last schedule name in your reply is just a typo as it has the same name as no. 2.

Regards,
jbdb

3sth3r
Level 3
the last schedule name is DBDaily

jbdb
Level 3
Partner
Hi 3sth3r,

You're right, it worked. I now have 3 separate retention periods as following:
archive logs - 2 weeks - created in separate policy with schedule spanning the whole week. Need to separate the policy.
daily backups - 2 weeks - same as you, in one policy but does not overlap with weekly
weekly backups - 2 months - same policy with daily backups but with different time for Application Backup

Now the only question is for monthly backups? :D, the available schedule in the "Application Backup" does not specify days in the month. But more or less, I can live with the daily and weekly backups.

3sth3r
Level 3
Monthly backups usually require some carefull scheduling

For example, monthly backups run on the last sunday of the month

So, how about:

Create a schedule for months with a time window for sundays, but use frequency based calendar and select recurring weekdays (last sunday of the month) - make a notes of the dates

Then, the week/day schedule (whichever overlap) go to exclude dates and select the dates selected for the monthly backups

Redo every year :)
Or if you have lots of time, do it until the end of time