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

Microsoft SQL Server Enterprise Edition

Microsoft SQL Server Enterprise Edition

Script for Enabling Change Data Capture

Use the following sample script to enable Microsoft SQL Server Change Data Capture for the database and for each source table:
-- Repeat the following database block for each database for which to enable Change Data Capture. -- BEGIN DATABASE BLOCK use
database_name
EXECUTE sys.sp_cdc_enable_db -- In each database block, repeat the following table block for each table in the database -- for which to enable Change Data Capture. -- BEGIN TABLE BLOCK execute sys.sp_cdc_enable_table @source_schema = N'
owner_name
' , @source_name = N'
table_name
' , @role_name = NULL -- END TABLE BLOCK -- END DATABASE BLOCK EXEC sp_configure 'max text repl size', 2147483647 RECONFIGURE WITH OVERRIDE

Script for Disabling Change Data Capture

Use the following sample script to disable Microsoft SQL Server Change Data Capture for the database and for each source table:
-- Repeat the following database block for each database for which to disable Change Data Capture. -- BEGIN DATABASE BLOCK use
database_name
-- In each database block, repeat the following table block for each table in the database -- for which to disable Change Data Capture. -- BEGIN TABLE BLOCK execute sys.sp_cdc_disable_table @source_schema = N'
owner_name
' , @source_name = N'
table_name
' , @capture_instance = 'all' -- END TABLE BLOCK -- END DATABASE BLOCK
Alternatively, to disable Microsoft SQL Server Change Data Capture for all of the tables in a particular database, use the following script:
use
database_name
EXECUTE sys.sp_cdc_disable_db

0 COMMENTS

We’d like to hear from you!