Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

CDC capture instances

$
0
0

I am new to CDC and am running into an issue.  I am playing around with capture instances where I have specified the columns I am tracking.  I create a capture instance for a few columns and make some changes to the source table to test the CDC functionality and then I disable CDC on my table.  I then enable CDC on the same table, with the same capture instance name and add a few columns to track.  This is where I run into the issue.

As I use the CDC functions to extract the data I am getting an error.   Here is the error "Msg 313, Level 16, State 3, Line 37 An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_all_changes_ ... ."

I looked in BOL and it said that the issue could be because the LSN range does not fall within the change tracking timeline for the capture instance.  The code I am using is below, but the LSN range I am returning is all of the LSN values, so I'm not sure how the LSN range does not match up with the timeline for the capture instance.  The code below works just fine on the first capture instance I create, but when I disable CDC on the table and create a new capture instance I hit this error.

Any help is appreciated.

DECLARE

@begin_time datetime,


@end_time

datetime,


@begin_lsn

binary(10),


@end_lsn

binary(10),


@load_id

int

SELECT

@begin_time = '1900-01-01'



SELECT

@end_time = GETDATE()


SELECT

@begin_lsn = sys.fn_cdc_map_time_to_lsn('smallest greater than', @begin_time);



SELECT

@end_lsn = sys.fn_cdc_map_time_to_lsn('largest less than or equal', @end_time);



IF

@begin_lsn IS NOT NULL


BEGIN


SELECT * FROM cdc.fn_cdc_get_all_changes_Address_CDC(@begin_lsn, @end_lsn, 'all')


END


Viewing all articles
Browse latest Browse all 15694

Trending Articles



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