Function sys.fn_cdc_get_max_lsn() returns null
Asked Answered
P

1

3

I'm try use the cdc, and i was following these steps.

  1. EXEC sys.sp_cdc_enable_db -- Enable DB
  2. EXEC sys.sp_cdc_enable_table @source_schema = N'DW', @source_name = N'APIprocess', @role_name = NULL, @supports_net_changes = 0--Enable table
  3. Insert and update in the referred table

  4. DECLARE @Begin_LSN BINARY(10), @End_LSN BINARY(10) SET @Begin_LSN =sys.fn_cdc_get_min_lsn('DW_APIprocess') SET @End_LSN = sys.fn_cdc_get_max_lsn() SELECT @Begin_LSN, @End_LSN, N'all'; SELECT * FROM cdc.fn_cdc_get_all_changes_DW_APIprocess( @Begin_LSN , @End_LSN , 'all') -- Try to get the changes

And when i execute the 4th step throw this error:

An insufficient number of arguments were supplied for the procedure or function cdc.fn_cdc_get_all_changes_

Then i searched an answer and i finded some answers but in not any the problem was produced because that the function sys.fn_cdc_get_max_lsn() return null, and in that is my problem. In summary i need knows why that function return null instead of a binary. Thanks.

Piet answered 25/11, 2016 at 13:21 Comment(0)
P
16

The problem was that I didn't have active the service of Sql server Agent, after I activated it, the CDC began to track the operations on the table.

Piet answered 25/11, 2016 at 16:31 Comment(4)
Thanks! The error messages in CDC really could be worlds better. But this was it!Soulless
In my case, the database is in CentOS Server. There is no SQLServerAgent. Just SQLServer.service which is running. Any help in this regard?Anisole
I'm running Sql Server in Docker, how do I activate Sql server Agent?Sucker
@LuisEstrada should be the same if you are running it in docker, connect the sql server IDE to your SQL server docker instance and find option in your database from the IDEPiet

© 2022 - 2024 — McMap. All rights reserved.