Does initial snapshot process lock tables when setting up transactional replication?
When you configure SQL 2012 Transaction Replication, does SQL Server place any locks on
the tables (the ones you have selected to publish) when it generates the initial snapshot files?
I have some tables (articles) that have 2M+ rows and I don't want this snapshot process
to cause any performance issues in production.  If the tables are being locked for 
the duration of the initial snapshot process, then I want to do this off peak hours.  

Can someone clairfy this?

Thanks!
September 2nd, 2015 2:57pm

Yes. A schema M lock will be held, so that the data does not change during the snapshot process. While the bcp operation is occurring locks will also be held.

Concurrent snapshots will result in less locking and if you are using the Enterprise Edition of SQL Server and use the sync_method of database snapshot there will be no locking.

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 4:37pm

Can you explain in a bit more in details what you meant by "use the sync_method of database snapshot there will be no locking."?  Give examples if all possible.  Thanks
September 2nd, 2015 8:42pm

Here is an example:

sp_addpublication @publication=MyPublication, @Status='Active', @Sync_method='Database Snapshot'

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 9:05pm

Does this mean I need to configure the publication using TSQL?   I was planning to go through the process via the SSMS GUI.  Is this option not available in the GUI?
September 3rd, 2015 11:47am

Hi Sidney,

This method of  specifying @Sync_method  parameter cannot be done from SQL Server Management Studio GUI. In other words, you need to configure the publication using T-SQL.

You can follow the instructions in the below articles to set up transactional replication with T-SQL.
 Setting up transactional replication using T-SQL
 sp_addpublication (Transact-SQL)

Thanks,
Lydia Zhang

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 1:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics