I'm implementing a logging feature on a asp.net mvc2 application, that uses SqlServer2008 as a database and Entity Framework as a data model.
I enabled CDC feature of SqlServer and it's logging changes well, but I just noticed that some of the old logging data is erased.
Does anyone know what's default period CDC keeps records, and does anyone know how could I set it to indefinite value.
If you want to retain the CDC data indefinitly, you can simply disable the CDC cleanup job:
Here is a sample picture of where to find the option:
After you disabled the cleanup job, the CDC data will no longer get removed after a certain time interval.
By default it deletes anything older than 3 days, to change the default value to 14 days use the following script
I just discovered that the default retention value is 4320 minutes = 72 hours = 3 days.
It should be configurable by using
Here's the link to the more detail explanation of sp_cdc_change_job procedure
Hope this will help someone else, too :D.