0% found this document useful (0 votes)
343 views4 pages

Hadr Setup Step by Step

The document provides step-by-step instructions for setting up High Availability Data Replication (HADR) between two DB2 databases on Windows. The steps include: 1) creating a sample database, 2) enabling log archiving, 3) taking an offline backup, 4) configuring HADR parameters on the primary database, 5) taking another offline backup for the standby, 6) restoring the backup on the standby, 7) configuring HADR on the standby, 8) starting HADR on the primary and standby, and 9) verifying the HADR configuration. It also provides instructions for switching the primary and standby roles between the databases.

Uploaded by

Balu Anisetti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
343 views4 pages

Hadr Setup Step by Step

The document provides step-by-step instructions for setting up High Availability Data Replication (HADR) between two DB2 databases on Windows. The steps include: 1) creating a sample database, 2) enabling log archiving, 3) taking an offline backup, 4) configuring HADR parameters on the primary database, 5) taking another offline backup for the standby, 6) restoring the backup on the standby, 7) configuring HADR on the standby, 8) starting HADR on the primary and standby, and 9) verifying the HADR configuration. It also provides instructions for switching the primary and standby roles between the databases.

Uploaded by

Balu Anisetti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

9/29/2016

IBMStepbyStepProceduretosetupHADRreplicationbetweenDB2databasesUnitedStates

IBM Support

My support

Downloads
Training

Documents

Tickets

Communities

Other

IBM Support
system x3200|

Step by Step Procedure to set up HADR replication between DB2


databases

Be the rst to ask a question Chat with our new IBM Support Agent Tool (Beta)
Technote (FAQ)
Question
You plan to setup High Availability Data Replication between two DB2 databases and need step
by step instructions

These instructions allow you to setup HADR for DB2 on a Windows environment. However the
same commands can be used for Linux and UNIX by simply changing the "D:\" to a valid path.

In

ON THE PRIMARY:

Answer

1.Createsampledbusingthedb2samplcommand.
http://www01.ibm.com/support/docview.wss?uid=swg21410648

mail

1/4

9/29/2016

IBMStepbyStepProceduretosetupHADRreplicationbetweenDB2databasesUnitedStates

db2sampl
2.Enableitforlogarchiving.
db2updatedbcfgfor<DBNAME>usingLOGARCHMETH1LOGRETAIN

Abovecommandwillenabletodatabaseforlogarchivingandkeepthelogs
inthesameactivelogdirectory.Thiswillalsoplacethedbinbackup
pendingstate.
3.Takeanofflinebackup.
db2"backupdatabase<DBNAME>"
NOTE:AnofflinebackupisNOTmandatory.Anonlinebackupalsocanbe
used.ButonlinebackupscantakelongertobringtheHADRpairintopeer
state.Forsakeofsimplicity,weareusingofflinebackuphere.
4.SettingupHADRcfgparametersonPrimarydatabase.
Chat, contact and feedback
db2 update db cfg for <DBNAME> using HADR_LOCAL_HOST <IP ADDRESS OF PRIM>
db2 update db cfg for Need
<DBNAME>
using HADR_LOCAL_SVC <PORT # on PRIM>
support?

db2 update db cfg for <DBNAME> using HADR_REMOTE_HOST <IP ADDRESS OF


Chat with our new IBM Support Agent Tool
STNDBY>
(Beta)
db2 update db cfg for <DBNAME> using HADR_REMOTE_SVC <PORT # on STNDBY>

db2 update db cfg for <DBNAME> using LOGINDEXBUILD ON


1-800-IBM-7378 (USA)
5.TakeanofflinebackuptobeusedforsettingHADR.
Directory of worldwide contacts

db2 update db cfg for <DBNAME>


using HADR_REMOTE_INST
<INSTNAME OF STNDBY>
Submit feedback
to IBM Support

ON THE STANDBY MACHINE:


In

Ensure both the servers are on the same db2level so that a mismatch situation does not occur.
Run "db2level" command on both the servers to check whether they are on the same DB2
db2"backupdatabase<DBNAME>"

Version and Fix Pack.

http://www01.ibm.com/support/docview.wss?uid=swg21410648

mail

2/4

9/29/2016

IBMStepbyStepProceduretosetupHADRreplicationbetweenDB2databasesUnitedStates

