且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 CDC 中删除列(在 SQL Server 中)

更新时间:2023-02-07 14:23:29

CDC 允许您同时为给定的表提供最多两个活动的捕获实例(以适应基础表上的架构更改).因此,为了迁移到您指定列的新捕获实例(正如您在第二次调用 sys.sp_cdc_enable_table 时所做的那样),请为 @capture_instance 提供一个值> sys.sp_cdc_enable_table 中的参数并迁移您的 ETL 作业以使用它.然后,一旦您确定没有任何东西在使用旧的捕获实例,请再次使用 sys.sp_cdc_disable_table 删除它,为 @capture_instance 提供一个值(这一次,旧的).

CDC allows you to have up to two capture instances active for a given table at the same time (in order to accommodate schema changes on the underlying table). So, in order to migrate to a new capture instance where you specify the columns (as you do in your second call to sys.sp_cdc_enable_table), provide a value for the @capture_instance parameter in sys.sp_cdc_enable_table and migrate your ETL jobs to use it. Then, once you're sure that nothing is using the old capture instance, drop it using sys.sp_cdc_disable_table again providing a value for @capture_instance (this time, the old one).