Reputation: 3935
This question is related to: Debezium How do I correctly register the SqlServer connector with Kafka Connect - connection refused
In Windows 10, I have Debezium running on an instance of Microsoft SQL Server that is outside of a Docker container. I am getting the following warning every 390 milliseconds:
No maximum LSN recorded in the database; please ensure that the SQL Server Agent is running
[io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource]
I checked Debezium's code on Github and the only place that I can find this warning states in the code comments that this warning should only be thrown if the Agent is not running. I have confirmed that the SQL Server Agent is running.
Why is this warning showing up and how do I fix it?
Note:
My current solution appears to only work in a non-production environment - per Docker's documentation.
Upvotes: 5
Views: 10495
Reputation: 29
This will also happen if all CDC tables are empty (i.e. there has been no change recorded in the database since the last CDC entry expired).
That's kind of annoying in developpement environnement as it happens more often that a DB isn't being used for an extended period of time.
Upvotes: 0
Reputation: 2091
Adding more to William's answer.
For the case SQL Server Agent is not running
You can enable it by following :
Now you can fire cdc job queries in your mssql.
PS: you need to have login access to windows server.
Upvotes: 4
Reputation: 3430
Another possibility of this error (I just ran into this warning myself this morning trying to bring a new DB online) is the SQL login does not have the permissions needed. Debezium runs the following SQL. Check that the SQL login you are using has access to run this stored procedure and it returns the tables you have set up in CDC. If you get an error or zero rows returned, work with your DBA to get the appropriate permissions set up.
EXEC sys.sp_cdc_help_change_data_capture
Upvotes: 3
Reputation: 1889
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:
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
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
EXEC sys.sp_cdc_start_job;
GO
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
Upvotes: 14