Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Change data capture retentioni

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-11-26 : 15:11:17
I would like to retain the data for change data capture log tables to 365 days.
Please let me know the calculation for the retention period for 365 days in the below script.


EXECUTE sys.sp_cdc_change_job
@job_type = N'cleanup',
@retention =; --for 365 days

and also after applying the script how to know it is been updated the retention period to 356 days.

Thanks for your help in advance..

johnson_ef
Starting Member

16 Posts

Posted - 2012-11-30 : 06:41:21
As far as retention value in 'sys.sp_cdc_change_job' is shown as number of minutes. you can calculate it accordingly.

Data from Microsoft Technet Document:
-------------------------------------
[ @retention ] =retention
Number of minutes that change rows are to be retained in change tables. retention is bigint with a default of NULL, which indicates no change for this parameter. The maximum value is 52494800 (100 years). If specified, the value must be a positive integer.

retention is valid only for cleanup jobs.

For your script it could be like this:
EXECUTE sys.sp_cdc_change_job
@job_type = N'cleanup',
@retention =525600;

And you can see this changes in 'msdb.dbo.cdc_jobs'

-Johnson
Go to Top of Page
   

- Advertisement -