Sql-server – SQL Server replicated databases swap

replicationsql serversql-server-2012

I have a SQL Server 2012 database.

I would like to be able to make changes to this database or to it's replication, then make the replica, the real one.

The point here is to have 0 downtime on system updates.

What will happen if on the replica I'll change the type of a column?

Am I on the right way or there is a better way to have 0 downtime when updating my system?

Thanks.

Best Answer

If you make changes to the schema of the subscriber then it should keep running, but it really depends on the schema change that you make. If you change an nvarchar(50) to varchar(10) then there's going to be data truncation problems that you have to deal with.

Also there's no way to simply switch replication from one direction to another. Doing so would require deleting all the replication from the first server then setting up the replication from the second server back to the first server.

Depending on the changes that you need to make there should be basically zero downtime unless you are doing massive data changes or adding columns with default values or other large offline operations.