Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

CDC stops change tracking

$
0
0

I enabled CDC on SQL Server 2012. It worked until the service patch automatically rebooted the machine and the change tracking stopped. Furthermore, there were 16 rows of changes before the reboot. After the reboot there were only two rows left.

We intend to use CDC to track the data change history for our user tables. We need the changes to be there all the time.

This is the SQL script that created the DB and enabled the tracking. Please let me know what should be changed.

CREATE DATABASE CDC_DEMO;

GO

USE CDC_DEMO;

GO

CREATE TABLE dbo.Boat (

Id int,

Name varchar(50),

BoatType varchar(20),

BoatLength tinyint,

BoatBeam varchar(20));

CREATE TABLE dbo.BoatListing (

Id int,

BoatId int,

AskingPrice money,

LastUpdateUser varchar(25));

use CDC_DEMO;

GO

-- enable CDC on the database

EXEC sys.sp_cdc_enable_db;

GO

USE CDC_DEMO;

GO

EXEC sys.sp_cdc_enable_table

@source_schema = N'dbo',

@source_name = N'BoatListing',

@role_name = NULL, -- Role gating not enabled

@filegroup_name = N'PRIMARY'; -- consider writing to a separate filegroup

GO

USE CDC_DEMO;

GO

EXEC sys.sp_cdc_enable_table

@source_schema = N'dbo',

@source_name = N'Boat',

@role_name = NULL, -- Role gating not enabled

@filegroup_name = N'PRIMARY'; -- consider writing to a separate filegroup

GO


Viewing all articles
Browse latest Browse all 5123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>