To switch HADR roles for a database that contains shadow
tables, plan a takeover that performs the appropriate actions to ensure
that your shadow tables are available and current on the new HADR
primary server.
Procedure
To switch HADR roles for a database that contains shadow
tables:
- Log in to the access-server-host as cdc-user.
- Stop replication on the primary server by using the
following InfoSphere CDC system
command:
dmendreplication -I cdc_inst_name -c -s cdc_subscription_name
Use
the
-c option to wait for all in-progress operations
to finish and end the replication in a controlled manner. Avoid using
the immediate end type because you can end up with unreliable metadata.
- Stop the InfoSphere CDC instance
on the primary server by using the following InfoSphere CDC system
command:
dmshutdown -I cdc-instance-name
- Verify that the subscription and instance is stopped
by checking that the dmts64 or dmts32 process
is not running.
- Switch the HADR primary to one of the standby servers by
issuing the TAKEOVER HADR command on the standby
server (the principal standby if you have auxiliary standbys) as shown
in the following example
TAKEOVER HADR ON DB db-name
- Confirm that the old standby has now the PRIMARY role with
the db2pd command or the MON_GET_HADR table function.
- Restore the most recent version of the InfoSphere CDC configuration
metadata from the old primary (by taking a backup using dmbackupmd command)
to the new primary.
-
Start the InfoSphere CDC instance on the
new HADR primary server. For more information, see Starting InfoSphere CDC for Db2®.
- Update the InfoSphere CDC instance
with the new hostname and IP address by using the InfoSphere CDC Management
Console:
- Log in to the InfoSphere CDC Management
Console as access-server-user in the access-server-host.
- Navigate to the Access Manager tab.
- Right click on the datastore and select Properties.
- Update the Host Name field and
click the Ping button.
- Click the OK button.
- From the InfoSphere CDC Management
Console,
update the subscriptions:
- Navigate to the Configuration tab and connect
to the datastore. You should be able to see the subscription for shadow
tables.
- Right click on the datastore and select Properties.
- Click Update Related Subscriptions button.
The
Update Related Subscriptions
popup window should appear.
- Ensure the previous hostname is selected, and click the OK button.
- In the next
Update Related Subscriptions
popup window that
appears, click the Update button.
- In the next
Update Related Subscriptions
popup window that
appears, click the OK button. You will be automatically
logged out of the InfoSphere CDC Management
Console.
- Log in to the InfoSphere CDC Management
Console again,
and check that the datastore and related subscriptions have the expected
values.
Note: If you are already using a virtual IP (VIP) for client connections instead of
automatic client reroute (ACR), for example, then you can make a database role switch or a failover
transparent to
InfoSphere CDC Access Server by
using that VIP. Because the datastore connections can be configured using this VIP instead of using
the actual HADR host names or IP addresses, no configuration changes are required after the standby
takes over the primary role. However, VIP floating is limited to a single IP subnet, so it is
suitable for data center HA purposes and not for remote DR sites.
Using just a VIP and Db2 integrated HA does
not fully automate the CDC with HADR architecture, because the required CDC failover tasks still
require manual intervention.
- Clear the staging store on the new HADR primary server
by using the following InfoSphere CDC system
command:
dmclearstagingstore -I cdc-instance-name
- Start replication on the new HADR primary
server by using the following InfoSphere CDC system
command:
dmstartmirror -I cdc-instance-name -c -s cdc-subscription-name
- From the InfoSphere CDC Management
Console,
verify that mirroring for the subscription started by selecting . The subscription should be in mirroring state.