Configuring your shadow tables to work in Db2® high availability
disaster recovery (HADR) environments involves ensuring that all the required metadata is available
to all the standby servers.
Before you begin
- Ensure that the same version of InfoSphere
CDC is
installed on all hosts that will be used for HADR.
- Ensure that you can log in to the access-server-host as cdc-user.
- Ensure that the following things are identical on the primary
and all standby servers:
- Db2 instance
name
- Database name
- TCP/IP port name (svcename)
- InfoSphere
CDC user
id, group id, and password
- Db2 instance
owner user and password
- InfoSphere
CDC log
location
- Db2
logarchmeth1 configuration parameters
- InfoSphere® CDC installation
directory ($CDC_HOME)
- InfoSphere
CDC user
primary group on each HADR server must be the same primary group as the Db2 instance owner.
About this task
Restrictions
- If you re-create table mappings, perhaps because of DDL changes
to the source row-tables or target shadow tables breaking the original
table mapping, the mapping changes are not replicated to the standby
servers. You must re-create these table mappings in the standby servers
through a separate process.
Procedure
To configure your shadow tables in HADR environments:
-
Set the InfoSphere
CDC users umask to
002 or 007 in the cdc-user-home-dir/.bashrc file to control the default mode bits of new directories and files.
A setting of 007 restricts anyone other than the InfoSphere
CDC user group and
members of the Db2 administrator group from accessing the load images that are saved in the refresh loader back up
path. A setting of 002 allows users from outside those groups to read the images, but not to modify
them.
The following example shows the umask command added to the
.bashrc
file:
#UMASK ADDED TO ALLOW DB2 USER access CDC_REFRESH_LOADER_BACKUP_PATH
umask 007
- Log in to the access-server-host as cdc-user.
- Create the access-server-user user with
the following properties:
- The role is SYSADMIN.
- The user is a manager.
- The password does not change at first login.
- The password never expires.
To create
access-server-user,
issue the
dmcreateuser command as follows:
cd access-server-installation-dir/bin
./dmcreateuser access-server-user
access-server-user-fullname
access-server-user-desc
access-server-user-password
SYSADMIN TRUE FALSE TRUE
For more information about
the parameters, see
access-server-user
- On the HADR primary server, set up the InfoSphere
CDC instance
for shadow tables. For more information, see Setting up the InfoSphere CDC instance for
shadow tables
- On the standby servers, ensure that the cdc-refresh-loader-path exists
and that it is the same file system path that you specified in step 4.
The refresh loader path must be a shared path across all HADR servers.
This shared path can be a mount point for a shared volume such as
clustered shared disk or NFS.
- Use the dmset command to change the InfoSphere
CDC refresh
behavior to use recoverable load operations.
dmset -I cdc-instance-name refresh_loader_with_backup_copy=true
dmset -I cdc-instance-name refresh_loader_cleanup_backup_copy=false
dmset -I cdc-instance-name refresh_loader_backup_path=cdc-refresh-loader-backup-path
These three CDC system parameters enable the
following behaviors:
- The fast loader refresh behavior is changed to enable the COPY
YES option for the load operation. A LOAD command
that specifies COPY YES allows you to have logs
rolled forward on the standby and avoid placing the table space containing
the table into backup pending state.
- The load image is saved into the location specified by refresh_loader_backup_path.
The refresh loader backup path that you specify must exist and meet
the specified conditions.
- Start the 64-bit cdc-instance-name.
:
nohup ./dmts64 -I cdc-instance-name &
- Verify that cdc-instance-name has the appropriate
settings for the system parameters.
dmset -I cdc-instance-name
- Set up a datastore in one of the following ways: