@sguidos Thank you for reaching out.
This is not a bug but a combination of design limitations and preventative measures from our side when restoring a CDC enabled database.
- The CDC Capture and Cleanup Jobs are always created, even if they do not exist in the source database's Managed Instance. When restoring a CDC enabled database, we create and start capture and cleanup jobs. When a CDC database is restored, the restored database also has CDC enabled. If the capture job is not started, the transaction log will fill up over time and can result in log full and write unavailability on the database.
- The restored database does not have the source database’s CDC Capture's Retention period in its [msdb].[dbo].[cdc_jobs] record (it contains the default Retention period of 3 days).
- The CDC Cleanup Job is always enabled, even if it is disabled in the source database's Managed Instance.
- **The CDC Cleanup Job runs immediately, and not at the time next scheduled at the source database's Managed Instance. **
These three issues are due to the fact that information (job enabled/disabled, retention, schedule), persisted in msdb and not within the context of the user database. This feedback is something we haven’t encountered previously and will require further internal discussion.
- DBName / Physical DB Name in CDC job names – feedback taken
However, we can disable automatically running CDC jobs after a restore on customer’s instance. In that case, you must manually add and start the jobs in order to avoid the log full issue down the line. However, it will also allow you to configure CDC jobs before running them.
Hope that helps.
Regards,
Oury