Sql-server – How to generate replication snapshot without locking tables

lockingreplicationsnapshotsql serversql-server-2008

When I reinitialize subscription and generate new snapshot it locks all tables and makes the database unusable for a very long time (never waited it out).

Is there anyway to do this without locking?

Best Answer

The whole point of snapshot is to provide a point in time copy of the articles involved in replication. It does it when generating the snapshot files from the publisher by locking the tables until the snapshot is finished for that particular article.

You should plan to reinitialize during less activity time of your server.

Is there anyway to do this without locking?

In SQL Server 2005, Concurrent snapshot is by default (applies to only PUSH subscriptions)

sync_method = concurrent

What it does is that it produces native-mode bulk copy program output of all tables but does not lock tables during the snapshot.

Not if the new snapshot should include schema changes. – Kenny Johansen Sep 16 '14

Also, as per your comment, if you are doing schema changes (e.g. adding new columns) and want to replicate those across to subscribers, you can use this method.