DB2 V8.2 HADR For AIX5.3 db2set DB2_HASH_JOIN=Y db2set DB2_RR_TO_RS=YES db2set DB2COMM=tcpip db2set DB2_PARALLEL_IO=* db2 update dbm cfg using svcename db2c_db2inst1 db2sampl db2 update db cfg for sample using logretain on db2 update db cfg for sample using trackmod on db2 update db cfg for sample using logindexbuild on db2 update db cfg for sample using indexrec restart db2 backup database sample db2 restore database sample taken at 20060119154140 replace history file without prompting 配置自动客户端重新路由 在主服务器上运行 db2 update alternate server for database sample using hostname 10.1.1.22 port 30000 在从服务器上运行 db2 update alternate server for database sample using hostname 10.1.1.21 port 30000 两台机器都修改 vi /etc/services db2c_db2inst1 30000/tcp DB2_HADR_1 35001/tcp DB2_HADR_2 35002/tcp 修改主服务器参数: db2 update db cfg for sample using HADR_LOCAL_HOST 10.1.1.21 db2 update db cfg for sample using HADR_LOCAL_SVC DB2_HADR_1 db2 update db cfg for sample using HADR_REMOTE_HOST 10.1.1.22 db2 update db cfg for sample using HADR_REMOTE_SVC DB2_HADR_2 db2 update db cfg for sample using HADR_REMOTE_INST db2inst1 db2 update db cfg for sample using HADR_SYNCMODE NEARSYNC db2 update db cfg for sample using HADR_TIMEOUT 120 db2 connect to sample db2 quiesce database immediate force connections db2 unquiesce database db2 connect reset 修改从服务器参数: db2 update db cfg for sample using HADR_LOCAL_HOST 10.1.1.22 db2 update db cfg for sample using HADR_LOCAL_SVC DB2_HADR_2 db2 update db cfg for sample using HADR_REMOTE_HOST 10.1.1.21 db2 update db cfg for sample using HADR_REMOTE_SVC DB2_HADR_1 db2 update db cfg for sample using HADR_REMOTE_INST db2inst1 db2 update db cfg for sample using HADR_SYNCMODE NEARSYNC db2 update db cfg for sample using HADR_TIMEOUT 120 启动从HADR db2 deactivate database sample db2 start hadr on database sample as standby 启动主HADR db2 deactivate database sample db2 start hadr on database sample as primary 测试主服务器 db2 connect to sample db2 "create table tab1(col1 int,col2 int)" db2 "insert into tab1 values(1,1)" db2 "insert into tab1 values(1,1)" db2 "insert into tab1 values(1,1)" db2 terminate 在备用服务器上接管主服务器(以前的主将切换成从) db2 takeover hadr on database sample user db2inst1 using lsc123 db2 connect to sample db2 "select * from tab1" db2pd -hadr -db sample |
|