Today we will share with you the specific implementation steps of DB2 HADRv8.2 EE. If you have a desire to understand the specific implementation steps of DB2 HADRv8.2 EE, you can use the following articles to better understand the actual operation steps.
1. The database version must be consistent. In this example, run db2licm-l to check whether the hadr feature is supported. 3. Two servers: serverA 10.10.20.16 255.255.255.0 serverB 10.20.110 255.255.255.0.
1. The database versions must be consistent. In this example, 8.2ese
2. Run db2licm-l to check whether the hadr feature is supported.
3. Two servers: serverA 10.10.20.16 255.255.255.0 serverB 10.20.110 255.255.255.255.0
4. Both machines use the default instance DB2, and the service port number is 50000.
5. Since the Registry parameter db2comm = TCPIP is the default value after installation, it is not configured below. If not,
You must use the command db2set db2comm = TCPIP to set
6. Disable the firewall or open the port */
Run set db2instance = DB2 db2set db2comm = TCPIP on serverA. The default value is
Db2 terminate db2stop db2start
Create a database db2sampl
Modify database Parameters
- 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
Backup database db2 backup db sample to f: \ test
On serverB: set db2instance = DB2
The following command causes the database to be In the rollback and suspension status,
- db2 restore db sample from f:\test replace history file
- db2 update db cfg for sample using HADR_LOCAL_HOST 10.10.20.110
- db2 update db cfg for sample using HADR_LOCAL_SVC 44444
- db2 update db cfg for sample using HADR_REMOTE_HOST 10.10.20.16
- db2 update db cfg for sample using HADR_REMOTE_SVC 33333
- db2 update db cfg for sample using HADR_REMOTE_INST DB2
- db2 update db cfg for sample using HADR_SYNCMODE nearsync
-
Configure sample Database parameters on serverA
- set db2instance=DB2 db2 update db cfg for sample using HADR_LOCAL_HOST 10.10.20.16
- db2 update db cfg for sample using HADR_LOCAL_SVC 33333
- db2 update db cfg for sample using HADR_REMOTE_HOST 10.10.20.110
- db2 update db cfg for sample using HADR_REMOTE_SVC 44444
- db2 update db cfg for sample using HADR_REMOTE_INST DB2
- db2 update db cfg for sample using HADR_SYNCMODE nearsync
In the implementation step of DB2 HADRv8.2 EE, the sample database should be started in standby mode on server B.
- set db2instance=DB2 db2 deactivate database sample
- db2 start hadr on database sample as standby
Start the sample database in primary mode on serverA
- set db2instance=DB2 db2 start hadr on database sample as primary
View the hadr status of the sample database on serverA
- set db2instance=DB2 db2pd -d sample -hadr
View the hadr status of the sample database on server B
- set db2instance=DB2 db2pd -d sample -hadr
Test:
On serverA
- set db2instance=DB2
- db2 connect to sample
- db2 create table test(id integer)
- db2 insert into test(1)
- db2 insert into test(2)
- db2 commit
- db2 select * from sample
Set db2instance = DB2 on server B to take over hadr. If you cannot establish a connection with the DB2 instance on serverA,
For example, if the serverA server or DB2 instance is disabled, the by force option must be used as follows:
- db2 takeover hadr on database sample user db2admin using db2admin by force
Normal takeover
- db2 takeover hadr on database sample user db2admin using db2admin
Db2 connect to sample db2 select * from test shows that the data on serverA is applied to serverB.
View hadr status
- db2pd -d sample -hadr
The above content is an introduction to the implementation steps of DB2 HADRv8.2 EE. I hope you will have some gains.