DB2 Backup & Restore - Can this be done without a downside?

Enyinnaya used Ask the Experts™
Hi all,

Question: I have a HADR setup - Primary and Standby. Backup is always done on the primary database. However, because of a weid timing scenario that we have, we are wondering if there is a downside to taking a backup of the HADR STANDBY database and use this backup to restore to the primary if we run into a problem upgrading the PRIMARY?

Stated another way, we do not have time to do a backup on the primary when a upgrade project begins. At the very time we begin the upgrade, HADR is deactivated and the primary is immediately available for upgrade with no backup take. However, while the upgrade is going on the primary, we want to take a backup of the secondary (STANDBY) and potentially use this STANBY backup to restore the PRIMARY if something awry during upgrade.

Is there any downside to this plan?

Your thoughts, comments and experience in this matter will be highly appreciated.

Thanks everyone
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
One thing I can advise is that once your databases are offline, you ensure that your standby is fully synchronized before touching the primary, then disable high availability, then, once the two are completely disconnected / separated / far away from each other, go ahead and perform both the backup of standby and the upgrade of primary.

In the event of a crash, I would wait for the backup of standby to complete, then proceed as if primary had crashed in any other circumstance by failing over to secondary and rebuilding primary from it (as opposed to its backup).



Thank you for your response...your thought mirrored mine but I asked the question because IBM semm to strongly recommend against it and I couldn't understand why not? But you know, in many circle, what IBM says is the bible and you get jittery nerves and outright opposition to a simple change to the way things are done.

Ok, let me ask this: where does the archive logs and active logs come in to play if there is a need for rollforward?


Oh, I forgot this:

When you say "...you ensure that your standby is fully synchronized before touching the primary,"

you mean both Primary and Standby are in PEER State?
For starters, you cannot do a backup in the traditional sense on standby. You can deactivate the standby database and may be take a flash copy.

For your circumstance , I would recommend this

a) Before you start the upgrade, make sure your primary and standby are in Peer. Deactivate primary first and then deactivate standby [ precede standby deactivation with db2pdcfg -flushbp ] . Make a note of the standby and primary log positions [ db2pd -hadr]  Now you have a "backup"

b) Bring your primary up , do the upgrade and test it .. If you want to rollback your upgrade, then shut down primary, start the standby, Make sure your log position on the standby is same as before you shut down. If it is, do a takeover by force and point your apps to the standby. Then resetup HADR as you would normally do by taking a backup and restoring and syncing ..  
If all goes well, then just fire up standby and allow it to sync.

if you intend to use this approach, i can provide you more tips ...





Yes, please go ahead and provide more tips that would be helpful...things like "gothchas", and any other performance (time saving) tips that you may have.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial