LSN is the "pieces" of information related about your SQL Server changes. If you don't have LSN, is possible that your CDC is not running or not configured properly. Debezium consumes LSNs to replicate so, your SQL Server need to generate this.
Some approaches:
- Did you checked if your table are with CDC enabled? This will list your tables with CDC enabled:
SELECT s.name AS Schema_Name, tb.name AS Table_Name
, tb.object_id, tb.type, tb.type_desc, tb.is_tracked_by_cdc
FROM sys.tables tb
INNER JOIN sys.schemas s on s.schema_id = tb.schema_id
WHERE tb.is_tracked_by_cdc = 1
- Your CDC database are enabled and runnig? (see here)
Check if enabled:
SELECT *
FROM sys.change_tracking_databases
WHERE database_id=DB_ID('MyDatabase')
And check if is running:
EXECUTE sys.sp_cdc_enable_db;
GO
- Your CDC service are running on SQL Server? See in docs
EXEC sys.sp_cdc_start_job;
GO
- On enabling table in CDC, I had some issues with rolename. For my case, configuring at
null
solved my problem (more details here)
EXEC sys.sp_cdc_enable_table
@source_schema=N'dbo',
@source_name=N'AD6010',
@capture_instance=N'ZZZZ_AD6010',
@role_name = NULL,
@filegroup_name=N'CDC_DATA',
@supports_net_changes=1
GO
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…