欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

筹建db2 hadr

更新时间: 2014-01-05 02:05:55 责任编辑: Author_N1

 

搭建DB2 HADR
两台数据库服务器
主A:96.0.43.61
备B:96.0.43.62

实例用户/密码::

准备环境
1、在A中创建样本数据库sampl
db2sampl


2、修改A日志方式为归档日志,并作备份
db2 get db cfg for sample | grep -i log
mkdir -p sample/redo
mkdir -p sample/archive
db2 update db cfg for sample using NEWLOGPATH /home/db2inst2/sample/redo
db2 update db cfg for sample using LOGARCHMETH1 /home/db2inst2/sample/archive
db2stop
db2start
db2 backup db sample online to "/nfs_backup/db2_fulbak/" with 3 buffers buffer 2000 parallelism 2 include logs


3、在B中恢复备份
db2 list db directory
db2 restore db sample from "/nfs_backup/db2_fulbak/"
db2 rollforward db sample to end of logs


4、配置hadr参数
--在Primary端:
db2 update db cfg for sample using HADR_LOCAL_HOST 96.0.43.61  
db2 update db cfg for sample using HADR_LOCAL_SVC 70002 
db2 update db cfg for sample using HADR_REMOTE_HOST 96.0.43.62
db2 update db cfg for sample using HADR_REMOTE_SVC 70012  
db2 update db cfg for sample using HADR_REMOTE_INST db2inst2 
db2 update db cfg for sample using HADR_SYNCMODE SYNC  
db2 update db cfg for sample using HADR_TIMEOUT 3  
db2 update db cfg for sample using HADR_PEER_WINDOW 120
db2 connect to sample
db2 quiesce database immediate force connections  
db2 unquiesce database 
db2 connect reset

--在Standby端:
db2 update db cfg for sample using HADR_LOCAL_HOST 96.0.43.62
db2 update db cfg for sample using HADR_LOCAL_SVC 70012
db2 update db cfg for sample using HADR_REMOTE_HOST 96.0.43.61
db2 update db cfg for sample using HADR_REMOTE_SVC 70002
db2 update db cfg for sample using HADR_REMOTE_INST db2inst2
db2 update db cfg for sample using HADR_SYNCMODE SYNC  
db2 update db cfg for sample using HADR_TIMEOUT 3  
db2 update db cfg for sample using HADR_PEER_WINDOW 120 


5、开启hadr集群
--在Primary端
db2 deactivate db sample
db2 start hadr on db sample as standby


--在Standby端
db2 deactivate db sample
db2 start hadr on db sample as primary

6、检查命令
db2 get db cfg for sample | grep -i hadr
db2pd -d sample -hadr


7、接管/故障转移
db2 takeover hadr on db sample
db2 takeover hadr on db sample by force


8、停止hadr
--Standby
db2 deactivate db sample
db2 stop hadr on db sample


--Primary
db2 deactivate db sample
db2 stop hadr on db sample
上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 02:05:55
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/5612/
本文WWW.DOC100.NET DOC100.NET版权所有。