为Merge Replication创建订阅

时间:2012-06-11 12:02:58

标签: sql-server-2008 replication subscription merge-replication

我有2台服务器(Server1,Server2)。我想运行一个脚本来生成Server2的订户Server2。使用向导非常简单。我使用向导生成了相关的脚本,但它不起作用。脚本是:

EXEC sp_addmergesubscription 
    @publication = 'MergePub', 
    @subscriber = 'Server2', 
    @subscriber_db = 'MergeDB',
    @subscription_type = N'push', 
    @sync_type = 'Automatic', 
    @subscriber_type='Global';
EXEC sp_addmergepushsubscription_agent
    @publication = 'MergePub',
    @subscriber = 'Server2', 
    @subscriber_db = 'MergeDB'
    @subscriber_login = 'sa'
    @subscriber_password = '123'

什么是错误的东西?

1 个答案:

答案 0 :(得分:1)

根据您的描述很难说出错误,因为您没有提供任何错误消息。

我可以使用以下脚本创建Merge推送订阅:

    -- Add a push subscription to a merge publication.
USE [AdventureWorks2008R2]
EXEC sp_addmergesubscription 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB, 
  @subscription_type = N'push';

--Add an agent job to synchronize the push subscription.
EXEC sp_addmergepushsubscription_agent 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB, 
  @job_login = $(Login), 
  @job_password = $(Password);
GO

查看How to: Create a Push Subscription