Monday, May 4, 2015

Set and Verify the Retention Value for Change Data Capture

To set and verify the retention period from the default 3 days to 5 days.

sp_cdc_change_job @job_type='cleanup', @retention=7200

The value 7200 represents the number of minutes in a period of 5 days. All was well, but they recently asked how they can verify that the change was made. Well, it turns out the values are stored in the msdb database, in a table called dbo.cdc_jobs. Below is the quick query to allow them to test any database with CDC enabled, to find the retention value:

SELECT [retention]
FROM [msdb].[dbo].[cdc_jobs]
WHERE [database_id] = DB_ID()
    AND [job_type] = 'cleanup'

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.