0

我想使用 AWS DMS 将本地 SQL Server CDC 迁移到 S3 文件。一切正常,但目标中的 CDC 操作时间。我有:

    [__$start_lsn]
    ,[__$end_lsn]
    ,[__$seqval]
    ,[__$operation]

列目标中的数据,但与时间无关。我怎样才能在目标中有操作时间?

我知道如果有办法在目标中返回 SQL 函数的结果,我可以调用sys.fn_cdc_map_lsn_to_time(x.__$start_lsn)函数,但不知道该怎么做。

本地 SQL Server 版本为:

Microsoft SQL Server 2014 (SP1-CU4)- 12.0.4436.0 (X64) 企业版:Windows NT 6.1(内部版本 7601:Service Pack 1)(管理程序)上基于内核的许可(64 位)

4

1 回答 1

0

根据您在评论中对我的澄清问题的回答,我认为这将起作用:

select sys.fn_cdc_map_lsn_to_time(__$start_lsn)
from «some change instance»;

«some change instance»您可以从sys.sp_cdc_help_change_data_capture系统存储过程中获取值。

但!我猜你想用它来跟踪你的 DMS 操作的进度。我就是这样,我建议稍微更改查询。像这样:

select sys.fn_cdc_map_lsn_to_time(max(__$start_lsn))
from «some change instance»;

也就是说,映射 last_lsn 的时间而不是所有的时间。好狩猎!

于 2019-06-13T02:36:24.953 回答