Table of Contents

Search

  1. Preface
  2. Data Replication Overview
  3. Understanding Data Replication
  4. Sources - Preparation and Replication Considerations
  5. Targets - Preparation and Replication Considerations
  6. Starting the Server Manager
  7. Getting Started with the Data Replication Console
  8. Defining and Managing Server Manager Main Servers and Subservers
  9. Creating and Managing User Accounts
  10. Creating and Managing Connections
  11. Creating Replication Configurations
  12. Materializing Targets with InitialSync
  13. Scheduling and Running Replication Tasks
  14. Implementing Advanced Replication Topologies
  15. Monitoring Data Replication
  16. Managing Replication Configurations
  17. Handling Replication Environment Changes and Failures
  18. Troubleshooting
  19. Data Replication Files and Subdirectories
  20. Data Replication Runtime Parameters
  21. Command Line Parameters for Data Replication Components
  22. Updating Configurations in the Replication Configuration CLI
  23. DDL Statements for Manually Creating Recovery Tables
  24. Sample Scripts for Enabling or Disabling SQL Server Change Data Capture
  25. Glossary

Filtering Table Rows for Selective Replication to Different Targets

Filtering Table Rows for Selective Replication to Different Targets

By default, Data Replication replicates data from source tables to corresponding target tables on all of the target servers. However, you can define a filter that selects a subset of table rows to replicate to a particular target.
First define the group of source tables to filter, and then define the filter conditions for the table group.
  1. Verify that the configuration is in Edit mode.
  2. On the
    Routing
    tab, select a target server.
  3. On the
    Filters
    subtab, click the
    Add
    icon button on the upper toolbar to add a group of tables.
    The
    New Table Group
    dialog box appears.
    The New Table Group dialog box appears after clicking Add on the Filters subtab.
  4. In the
    Group Name
    field, enter a name for the table group.
    Table group names can contain only the digits 0-9, Latin letters A-Z and a-z, and the underscore (_) character. The Data Replication Console truncates table group names that are longer than 100 characters.
  5. In the
    Schema
    field, select a schema name or enter a mask for the schema name. A mask contains the asterisk (*) wildcard.
    The lower left box lists the schemas that match your entry.
  6. In the
    Table
    field, select a table name or enter a mask for the table name. A mask contains the asterisk (*) wildcard.
    The lower right box lists the tables in the selected schema or schemas that match your table name entry.
  7. In the lower list boxes, select the schemas and tables to which the filter will apply. Then click
    OK
    .
    The
    Filters
    subtab displays the group name. The following image shows the
    Filters
    subtab with a new group name selected: Filters subtab with a group name selected
  8. To add a filter condition, select the group name in the upper list box. Then click the
    Add
    icon button above the lower list box for columns and conditions.
    The
    Filter
    dialog box appears.
    Filter dialog box
  9. To define a filter condition, perform the following steps:
    1. In the
      Column
      field, define a column name mask to select the columns that are part of the filter.
      You can enter only the asterisk (*) wildcard to include all columns.
    2. Select a condition operator.
    3. If the operator type requires a value to form the filter condition, enter the value in the field below the operator list. For example, if the operator is >, enter 1 to form the condition “greater than 1.”
      For date and time columns, use the following format for the value:
      yyyy
      -
      mm
      -
      dd
      hh
      :
      mm
      :
      ss
      .
    4. If the operator type requires a second value, enter a value in the field after AND. For example, if the operator is BETWEEN, enter 5 before AND and 10 after AND to form the condition “between 5 and 10.”
    5. Click
      OK
      .
      The filter condition appears on the
      Filters
      subtab. The Data Replication Console prompts you to apply the filter condition.
  10. Click
    Yes
    to apply the filter condition immediately. Click
    No
    if you want to apply the condition manually later.
    To apply the filter condition manually, click
    Apply
    . Then click
    Yes
    at the confirmation prompt.
    The right side of the
    Filters
    subtab shows the filter hierarchy. The subtab lists all of the tables and columns that match the filter criteria and the condition that is applied to each filtered column.
  11. Repeat steps 1 through 8 for other target servers, as needed.
  • For Oracle sources, InitialSync creates a view for internal use when materializing targets with DBLinks. To filter data for a particular target, InitialSync executes SELECT statements with a WHERE clause for the view. To generate valid SELECT statements, set the
    where_condition_surround_table_and_col_names_with_special_chars
    parameter to
    true
    in the
    DataReplication_installation
    /uiconf/default.cfg file. If the file does not exist, use a text editor to create the file in the uiconf directory and then add the parameter in the file. For more information, see Default.cfg File.
  • For each Oracle source table in a group, after you apply a filter condition, the Data Replication Console creates a virtual index that includes the columns for which the filter condition is defined, if a virtual index does not already exist. The virtual index is required to enable supplemental logging for the source tables. To name the virtual index, the Data Replication Console uses the table name followed by the _FILTER suffix.
  • If you create a filter for a particular target, Data Replication skips the source table rows that do not match the filter criteria when replicating changes to this target. If you later update at least one of the columns in a source table row that was previously filtered out for this target to a value that no longer meets the filter criteria, the source table row will be replicated to the target. However, for Oracle sources, any columns that are not in a supplemental log group created by Data Replication will have a null value in the replicated row on the target.
  • Data Replication applies the filters that you defined from the
    Filters
    subtab when the Send File task runs. If you add a filter after the Send File task ends, Data Replication does not apply the new filter to the replicated data.

0 COMMENTS

We’d like to hear from you!