2012-03-07 68 views
2

根据微软的说法,SQL Server 2008 Express应该能够作为pull订户参与合并复制。至少在RMO对象中。SQL Server 2008 Express无法用于合并复制?

但其他变体也应尽可能使用。

但是,我们无法启动客户端上的SQL Server代理(运行SQL Server 2008 Express)。这似乎是一个常见问题,并且就我所能找到的而言,尚未解决。

我是否认为SQL Server 2008 Express不支持实际合并(拉)订阅?有没有人成功使用过这种技术?我认为微软声称这个工作正常,但这并不完全是非常严重的。

我希望有人对此有任何经验!

+0

这是一个非常好的问题。我花了一周的时间思考Express版(2012)SQL Server如何在没有SQL代理的情况下进行Pull复制。最后,我做了很多研究,但可以付出努力。 – Cheung 2013-08-23 09:02:56

回答

3

我能同步上的SQL Server 2008 R2 Express中的合并请求订阅 - 用C#以下位通过RMO - 没有SQL Server代理:

static void SynchronizeMergePullSubscriptionViaRMO() 
{ 
     // Define the server, publication, and database names. 
     string subscriberName = "WIN8CP\\SQLEXPRESS"; 
     string publisherName = "WS2008R2_1"; 
     string distributorName = "WS2008R2_1"; 
     string publicationName = "TestMergePub2"; 
     string subscriptionDbName = "TestSubDB1"; 
     string publicationDbName = "AdventureWorksLT"; 

     // Create a connection to the Subscriber. 
     ServerConnection conn = new ServerConnection(subscriberName); 

     MergePullSubscription subscription; 
     MergeSynchronizationAgent agent; 

     try 
     { 
      // Connect to the Subscriber. 
      conn.Connect(); 

      // Define the pull subscription. 
      subscription = new MergePullSubscription(); 
      subscription.ConnectionContext = conn; 
      subscription.DatabaseName = subscriptionDbName; 
      subscription.PublisherName = publisherName; 
      subscription.PublicationDBName = publicationDbName; 
      subscription.PublicationName = publicationName; 

      // If the pull subscription exists, then start the synchronization. 
      if (subscription.LoadProperties()) 
      { 
       // Get the agent for the subscription. 
       agent = subscription.SynchronizationAgent; 

       // Set the required properties that could not be returned 
       // from the MSsubscription_properties table. 
       agent.PublisherSecurityMode = SecurityMode.Integrated; 
       agent.DistributorSecurityMode = SecurityMode.Integrated; 
       agent.Distributor = publisherName; 

       // Enable agent output to the console. 
       agent.OutputVerboseLevel = 4; 
       agent.Output = "C:\\TEMP\\mergeagent.log"; 

       // Synchronously start the Merge Agent for the subscription. 
       agent.Synchronize(); 
      } 
      else 
      { 
       // Do something here if the pull subscription does not exist. 
       throw new ApplicationException(String.Format(
        "A subscription to '{0}' does not exist on {1}", 
        publicationName, subscriberName)); 
      } 
     } 
     catch (Exception ex) 
     { 
      // Implement appropriate error handling here. 
      throw new ApplicationException("The subscription could not be " + 
       "synchronized. Verify that the subscription has " + 
       "been defined correctly.", ex); 
     } 
     finally 
     { 
      conn.Disconnect(); 
     } 
} 

一个代码示例可以从下载MSDN Code Gallery

+0

非常感谢(向所有回答的人)!现在我有一些东西要真正挖掘! – kaze 2012-03-12 09:57:54

+1

没问题。我还汇总了一篇文章,详细介绍了在SQL Server Express中同步合并请求订阅的不同方式:http://www.sqlrepl.com/sql-server/synchronizing-subscriptions-in-sql-server-express/ – 2012-03-13 04:45:33

1

Replication Considerations (SQL Server Express)中所述,SQL Server Express可以在所有类型的复制中充当订阅者。

更重要的是,SQL Server Express不包含SQL Server代理。这意味着必须使用推送订阅,以便从分发服务器运行复制代理,或者如果通过Windows Sync Manager,RMO或批处理脚本进行同步,则可以使用提取订阅。

+0

感谢您的回答。据我了解,RMO方式也需要代理商。我认为这看起来像一个捕获22,即使在使用RMO对象时所需的代理.http://msdn.microsoft.com/en-us/library/ms147314.aspx – kaze 2012-03-08 06:52:23

+0

这不是我理解它的方式。我可以在没有SQL Server代理的情况下通过RMO同步订阅。 – 2012-03-08 17:32:41

+0

这听起来很有趣。您是否使用我在第一条评论中的网址中描述的技术? – kaze 2012-03-09 12:21:05

1

Windows同步中心WIN7:

假设这个复制是要在“预算服务器”上运行(例如Win7等客户端操作系统)为单人远程分支机构提供支持 - 那么这将工作得很好。它有一个不错的图形用户界面,可以在同步过程中给消息框带来一击,并且可以进行一些高级调度。

注意事项:

作品有:Windows身份验证 NOT WITH:SQL认证

作品有:一是当前登录的用户,即停留在任何时候登录,前提是:

  1. 该用户的用户名和密码有相同凭据replisapi.dll WEBSYNC页面
  2. 它们是具有访问远程数据库
  3. 他们能够访问复制的其他权限(basicaly点以上1 & 2)
  4. 同步中心自身运行相同窗口认证的用户内部调度

NB - 这是欺骗其已经取得了看起来像它支持SQL认证,它并没有真正;如果您手动输入密码,它将起作用,但只有在您输入密码后才会执行一次。因此它实际上不能使用sql认证。

原因是它无法保存密码。微软通过设计做到了这一点,到目前为止还没有解决方法。