Thursday, April 26, 2012

Simple Steps to setup DB2 LUW HADR

I am a newbie, how to setup HADR ?

Official document --> Here
(OR) Cheat sheet example (quick guide) -- For release DB2 v9.7 and previous.. 

Please follow the step numbers:
Setting up Primary

Step (1)
create db $DbName;
update db cfg for $DbName using
HADR_LOCAL_HOST  $Host1
HADR_REMOTE_HOST $Host2
HADR_LOCAL_SVC $Service1
HADR_REMOTE_SVC $Service2
HADR_REMOTE_INST $Instance2
HADR_TIMEOUT 120
HADR_SYNCMODE ASYNC
LOGRETAIN ON;

Step (2)

 
backup db hadr_db to $Path;

Step (6)
start hadr on database $DbName as primary;

**************************************

Setting up Standby

Step (3)
restore db hadr_db from $Path;
Step (4)
update db cfg for $DbName using
HADR_LOCAL_HOST $Host2
HADR_REMOTE_HOST $Host1
HADR_LOCAL_SVC $Service2
HADR_REMOTE_SVC $Service1
HADR_REMOTE_INST $Instance1
HADR_TIMEOUT 120
HADR_SYNCMODE ASYNC
LOGRETAIN ON;

Step (5)
start hadr on database $DbName as standby;

**************************************

Example:

Setting up Primary

Step (1)
create db hadr_db;
update db cfg for hadr_db using
HADR_LOCAL_HOST HADRHost2
HADR_REMOTE_HOST HADRHost1
HADR_LOCAL_SVC xkkchinta
HADR_REMOTE_SVC xkkchinta
HADR_REMOTE_INST kkchinta
HADR_TIMEOUT 120
HADR_SYNCMODE ASYNC
LOGRETAIN ON;

Step (2)
backup db hadr_db to /u/kkchinta/backup_dir;

Step (6)
start hadr on database hadr_db as primary;

***********************************

Setting up Standby

Step (3)
restore db hadr_db from /u/kkchinta/backup_dir/ ;

Step (4)
update db cfg for hadr_db using
HADR_LOCAL_HOST HADRHost1
HADR_REMOTE_HOST HADRHost2
HADR_LOCAL_SVC xkkchinta
HADR_REMOTE_SVC xkkchinta
HADR_REMOTE_INST kkchinta
HADR_TIMEOUT 120
HADR_SYNCMODE ASYNC
LOGRETAIN ON;

Step (5)
start hadr on database hadr_db as standby;

******************************************

No comments: