HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Replication Blocks Code Deployment

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
codeblocksdeploymentreplication

Problem

We have a database (SQL Server 2008r2) that is being transactionally replicated, namely tables, sprocs, views, indexed views and UDFs only, to another server (SQL Server 2014) as part of a cautious (read: slow) upgrade process. However, we still need to deploy new code or changes to it in the meanwhile.

Whenever we try to deploy new/changed code to it, using DACPAC under Visual Studio, we get a slew of the following errors:

Error SQL72035: [dbo].[SomeTable] is replicated and cannot be modified.

Is there anyway to avoid this? I was thinking if we could script the drop and create of the replication, we could put it in pre and post-deploy script, respectively, but I'm not sure if a) that is a good approach, and b) common practice.

Solution

We are facing the same problem - DACPAC does not support replication (as of now).

What we do is - if the deployment involves/affects replicated tables then

-
manually drop replication.

-
Script out drop and create replication using GUI or Powershell

-
Drop the replication

-
Run your DACPAC to upgrade your system

  • Create replication (scripted out previously) and kick off the snapshot of articles.



UPDATE :

USING GUI :

USING PowerShell :

  • Quickly Script Out Replication Redux - by CHAD MILLER



  • Using PowerShell to Script out Replication on SQL Server 2005/SQL Server 2008 by Paul Ibison

Context

StackExchange Database Administrators Q#65568, answer score: 4

Revisions (0)

No revisions yet.