How the cdc retention value can be changed for the cleanup job?

前端 未结 3 1070
野的像风
野的像风 2021-02-13 10:46

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 S

3条回答
  •  清歌不尽
    2021-02-13 11:14

    By default it deletes anything older than 3 days, to change the default value to 14 days use the following script

    use 
    go
    
    SELECT ([retention])/((60*24)) AS Default_Retention_days ,*
    FROM msdb.dbo.cdc_jobs
    go
    
    EXEC .sys.sp_cdc_change_job 
    @job_type=N'Cleanup'
    ,@retention=20160 -- <60 min *24 hrs * 14 days >
    go
    
    SELECT ([retention])/((60*24)) AS Default_Retention_days ,*
    FROM msdb.dbo.cdc_jobs
    Go
    

提交回复
热议问题