在合并复制中,sqlserver会不断的同步架构,加上sch-m锁,即使架构没有更改,这就业务系统查询所用的sch-s冲突。为解决此问题,可暂停架构的同步,不过引起另一问题时,更新的存储过程等不会自动分发下去了,变通之道,在同步之前,开启架构复制同步,同步完成后,关闭。
—-开启架构同步
EXEC sp_changemergepublication @publication = 'BRM-NewCOPY', @property = N'replicate_ddl', @value = 1;
GO
—-更新存储过程…
—-关闭架构同步
EXEC sp_changemergepublication @publication = 'BRM-NewCOPY', @property = N'replicate_ddl', @value = 0;
GO
参考:http://msdn.microsoft.com/en-us/library/ms152562%28v=sql.90%29.aspx
By default, the following schema changes made at a Publisher running SQL Server 2005 are replicated to all SQL Server Subscribers:
- ALTER TABLE
- ALTER VIEW
- ALTER PROCEDURE
- ALTER FUNCTION
- ALTER TRIGGER