5.1.3 How HADR works

As described in the previous section, HADR uses the DB2 replication infrastructure to achieve data consistency and synchronization between the primary database and the standby database. Basically, we can separate the process into five steps. Figure 5-2 depicts these steps.

Figure 5-2 How HADR works

The steps are:

1.xxxx

With the High Availability disaster recovery (HADR) feature, when the standby database is started, it enters local catchup state and attempts to read the log files in its local log path. If it does not find a log file in the local log path and a log archiving method has been specified, the log file is retrieved using the specified method. After the log files are read, they are replayed on the standby database.

2.xxxx

When the end of local log files is reached, the standby database enters remote catchup pending state.

3.xxxx

The standby database remains in remote catchup pending state until a connection to the primary database is established, at which time the standby database enters remote catchup state. During this time, the primary database reads log data from its log path or by way of a log archiving method and sends the log files to the standby database.

4.xxxx

The standby database receives and replays the log data. When all of the log files on disk have been replayed by the standby database, the primary and standby systems enter peer state.

5.xxxx

When in peer state, log pages are shipped to the standby database whenever the primary database flushes a log page to disk. The log pages are written to the local log files on the standby database to ensure that the primary and standby databases have identical log file sequences. If for any reason the standby cannot keep the data consistency, the standby database will change to remote catch pending status again.
xxxx