CDC->> turn on CDC functionality in a SQL Server

Source: Internet
Author: User

Use AdventureWorks;
GO
--Turn on CDC functionality for a database
EXEC sys.sp_cdc_enable_db;
GO
The--is_cdc_enabled field is 1 to enable CDC functionality.
SELECT name, is_cdc_enabled
From sys.databases WHERE database_id = db_id ();

Use AdventureWorks;
GO
--Opening the CDC function of a single sheet
EXECUTE sys.sp_cdc_enable_table
@source_schema = N ' HumanResources '
, @source_name = N ' Employee '
, @role_name = N ' Cdc_admin '
, @capture_instance = N ' Humanresources_employee '
, @supports_net_changes = 1;

--Check if the table has CDC enabled
SELECT [name], IS_TRACKED_BY_CDC from Sys.tables
WHERE [object_id] = object_id (N ' HumanResources. Employee ');
--alternatively, use the built-in CDC help procedure
EXECUTE sys.sp_cdc_help_change_data_capture
@source_schema = N ' HumanResources ',
@source_name = N ' Employee ';
GO

CDC->> turn on CDC functionality in a SQL Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.