Hello, Oleksandr! Welcome to the Microsoft Q&A Community!
Q: In Data Factory using CDC resource is there a way to monitor (and manually change) the last processed Incremental Column value? (i.e. current state/watermark)?
A: In Azure Data Factory (ADF), using the Change Data Capture (CDC) feature, it is possible to monitor and update the last processed incremental column value
Monitoring the Last Processed Incremental Column Value
- Using Metadata Tables:
- You can query the CDC metadata tables (
cdc.lsn_time_mapping
in your source or sink database to determine the last processed incremental value.
- You can query the CDC metadata tables (
- Using Dynamic Management Views (DMVs):
- For SQL Server or Azure SQL Managed Instance, the DMV
sys.dm_cdc_log_scan_sessions
contains information about the CDC log scan, including the watermark.
- For SQL Server or Azure SQL Managed Instance, the DMV
Changing the Last Processed Incremental Column Value Manually
If you need to reset or modify the CDC state/watermark:
- You can use
sys.sp_cdc_change_job
to configure the CDC process, but direct modification of the watermark is not supported natively. Instead:- Identify the target LSN or timestamp value that you want to set as the new watermark.
- Use a custom query or process to reset CDC metadata tables, but this is not recommended unless carefully tested, as it could lead to data integrity issues.
Q: I would like to know what if I stop the CDC resource and then Start it again, will it continue and process all the data during pause? Or will it start capturing only changes after the Start action?
A: Yes, it will continue and process all the data during the pause, As described Here
Q: I want to Stop CDC to create Index on the Target/Sink table, so I am thinking if it's enough just to Stop CDC resource temporarily and Start it again after I created the Index.
Could you advise?
A: Sure thing, stopping the CDC resource temporarily while creating the index on the target/sink table is a valid approach. Once the index is created, you can start the CDC resource again to resume data capture without issues As Described here
Please let me know if this helps, and don't forget to mark this as the accepted answer so others facing the same issue can find the solution more easily!