6.FTPthebackupimage(fromtheprimarymachine)totheSTANDBYMACHINE
7.db2"restoredatabaseDBNAME"
8.SettingupHADRcfgparametersonstandbydatabase.
db2 update db cfg for <DBNAME> using HADR_LOCAL_HOST <IP ADDRESS ON
STANDBY>
db2 update db cfg for <DBNAME> using HADR_LOCAL_SVC <PORT # ON STANDBY>
db2 update db cfg for <DBNAME> using HADR_REMOTE_HOST <IP ADDRESS ON PRIM>
db2 update db cfg for <DBNAME> using HADR_REMOTE_SVC <PORT # ON PRIM>
db2 update db cfg for <DBNAME> using HADR_REMOTE_INST <INSTNAME ON PRIM>

9.db2starthadrondatabase<DBNAME>asstandby

ON THE PRIMARY MACHINE:

Chat, contact and feedback

10.StartingupHADRontheprimaryserver
Need support?

Chat with our new IBM Support Agent Tool


db2starthadrondatabase<DBNAME>asprimary
(Beta)

==================================================================
Directory of worldwide contacts
VerifingHADRisupandrunning
Submit feedback to IBM Support
db2pddb<DBNAME>hadr
1-800-IBM-7378 (USA)

Here'sthestepsonswitchingroles(PRIMARY/STANDBY)betweenthetwo

5.ONSTANDBY(CM11):db2takeoverhadrondatabase<dbname>byforce

In

6.TheSTANDBYinstanceonCM11(DB2)isnowtheprimary

mail

machine(CM01andCM11).
1.ONPRIMARY(CM01):db2connectto<dbname>
2.ONPRIMARY(CM01):db2"createtabletab1(col1int)"
3.ONPRIMARY(CM01):db2"insertintotab1values(1)"insert20rows
4.ONPRIMARY(CM01):powerdownthePrimary>db2stopforce

7.ONCM11:db2pddb<dbname>hadr(theROLEshouldstate:PRIMARY)
http://www01.ibm.com/support/docview.wss?uid=swg21410648

3/4

9/29/2016

IBMStepbyStepProceduretosetupHADRreplicationbetweenDB2databasesUnitedStates

8.ONCM11:db2connectto<dbname>
9.ONCM11:db2"select*fromtab1"Youshouldseethe20rowsinserted
10.ONCM11:db2"createtabletab2(col1int)"
11.ONCM11db2"insertintotab2values(1)"insertabout20rows
12.ONCM01:db2starthadrondatabase<dbname>asstandby
13.ONCM01:db2pddb<dbname>hadr(theROLEshouldstate:STANDBY)
14.onCM01:db2takeoverhadrondatabase<dbname>
15.onCM01:db2pddb<dbname>hadr(theROLEshouldstate:PRIMARY)
16.ONCM01:db2"select*fromtab2"youshouldbeabletoseethe20
rowsinserted
17.onCM11:db2pddb<dbname>hadr(theROLEshouldstate;STANDBY)
Note:
1.HostnameoftheHADRpaircannotbethesameonboththeservers.
2.TheinstancenameandtheunderlyinguseridonUNIXsystemscanbe
different.Makesuretoupdatethecorrectnameoftheinstanceforthedb
cfgparameterHADR_REMOTE_INSTtothecorrectvalue.

Related information

Chat, contact and feedback

Link to HADR setup video which includes the screen shot

Need support?

Chat with our new IBM Support Agent Tool


(Beta)

Community questions
andfeedback
discussion
to IBM Support
Submit

site do not represent the views or opinions of IBM. IBM, in its sole discretion, reserves the right to
Directory of worldwide contacts
remove any comments from this site. IBM is not responsible for, and does not validate or conrm,

1-800-IBM-7378
(USA)
By adding a comment, you accept
our Terms of Use.
Your comments entered on this IBM Support

the correctness or accuracy of any comments you post. IBM does not endorse any of your
comments. All IBM comments are provided "AS IS" and are not warranted by IBM in any way.
Be the rst to ask a question about this topic.

Ask a question

In

Select Lan
mail

http://www01.ibm.com/support/docview.wss?uid=swg21410648

4/4

You might also like