Sql server 2012 SQL Server Express 2012通过RMO拉同步不';我看不到订阅
我正在尝试设置SQL Server 2012和SQL Server Express 2012之间的复制。我已经通过SSMS设置了发布和订阅,并且正在尝试通过RMO完成同步 我已经按照答案进行了操作,但我收到一个错误消息,表示我尝试同步的订阅不存在。我试图检查订阅服务器上的订阅列表,但该列表为空 但是我可以在SSMS中看到订阅。它就在那里看着我。我一定错过了一些关于如何设置这些的内容。我已经删除并重新创建了发布和订阅。不走运 更新:更改示例代码以查找TransPullSubscriptions。第二个链接中的代码现在可以正确打印订阅 但是,实际运行同步的代码仍然看不到服务器上的订阅 负载属性测试失败,但继续将抛出错误:“SynchronizationAgent”仅在对象在服务器中呈现现有对象时才能使用 更新:现在有更多的代码Sql server 2012 SQL Server Express 2012通过RMO拉同步不';我看不到订阅,sql-server-2012,transactional-replication,rmo,Sql Server 2012,Transactional Replication,Rmo,我正在尝试设置SQL Server 2012和SQL Server Express 2012之间的复制。我已经通过SSMS设置了发布和订阅,并且正在尝试通过RMO完成同步 我已经按照答案进行了操作,但我收到一个错误消息,表示我尝试同步的订阅不存在。我试图检查订阅服务器上的订阅列表,但该列表为空 但是我可以在SSMS中看到订阅。它就在那里看着我。我一定错过了一些关于如何设置这些的内容。我已经删除并重新创建了发布和订阅。不走运 更新:更改示例代码以查找TransPullSubscriptions。第
static void SynchronizeMergePullSubscriptionViaRMO()
{
// Define the server, publication, and database names.
string subscriberName = "testsubDBserver";
string publisherName = "testpubDBserver";
//string distributorName = "distribution";
string publicationName = "test_sub";
string subscriptionDbName = "Data";
string publicationDbName = "Data";
// Create a connection to the Subscriber.
ServerConnection conn = new ServerConnection(subscriberName);
TransPullSubscription subscription;
TransSynchronizationAgent agent;
try
{
// Connect to the Subscriber.
conn.Connect();
// Define the pull subscription.
subscription = new TransPullSubscription();
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.PublisherSecurity = SecurityMode.Integrated;
agent.DistributorSecurityMode = SecurityMode.Integrated;
agent.Distributor = publisherName;
// Enable verbose merge agent output to file.
agent.OutputVerboseLevel = 4;
agent.Output = "D:\\logs\\mergeagent.log";
// Synchronously start the Merge Agent for the subscription.
agent.Synchronize();
}
答案是再次检查你的作品是否有拼写错误,即使你完全确定所有内容都拼写正确。testpubDBserver!=testpubBDserver
感谢布兰登的帮助。我这里的例子()是寻找合并请求订阅。您是否修改它以查找事务性请求订阅?已更新以响应您的评论并添加代码示例。正在接近。我可以在subscription.LoadProperties()之前查看代码吗?要开始,请验证您的SubscripterName、publisherName、publicationName、subscriptionDBName和publicationDBName设置是否正确。如果这些都是正确的,那么subscription.LoadProperties()将返回true,前提是服务器上存在订阅,并且其他一切都可以正常工作。是。这些实际上是我的测试值。但你是对的,我的酒吧数据库和这里的设置之间有一个小的输入错误。现在可以了。谢谢你的帮助。如何将此问题标记为已回答?