During high availability disaster recovery (HADR), use
the TAKEOVER HADR command to switch the roles of
the primary and standby databases.
About this task
- The TAKEOVER HADR command can only be issued
on the standby database. If the primary database is not connected
to the standby database when the command is issued, the takeover operation
will fail.
- The TAKEOVER HADR command can only be used
to switch the roles of the primary and standby databases if the databases
are in peer state. If the standby database is in any other state,
an error message will be returned.
Procedure
To switch the HADR database roles:
- Use the CLP to initiate a takeover operation on the standby
database, issue the TAKEOVER HADR command without
the BY FORCE option on the standby database.
In the following example, the takeover operation takes place
on the standby database LEAFS:
TAKEOVER HADR ON DB LEAFS
A
log full error is slightly more likely to occur immediately following
a takeover operation. To limit the possibility of such an error, an
asynchronous buffer pool flush is automatically started at the end
of each takeover. The likelihood of a log full error decreases as
the asynchronous buffer pool flush progresses. Additionally, if your
configuration provides a sufficient amount of active log space, a
log full error is even more unlikely. If a log full error does occur,
the current transaction is aborted and rolled back.
Note: Issuing
the TAKEOVER HADR command without the BY
FORCE option will cause any applications currently connected
to the HADR primary database to be forced off. This action is designed
to work in coordination with automatic client reroute to assist in
rerouting clients to the new HADR primary database after a role switch.
However, if the forcing off of applications from the primary would
be disruptive in your environment, you might want to implement your
own procedure to shut down such applications prior to performing a
role switch, and then restart them with the new HADR primary database
as their target after the role switch is completed.
- Call the db2HADRTakeover application
programming interface (API) from an application.
- Open the task assistant for the TAKEOVER HADR command
in IBM® Data Studio.
- From the Control Center, expand the object tree until you
find the database for which you want to manage HADR. Right-click the
database and click in
the pop-up menu. The Manage High Availability
Disaster Recovery window opens.
- Ensure that the databases are in peer state
- Click Takeover HADR. The Takeover HADR window opens.
- Select that you want to switch the database roles.
- If both databases in the HADR pair have been started
as standby databases, select one of the databases to take over as
the primary database.
- Click OK. The
window closes. A progress indicator might open to indicate when the
command is running. When it completes, you will get a notification
indicating whether or not it is successful.
- Refresh the Manage High Availability Disaster
Recovery window to ensure that the databases have switched
roles.
- If you are not using the automatic client reroute feature,
redirect client applications to the new primary database.
Additional
information is provided through the contextual help facility within
the Control Center.