Starting HADR

Start high availability disaster recovery (HADR) on the standby server, and then on the primary server.

Before you begin

Make sure to configure the HADR variables as described in the previous information. If the parameters are not configured correctly, the HADR servers do not start.

Procedure

  1. On the standby server, run the following command to deactivate the database:
    db2 deactivate db database
    For example:
    db2 deactivate db xmeta
  2. On the standby server, run the following command to start HADR on the standby server:
    db2 start hadr on db database as standby
    For example:
    db2 start hadr db xmeta as standby
    The following message is displayed:
    DB2000I  The START HADR ON DATABASE command completed successfully
  3. On the standby server, run the following command to verify the HADR role of the server:
    db2 get snapshot for db on database | grep Role
    For example:
    db2 get snapshot for db on xmeta  | grep Role
    The following line is displayed:
        Role                   = Standby
  4. On the primary server, run the following command to activate the database:
    db2 activate db database
    For example:
    db2 activate db xmeta
  5. On the primary server, run the following command to start HADR on the primary server:
    db2 start hadr on db database as primary
    For example:
    db2 start hadr db xmeta as primary
    The following message is displayed:
    DB2000I  The START HADR ON DATABASE command completed successfully
  6. On the primary server, run the following command to verify the HADR role of the server:
    db2 get snapshot for db on database | grep Role
    For example:
    db2 get snapshot for db on xmeta  | grep Role
    The following line is displayed:
        Role                   = Primary
  7. On each server, run the following command to verify that the databases are synchronized:
    db2 get snapshot for database on database | grep State
    For example:
    db2 get snapshot for database on xmeta  | grep State
    After the standby database makes the connection to the primary database, the state is reported as Peer:
        State                  = Peer