SQL Change Automation - error during release

Wondering if the cause of the error, below, is explainable with the information provided (below)  or if the cause is already known:

error = "RedGate.SQLCompare.Engine.Registration.ReadFromSnapshot.UnsupportedSnapshotException: The database snapshot was saved by a newer version of SQL Compare"

Project Information:
Installed SQL Change Automation 4.0 on work machine
Checked project into TFS.
Build generated and release deployed without errors. (All objects were deployed to target servers.)
Upon subsequent build queues, the triggered releases fail, the error, above, is the determined cause of the failures. 
I have not installed any scripts or SQL Compare or SQL Change Automation on the target machines/servers. (Again, note that the 1st release deploys without error).  
I note that my development db's snapshot table is empty and my target dbo.__schemasnapshot tables contain a record, with the date of, what I believe is, the first deployment.
Tagged:

Answers

  • The normal cause of this is that whatever is running the build in that case has an older version of SQL Compare (which is used internally) than that which the latest entry of the schema snapshot was created with.

    In general you need to ensure that all the build agents are on the same version.

    Have you visited our Help Centre?
  • teetee Posts: 25 New member
    We have only 1 build agent and all of the release agents are the same version. I don't imagine this is related to the agents since the 1st release executes successfully. 

    Cause of the release failure -  error message: 
    System.Management.Automation.CmdletInvocationException: An unhandled error occurred: RedGate.SQLCompare.Engine.Registration.ReadFromSnapshot.UnsupportedSnapshotException: The database snapshot was saved by a newer version of SQL Compare 

    The scenario:
    • The 1st release executes the entire build, making changes on the target server as expected, (no errors), and installs the __MigrationLog] and [__SchemaSnapshot] tables, including populating the [__SchemaSnapshot] table with a record (records GUID matches in all target databases)
    • Subsequent releases fail, citing the above error  [__SchemaSnapshot] table in the target database(s)
    • There are no records in either the development or shadow database's [__SchemaSnapshot]'s table
     In summary, the error message and failure only occur in subsequent releases (never in the first).

    Since every successful release inserts a record into the [__SchemaSnapshot] table, I attempted to resolve the issue by adding the truncate statement to the the post - deployment script. I also tried adding to the pre-deployment script. Neither method removes the record(s). 

    In order for the release to execute (except for the 1st release) I must manually delete the [__SchemaSnapshot] record from each targeted database.

    Question:
    How can I automate the truncation of the [__SchemaSnapshot] table, on target databases, from a script within project?

  • TomBrattinTomBrattin Posts: 1 New member
    We have a similar issue.  We have been using SQL Automation for a couple of years along with Azure DevOps pipelines and the community Redgate packages on an Octopus server to deploy the packages to the SQL Servers. In the past, whenever I got the 'The database snapshot was saved by a newer version of SQL Compare' it meant one of the developers had upgraded his SQL Automation client tools and I just downloaded and applied the latest packages to the deployment server. This time installing the latest tools has not solved the problem. I installed sqlchangeautomation.4.3.20280.22508 and I still get the error.  If I delete the snapshot record from __SchemaSnapshot, I can get one deploy to run before the error comes back. HELP!
Sign In or Register to comment.