Octopus and Redgate - Deploy from Database Release Failure

Hi All,
Somewhat new to the (DevOps) game and have been handed a TFS/Team City/Redgate platform to work on.

The first issue that we have is (but I believe that it apples to other projects as well) a database deployment to an existing DB (what I would term as a Merge only applying the updates).

The error that we are receiving is
Use-DlmDatabaseRelease :Pre-Update schema check failed: The schema in the Database Release object (created at ) and database ‘db_name’ on server ‘servername’ are different, or static data is different.
At C:\Octopus…\script.ps1:59 char:1
+Use-DlmDatabaseRelease $DlmImport -DeployTo $databaseConnection -SkipPostUpdateS…
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • CategoryInfo : InvalidResult : (:slight_smile: [Use-DlmDatabaseRelease], TerminatingException
  • FullyQualifiedErrorId : SchemasAndStaticDataAreNotIdentical,RedGate.SQLRelease.Powershell.Commands.UseDlmDatabaseReleaseCommand

I have tried the different options with the Use-DlmDatabaseRelease (-Skippre and -skippost in various combinations) with errors being generated no matter what I do.

I have however been able to get the following to run in a separate Powershell

$dbcon = New-DlmDatabaseConnection -ServerInstance ‘Servername’ -Database ‘db_name’
$package = ‘D:\Octopus\Packages\db_name.database\db_name.Database.10267.146.nupkg’
$release = New-DlmDatabaseRelease -Target $dbcon -Source $package
Sync-DlmDatabaseSchema -Source $release.Source - Target $dbcon

I make a change on the target data in a table that is linked to static data - run the above script - then check the target and the data has been corrected - so it works

However, why doesn’t the Use-dlmdatabaserelease commandlet work?
A colleague has said there was something about binary columns (and there is a varbinary in the schema) causing the compare to fail but I am unable to find any reference to this.

Apologies for posting this here as I know it is a RedGate issue - I have tried joining their forums but something has gone adrift and I cant post or log in?? and I have seen that RedGate are active on here

Thanks in advance for any help given

Steve

PS - The platform I am working on has no Internet connectivity so getting any logs in and out will be extremely laborious

Hi Stephen,

Thanks for getting in touch! The first thing that comes to mind is that the account running your Tentacle service does not have the permissions to run PowerShell scripts on the server.
If you are able to run the scripts locally on the server but not from Octopus, it is most likely this issue. The following link has information on changing the Tentacle user.

Let me know if this fixes your issue.

Regards,
Daniel

Hi Daniel,

Sorry about the delay responding – I wasn’t in the office on Friday.

One thing that I did confirm is that running the deploy against a database which was completely in sync with TFS generated no errors – it ran successfully. However, if I then go to a table that contains static data on the target and change a value in a column, then run the deploy again from Octopus the error then occurs so it seems to be unable to cope with differences in the Static Data

Hope this clarifies our issue

Regards

Steve

iipgoldc2b3e9 (32 KB)

Hi Stephen,

As the deployment itself is working, it does point to the implementation with the RedGate product and the best practices around it. Unfortunately while sometimes we can get the attention of the RedGate folks over here, it can take longer than directly emailing their support team at support@red-gate.com
We ourselves don’t have the expertise or experience that they do. If you do have problems getting through to their support team we will direct them here - let us know!

Regards,
Daniel