Quantcast
Channel: SQL Server Replication forum
Viewing all 4054 articles
Browse latest View live

Replication

$
0
0

Hi,

i got the following error while i configure snapshot replication.error occured when data getting replicated from publication to subscriber database.

Error: the agent could not be started

i was unable to find out where the error has been occured?But i configure publication successfully(default instance)  and i want to subscribe the publication database to second and third instances(those are subscribers). During this situation i didn't able to subscribe that publication database from default instance.

 


Why sometimes a setting of Polling Interval = 60 does not always trigger subscriber to publisher updates every 60 seconds?

$
0
0

Hi,

We currently have a merge replication setup set at a High Volume Server To Server with an interval setting of 60. A lot of times, especially when we observe it first had with the replication monitor, it does not always update every minutes -- sometimes 2 minutes and sometimes even longer. This happens more when the updates are coming from the subscriber -- we did a test and make updates on both subscriber and publisher separately. The result is its often longer when the record change is coming from the subscriber.

Anyone can shed a light on what could be happening? Is there any way we can make it replicate much closer to 60 seconds?

Thanks in advance!

Regards,

Joseph


MCP, MCSD, MCDBA (ANXA)

Snapshot replication drop indexes SQL 2008R2

$
0
0

hi,

  I setup snapshot replication for table. In article properties I set copy for indexes to false. After executed synchronization in subscription table indexes were drop. Is it possible to save indexes? Indexes are different then in publication table.

I can write short script and execute it after synchronization but I'm looking for another solution.

Regards

Jacek


Best regards Jacek

Newbie Question: Replication from a local client to a central DB

$
0
0

Hi,

I want to create a solution which connects to a central server when available (i.e network connection available) but uses a local replica when not available.

When the connection is available any changes made will be sync'd to both local and central DB's.

I don't think that the LocalDB install of SQL Express will allow this.

So, do I need to install SQL Express on both the server and the local clients for it to work correctly?

What other options do I have?

