gpt4 book ai didi

sql - 在 azure devops 管道中部署 SQL 时面临错误

转载 作者:行者123 更新时间:2023-12-05 00:58:05 27 4
gpt4 key购买 nike

我在 azure devops 的发布管道中使用 sql DACPAC 类型的部署,但出现以下错误。我对SQL一无所知。有什么建议吗?

Publishing to database 'database_name' on server 'Server_name'. 
Initializing deployment (Start)
*** The column [dbo].[xxxx].[yyyy] is being dropped, data loss could
occur.
Initializing deployment (Complete)
Analyzing deployment plan (Start)
*** If this deployment is executed, changes to [dbo].[xxx2] might
introduce run-time errors in [dbo].[yyyy2].
Analyzing deployment plan (Complete)
Updating database (Start)
An error occurred while the batch was being executed.
Updating database (Failed)

最佳答案

同意迈克尔的任命。

The column [***] is being dropped, data loss could occur.

If this deployment is executed, changes to [] might introduce run-time errors in [].

这些都是可以预料到的,是针对安全性造成的。我假设您对数据库进行了一些更改,但不确定它是否会破坏目标数据库上的任何内容。现在,它将阻止部署,因为服务器无法确定更改是否安全


  • 第一个解决方案设置/p:BlockOnPossibleDataLoss=false

BlockOnPossibleDataLoss 默认值为 true,表示如果检测到可能的数据丢失,则停止部署。而 falseSqlPackage.exe 忽略它们。

所以,请执行任务,然后找到并输入上述参数到Additional SqlPackage.exe Arguments:

enter image description here


  • 输入第二种解决方案/p:TreatVerificationErrorsAsWarnings=true

注意: 如果第一个解决方案不适合您,则应使用第二个解决方案。

设置 TreatVerificationErrorsAsWarnings=true 表示将验证错误视为警告以获得完整的问题列表,它可以绕过允许发布操作在第一个错误发生时停止的限制。


查看 doc获得更多发布操作。

关于sql - 在 azure devops 管道中部署 SQL 时面临错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58690504/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com