3

Am using sql DACPAC type of deployment in release pipeline of azure devops.but getting below error. I have no idea about SQL.Any suggestions?

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)
4
  • Naming convention has been changed to xx,yy not to disclose client data..so Commented Nov 4, 2019 at 9:32
  • 1
    This could be one of two things... 1) If you are dropping a column in a table then by default the deployment stops to prevent data loss. This can be overridden if you are happy for this to happen by passing in /p:BlockOnPossibleDataLoss=True in the Additional Arguments box in the release task or 2) DB Schema changes have been made which affect things like stored procedures or views Commented Nov 4, 2019 at 14:07
  • @Michael We got know from developers that we need to add Apptool dependencies.could you suggest me on this -v AppTools ="AppTools" Commented Nov 5, 2019 at 6:02
  • @Stella, why need add addition tool? Except the SqlPackage.exe, does your script need any special tool? The issue described in this ticket is solved, or need some tool to solve it? In azure devops, we need firstly consider whether this tool is exists in our server. Please update with more:-) Commented Nov 6, 2019 at 1:51

1 Answer 1

9

Agree with Michael's appointment.

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

and

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

These are all expected which caused by against the security. I assume you did some changes into your database which can not sure whether it would break anything on target database. Now, it will block the deployment since the server can't determine whether the changes are secure.


  • The first solution is set /p:BlockOnPossibleDataLoss=false.

The BlockOnPossibleDataLoss default value is true, which means stop the deployment if possible data loss detected. And false let SqlPackage.exe ignore them.

So, please go the task, then locate to and input the above argument into Additional SqlPackage.exe Arguments:

enter image description here


  • The second solution is input /p:TreatVerificationErrorsAsWarnings=true

Note: The second solution should be used if the first one does not work for you.

Set TreatVerificationErrorsAsWarnings=true means treating the verification errors as warnings to get a complete list of issues, and it can bypass the limitation of allowing the publish action to stop when the first error occurs.


See this doc to get more publish action.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.