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

Managing Microsoft SQL Server Change Data Capture Settings

Managing Microsoft SQL Server Change Data Capture Settings

For Microsoft SQL Server sources, you can use the Data Replication Console to manage SQL Server Change Data Capture settings for source tables in a configuration. You must enable Change Data Capture to implement supplemental logging.
You must run the Server Manager under a Windows administrative user.
If you plan to run the Server Manager on a computer that is remote from the SQL Server source, ensure that the
remote admin connections
option of the SQL Server sp_configure stored procedure is set to 1. This setting enables the remote Server Manager to use a dedicated administrator connection (DAC) to the SQL Server source.
To change SQL Server Change Data Capture settings in the Data Replication Console, the configuration must be open in Edit mode. To only view Change Data Capture settings, without making changes, the configuration can be open in Read mode.
  1. On the
    Map Tables
    tab, click the
    Manage Database Supplemental Logging
    icon button above the source table
    Filter
    list.
    The
    Manage SQL Server Change Data Capture Settings
    dialog box appears.
  2. In the
    Database
    list, select the name of the SQL Server source database that contains the tables for which you want to view or edit Change Data Capture settings.
    The
    Database
    list displays only the databases for which one or more source tables are mapped. By default, the source database that is currently selected in the
    Source Schema
    list on the
    Map Tables
    tab is displayed, provided that it has at least one mapped table.
    A list of the mapped source tables in the specified database appears. The following image shows a list of the mapped source tables in the DB_Source database:
    The Manage SQL Server Change Data Capture Settings dialog box
    To display all source tables and databases, including those that are unmapped, select
    Show all objects
    . To display only the source tables that do not have Change Data Capture enabled, select
    Show only the tables for which CDC is not set
    . To filter the list of tables, enter the first few letters of a table name in the
    Table Filter
    field. For case-sensitive filtering, enclose the filter value in double quotation marks.
    If the source schema contains thousands of tables or the Data Replication Console runs in a local area network that is remote to the database server network, selecting
    Show all objects
    might significantly increase metadata caching time.
  3. In the
    CDC
    column, select the check box for each source table for which you want to enable Change Data Capture, or clear the check box for each source table for which you want to disable Change Data Capture.
    If the source database is Microsoft SQL Server Standard Edition, Data Replication prompts you to confirm the change because you must restart the SQL Server instance to update the Change Data Capture settings. For more information about restarting the instance, see Editing Microsoft SQL Server Instance Settings.
    To enable Change Data Capture for all of the source tables, click
    Select All
    . To disable Change Data Capture for all of the source tables, click
    Clear All
    . To revert to the Change Data Capture settings that appeared when you first opened the
    Manage SQL Server Change Data Capture Settings
    dialog box, click
    Reset
    . To refresh the view with any Change Data Capture changes that were made directly in the source database or from the Server Manager CLI, click
    Refresh
    .
    Data Replication generates Transact-SQL statements for executing the SQL Server stored procedures that enable or disable Change Data Capture for the source tables and the database that contains them. Data Replication uses the following syntax for the Change Data Capture statements:
    use
    [database_name]
    ; EXECUTE sys.sp_cdc_enable_db; use
    [database_name]
    ; declare @
    table_name
    nchar
    (characters)
    ; set @
    table_name
    =(SELECT
    table_name
    from sys.objects where object_id=
    object_id
    ) ; execute sys.sp_cdc_enable_table @
    schema_name
    = N'dbo' , @
    source_name
    = @
    table_name
    , @
    role_name
    = NULL, @
    capture_instance
    = N'dbo_
    table_name
    _
    sequence_ID
    ';
    use
    [database_name]
    ; declare @
    table_name
    nchar
    (characters)
    ; set @
    table_name
    =(SELECT
    table_name
    from sys.objects where object_id=
    object_id
    ) ; execute sys.sp_cdc_disable_table @
    schema_name
    = N'dbo' , @
    source_name
    = @
    table_name
    , @
    role_name
    = NULL, @
    capture_instance
    = N'dbo_
    table_name
    _
    sequence_ID
    ';
    The sys.sp_cdc_enable_db procedure enables Change Data Capture for the database that contains the selected tables. The sys.sp_cdc_enable_table procedure enables Change Data Capture for a selected table, and the sys.sp_cdc_disable_table procedure disables Change Data Capture for a selected table.
  4. To save the Transact-SQL statements to a script file, perform the following substeps:
    1. Click
      Save
      .
      The
      Save
      dialog box appears.
    2. Enter a path and file name. Then click
      Save
      .
      A message confirms that the script file was saved successfully.
    3. Click
      OK
      .
    You can use the saved script file to run the SQL statements later. If you do not have the authority to run the SQL statements or manage Change Data Capture settings, give the script file to a database administrator who has the required authority level.
  5. To run the SQL statements before exiting the dialog box, click
    Run
    .
  6. Click
    Close
    .
If you enabled Change Data Capture for any unmapped source tables, map these tables on the
Map Tables
tab to include them in the replication configuration.

0 COMMENTS

We’d like to hear from you!