(I've spent a couple of hours reading various posts/articles and cannot find the answer of which versions I need).

Thanks,

C.

Unable to create subscriber from backup. Error returned is, "Please create a master key in the database or open master key in session before performing this operation."

$
0
0

Hello,

I had one of our system administrators report this issue to me when using one of our documents on rebuilding replication for one of our products (we create the subscriber from database backup).

Here is the full error that was returned:

"SQL server could not create a subscription for Subscriber '<subscriber name>'.

Please create a master key in the database or open the master key in the session before performing this operation.  Microsoft SQL Server, Error 15581."

Any ideas on what exactly caused this or how to diagnose the issue, or fix it?  Thanks.

Merge replication latency

$
0
0

Hi

I have merge replication set up between several offices.  Most of the time I see new records pop up within about a minute in the different offices.  But a couple of times per week it takes from 30 minutes to 2 hours for the records to show up.  During this period SQL Server does not appear to be overtaxed on the publisher box, the subscriber box or the distributor box.  The ram and processors are not overly busy.  Other network traffic is not an issue.  How can I determine why replication is taking so long?

Thanks!


Steve Schlipf

Does database mirroring impact replication sync?

$
0
0

Hi,

I have a database configured for database mirroring and a transactional replication publisher, sql server 2008 sp1 version.

I found when the published database mirroring partner disconnected or the database mirroring session suspended, the replication stopped sync also.

Does anybody know the reason, or is there a workaround?

And is it true for sql server 2012 alwayson available-group?

Many thanks.



RMO - Publication Schedule

$
0
0

Hey,

I have the problem, when I create my publication by RMO in c#, that I dont know how or where to change/create the schedule plan for the publication. My code looks like this now:

MergePublication publication = new MergePublication(PublicationName, _settings.RegistryEntries.DbName, GetConnection(true));

publication.SnapshotGenerationAgentProcessSecurity.Login = _settings.SettingsReplication.DomainLoginName;
publication.SnapshotGenerationAgentProcessSecurity.Password = _settings.SettingsReplication.DomainLoginPassword;
publication.SnapshotGenerationAgentPublisherSecurity.WindowsAuthentication = true;

publication.PartitionGroupsOption &= PartitionGroupsOption.False;
publication.SnapshotSchedule.FrequencyInterval = 1;
publication.SnapshotSchedule.ActiveStartDate = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
if (publication.IsExistingObject)
{
  publication.CommitPropertyChanges();
  publication.SnapshotSchedule.Update(); // TODO: not working
}
else
{
  publication.Create();
}

so right now I'm not sure, if I get it wrong what the Update()-function should do, or if there is a bug? because nothing is going to be updated on the server, but there is also no exception.. I tried it without the commitchanges, I tried it in all combinations, but it never updates the interval and startdate..

and if dont change it in the publication, where do I change it?

and in this article it reads like it was designed for it: http://technet.microsoft.com/de-de/library/microsoft.sqlserver.replication.replicationagentschedule.update%28v=sql.105%29.aspx

ah and database-version is 2008 R2 with SP2 and I reference the newest assemblies (Microsoft.SqlServer.Rmo.dll, ... ) with the version: 10.50.400 (SP2)

thx in advance

basto




RMO - Publication - Article Issues

$
0
0

Hey,

I have the problem, when I create my publication by RMO in c#, that I dont know how or where to change/create the schedule plan for the publication. My code looks like this now:

MergePublication publication = new MergePublication(PublicationName, _settings.RegistryEntries.DbName, GetConnection(true));

publication.SnapshotGenerationAgentProcessSecurity.Login = _settings.SettingsReplication.DomainLoginName;
publication.SnapshotGenerationAgentProcessSecurity.Password = _settings.SettingsReplication.DomainLoginPassword;
publication.SnapshotGenerationAgentPublisherSecurity.WindowsAuthentication = true;

publication.PartitionGroupsOption &= PartitionGroupsOption.False;
publication.SnapshotSchedule.FrequencyInterval = 1;
publication.SnapshotSchedule.ActiveStartDate = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
if (publication.IsExistingObject)
{
  publication.CommitPropertyChanges();
  publication.SnapshotSchedule.Update(); // TODO: not working
}
else
{
  publication.Create();
}

so right now I'm not sure, if I get it wrong what the Update()-function should do, or if there is a bug? because nothing is going to be updated on the server, but there is also no exception.. I tried it without the commitchanges, I tried it in all combinations, but it never updates the interval and startdate..

and if dont change it in the publication, where do I change it?

and in this article it reads like it was designed for it: http://technet.microsoft.com/de-de/library/microsoft.sqlserver.replication.replicationagentschedule.update%28v=sql.105%29.aspx

ah and database-version is 2008 R2 with SP2 and I reference the newest assemblies (Microsoft.SqlServer.Rmo.dll, ... ) with the version: 10.50.400 (SP2)

thx in advance

basto




Merge replication uploading on first sync, WHY?

$
0
0

Hi guys

(SQL 2005 - SQL 2012)

I have 1 Publisher with 40 subscribers running merge replication. I am creating new servers hence new subscribers.
I create a snapshot of the publication DB with the agent. I take one of the 40 subscriber DBs, sync it a couple of time to make sure its up to date with the PUB. I then make a bakup of the subscriber DB. restore that to new server. I remove the bcp files relating to data in the snapshot that I created, then copy this snapshot files to new server. create new subscription on new server, i do not initialize it, i point it to the snapshot folder that i copied before. when i start the syncing, the new server should obviously start downloading all the changes that it missed in this time i am doing all this, as it did with most of the other ones i did so far. instead it started to upload thousands of records to the publisher, which in turn had to sync to all the other subscribers. how/where can i start investigating this? Why is it uploading? Any ideas?

Thanks

Can't push transactions to the distributor

$
0
0

Hi, all.  I work for a software company and we had to upgrade one of our applications which uses an OLTP database.  We use transactional replication for reporting purposes and when we perform upgrades we use a process that basically deletes and recreates replication after the upgrade is completed.  Unfortunately, I did not do this work but I was apprised of this problem this morning.  In Replication Monitor we noticed that the Log Reader Agent is failing with the following error:

The process could not execute 'sp_repldone/sp_replcounters' on <server\instance>. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011
The specified LSN {00000000:00000000:0000} for repldone log scan occurs before the current start of replication in the log {00026198:00001df9:006b}. (Source: MSSQLServer, Error number: 18768)
Get help: http://help/18768
The process could not set the last distributed transaction. (Source: MSSQL_REPL, Error number: MSSQL_REPL22017)
Get help: http://help/MSSQL_REPL22017

    I don't know how but it seems the LSN number the agent was looking for was somehow reset to the very first one.  I'm not sure how we can go about fixing this or how it could have happened.  Has anyone seen this before and do you know of a way to have it fixed?  Also, does anyone know what could have caused this issue?  Thanks.



    Web sync merge error The processing of the response message failed.

    $
    0
    0

    I am trying to get the first sync to work from a SQL 2008 publisher server through IIS7 to a SQL 2005 subscription server. Everything seems to be set up, but when the replication agent on the subscription tries to sync, the message always comes back with:

    No Data needed to be merged

    Repl Agent Status: 3

     then later on,

    OLE DB Subscriber '....' {call sys.sp_MSadd_merge_history90 (?,?...

    Percent Complete: 0

    The processing of the response message failed.

    Repl Agent Status: 6

    I am guessing it is something simple I missed in the setup, but I can't figure out what it is. Any help would be really appreciated!

    Setting up P2P with RMO - stored procedures not created

    $
    0
    0

    Hello, 

    I try to setup Peer-to-Peer replication with RMO, but ultimately it is not working because INSERT/UPDATE/DELETE stored procedures are not created. If anyone know what I am missing, I would much appreciate a response. Here's the code I use:

    Setting up publication and articles:

    using ( var connection = new PublicationContext( db ) )
    			{
    				var publicationDb = new ReplicationDatabase( connection.DatabaseName, connection );
    				if ( !publicationDb.LoadProperties() )
    				{
    					throw new ApplicationException( "The database doesn't exist." );
    				}
    				if ( !publicationDb.EnabledTransPublishing )
    				{
    					publicationDb.EnabledTransPublishing = true;
    				}
    
    				if ( !publicationDb.LogReaderAgentExists )
    				{
    publicationDb.LogReaderAgentPublisherSecurity.WindowsAuthentication = true;
    					publicationDb.CreateLogReaderAgent();
    				}
    				var publication = connection.Publication;
    				publication.Type = PublicationType.Transactional;
    				publication.Status = State.Active;
    				publication.ContinueOnConflict = true;
    				publication.Attributes = PublicationAttributes.AllowPull | PublicationAttributes.AllowPush | PublicationAttributes.EnabledForPeerToPeer
    				                         | PublicationAttributes.ImmediateSync | PublicationAttributes.IndependentAgent
    				                         | PublicationAttributes.SnapshotInDefaultFolder | PublicationAttributes.AutomaticGenerateSyncProcedures
    				                         | PublicationAttributes.AllowInitializationFromBackup;
    
    				publication.SetPeerConflictDetection( true, peerId );
    
    				if ( !publication.IsExistingObject )
    				{
    					publication.Create();
    				}
    
    				foreach ( string table in tables )
    				{
    					var article = new TransArticle
    						{
    							ConnectionContext = connection,
    							Name = table,
    							DatabaseName = connection.DatabaseName,
    							SourceObjectName = table,
    							SourceObjectOwner = "dbo",
    							DestinationObjectName = table,
    							DestinationObjectOwner = "dbo",
    							PublicationName = PublicationName,
    							CommandFormat = CommandOptions.BinaryParameters | CommandOptions.IncludeInsertColumnNames,
    							SchemaOption = CreationScriptOptions.PrimaryObject
    							               | CreationScriptOptions.CustomProcedures
    							               | CreationScriptOptions.Identity
    							               | CreationScriptOptions.KeepTimestamp
    							               | CreationScriptOptions.ClusteredIndexes
    							               | CreationScriptOptions.NonClusteredIndexes
    							               | CreationScriptOptions.DriPrimaryKey
    							               | CreationScriptOptions.UserTriggers
    							               | CreationScriptOptions.DriChecks
    							               | CreationScriptOptions.DriDefaults
    							               | CreationScriptOptions.Collation
    							               | CreationScriptOptions.DriUniqueKeys
    							               | CreationScriptOptions.MarkReplicatedCheckConstraintsAsNotForReplication
    							               | CreationScriptOptions.MarkReplicatedForeignKeyConstraintsAsNotForReplication
    							               | CreationScriptOptions.Schema
    						};
    
    					if ( !article.IsExistingObject )
    					{
    						article.Create();
    					}
    				}
    			}

    Setting up subscriptions:

    using ( var connection = new PublicationContext( publicationDb ) ) { var publication = connection.Publication; using ( var subscriptionConnection = new ConnectionContext( subscriptionDb ) ) { if ( pullSubscription ) { var subscription = CreatePullSubscription( subscriptionConnection, publication ); subscription.CreateSyncAgentByDefault = true; subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.Continuously; subscription.Create(); if ( !publication.EnumSubscriptions().Cast<TransSubscription>() .Any( s => s.SubscriberName == subscriptionConnection.ServerInstance&& s.SubscriptionDBName == subscription.DatabaseName ) ) { publication.MakePullSubscriptionWellKnown( subscriptionConnection.ServerInstance, subscription.DatabaseName, SubscriptionSyncType.ReplicationSupportOnly, TransSubscriberType.ReadOnly ); } } else { var subscription = CreatePushSubscription( subscriptionConnection, publication ); subscription.AgentSchedule.FrequencyType = ScheduleFrequencyType.Continuously; subscription.Create(); } } }

    Where CreatePullSubscription and CreatePushSubcription are defined as follows:

    private static TransPullSubscription CreatePullSubscription( ConnectionContext connection, TransPublication publication )
    		{
    			return new TransPullSubscription
    				{
    					ConnectionContext = connection,
    					PublisherName = publication.ConnectionContext.ServerInstance,
    					PublicationName = PublicationName,
    					PublicationDBName = publication.DatabaseName,
    					DatabaseName = connection.DatabaseName
    				};
    		}
    
    		private static TransSubscription CreatePushSubscription( ConnectionContext connection, TransPublication publication )
    		{
    			return new TransSubscription
    				{
    					ConnectionContext = publication.ConnectionContext,
    					SubscriberName = connection.ServerInstance,
    					PublicationName = PublicationName,
    					DatabaseName = publication.DatabaseName,
    					SubscriptionDBName = connection.DatabaseName,
    					SyncType = SubscriptionSyncType.ReplicationSupportOnly
    				};
    		}

    When I setup P2P replication on exactly the same databases and their state (using VM snapshot) through Sql Server Management Studio, the stored procedures are generated. 

    Best regards,

    Tadeusz Dracz


    Tadeusz Dracz

    SQL Server 2005 Replication: Job missing: Distribution clean up: distribution job

    $
    0
    0

    I am reading on how to stop my distribution db from growing wildly, in doing this I find that there is a job I am supposed to have called:  Distribution clean up: distribution job

    Is there any reason why I wouldn't have this in SQL SRVR 2005 STD?

    How do I go about adding it in?

    How to properly 'delete' replication from a server

    $
    0
    0

    Hi, all.

    We've come to the realization today that someone has improperly installed the distributor service on a SQL server that is not meant to have it.  Additionally, it appears there are snapshot and log reader SQL jobs leftover from previous fails attempts at replication on this server.  I've been tasked with cleaning up the server by removing all replication components, including the old jobs, the distributor, the distributor database and the existing subscription from this server.

    Can anyone tell me the best way to go about ensuring all replication components have been effectively removed from a SQL server?  Thanks.


    Unable to drop the distributor database

    $
    0
    0

    Hello,

    I'm trying to drop a distributor database that was accidentally installed on one of our SQL servers.  I have already deleted the publishers and subscribers that had been using this distributor database but when I try to run sp_dropdistributiondb I get the following error:

    Could not drop the distribution database 'distribution'. This distributor database is associated with a Publisher.

    There is nothing in the MSpublications table of the database and nothing in the MSpublication_databases table, so I don't understand why I'm getting this error.

    Any suggestions on how to resolve this so I can effectively remove the distributor from this server?

    Near real time replication from Oracle 11g to SQL Server 2008 R2

    Is it recommended to use "NOT FOR REPLICATION" on Foreign Key Constraints

    $
    0
    0

    Is it recommended to use "NOT FOR REPLICATION" on Foreign Key Constraints in Merge replication.

    what are its advantages and its disadvantages?


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. - Kerobin

    Merge Replication and IDENTITY reseed

    $
    0
    0

    What is the behind the scenes mechanism that Merge Replication uses in order to not increment the IDENTITY range value? I know that by specifying the NOT FOR REPLICATION after the IDENTITY column definition Replication achieves this behavior. What I am interested in is how come Replication does not increment the seed value for the IDENTITY column. Is there a way to duplicate this functionality?

    OS Error 1326 on new snapshot, please clarify

    $
    0
    0
    I know this has been posted before, but I need more clarification.

    Merge publication over HTTPS. Subscriber receives initial snapshot without problem. Snapshot directory is a share \\Server\ReplData\etc. There is no alternate snapshot folder.

    I add a single article (stored procedure) to my publication. I run snapshot agent by right-clicking on publication -> view snapshot agent status -> start. After the snapshot is generated, I get the familiar "Could not read file \\Server\ReplData\blablabla.sch due to OS Error 1326, unknown username or bad password.

    Exactly what username is this referring to? The account my subscribers use to authenticate during web synchronization has access to the share - otherwise they would not be able to get the initial snapshot, correct? My subscriber's local database is accessed via SA - but I don't see how that has any bearing.
    ahops
    Viewing all 4054 articles
    Browse latest View live




    Latest Images