SQL Server DACPAC数据库部署错误
DACPAC使用sqlpackage.exe进行部署,部署时候报错:
EXEC : error SQL72035: [dbo].[table] is under change data capture control and cannot be modified
该错误由于cdc的启用,在部署过程中添加以下参数解决
/p:DoNotAlterChangeDataCaptureObjects=False
添加之后部署出现新的错误:
EXEC : error SQL72035: [dbo].[table] is treated as replicated due to change tracking and cannot be modified.
这个错误是由于cdc内部对于实际上和replication的实现是一致的,所以在内部认为是replicated,继续添加以下参数解决:
/p: DoNotAlterReplicatedObjects false
总结,在cdc或者replication等高级特性启动的情况下通过DACPAC部署需要添加两个额外参数:
/p:DoNotAlterChangeDataCaptureObjects=False
/p: DoNotAlterReplicatedObjects false