HP Serviceguard Toolkits for Database Replication Solutions User Guide, March 2012

configured to run either on Node 3 or Node 4 and is currently running on Node 3. If the standby
package fails on Node 3, it fails over to Node 4.
The primary database package manages the primary database and the primary HADR. Similarly,
the standby database package manages the standby database and the standby HADR. Also, the
standby package automatically takes over the role of the primary database, if the primary database
fails or the node on which the primary database is currently running crashes. A role switch operation
can be configured for the primary and standby packages to restore the original role of the
databases. It is performed as soon as the failed database comes back online and the status becomes
peer”.
IBM recommends that the standby must be started before starting the primary.
The toolkit does not perform any role takeover when the primary package is halted using the
cmhaltpkg command. The standby package takes over the role only if the primary package fails
or if the primary node crashes.
NOTE: You can also configure the DB2 HADR in two node configuration. This configuration
allows only role management, role takeover, and role switch and should not be configured to
failover the package.
In this scenario, the DB2 HADR toolkit supports the following events:
NOTE: Packages in Event 1–4 are initially in the “Online” state. The Online state refers to the
state where both the packages are up and running and the primary HADR send logs to the standby
HADR, and both databases are in the “Peer” state.
Event 1: Standby HADR package fails
If either the standby database or the standby HADR is down, the standby package fails on Node
2. In this case, the standby package logs a failure message in the package log and sends an email
if the ALERT_MAIL_ID package attribute is set.
The primary package continues to run. Standby is not connected to the primary database, so the
primary package logs a warning message, Standby disconnected and sends an email. The standby
package fails over to Node 1. After primary HADR re-establishes the connection, the primary
package logs another message to the package log intimating that the connection is re-established.
If the standby package is halted manually, the primary package logs a warning message, Standby
disconnected and sends an email if ALERT_MAIL_ID package attribute is set.
Event 2: Primary HADR package fails
If the primary package fails, either because the DB2 database monitoring or the primary HADR
has failed, the package fails on that node. If ROLE_MANAGEMENT attribute is set to [yes], the
standby HADR package performs a role takeover and becomes the new primary database. The
role takeover is done using the [by force] option. The standby package logs success or failure of
the role takeover to the package log, and an email is sent. Simultaneously, primary package fails
over to Node 1. While primary package starts on Node 1, standby package does a role takeover.
In this case, primary package starts HADR as standby. After the new primary database is up, all
database clients reconnect to this database using the Automatic Client Reroute feature of DB2
HADR. When primary package fails and the ROLE_MANAGEMENT attribute is set to [no], standby
package does not perform a role takeover. If failover is enabled for the package, primary package
fails over to Node 1 and starts HADR as primary.
Event 3: The node hosting the primary database crashes
Consider ROLE_MANAGEMENT attribute is set to [yes]. In this state, if Node 2 crashes, the standby
HADR package uses the by force option to perform a role takeover, and becomes the new
primary database. Standby package logs success or failure of role takeover in the package log
and an email is sent to the mail ID. Simultaneously, primary package fails over to Node 1. While
primary package starts on Node 1, the standby package completes the role takeover process. In
this case, primary package starts HADR as standby. After the new primary database is up, all
Using the DB2 HADR toolkit 37