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

Iam testing on a transactional replication. I create a table for employee and a store procedure to insert rows

$
0
0
Iam testing on a transactional replication. I created a table for employee and a store procedure to insert rows.

Now I need to change the properties of article Store procedure in replication article settings. 

Current property is - Replicate -> Stored procedure definition only
Need to change to - Replicate -> Execution in a serialized transaction of the SP

But it's in disabled I can not change the property, Please advise if I can change the property with existing SP article or do I need to drop and recreate the article to change it? 

Thanks in advance

Snapshot Hangs - Will not complete

$
0
0

We have had a successful Transactional Replication Topology in place for the better part of 4 years and recently experienced a hiccup that I have yet to resolve or find a similarly posted issue. 

Our environment consists of 2 main SQL Servers both SQL2005 (9.00.3042.00 X64 SP2) running Windows 2003 SP2. Production Server (A) and Reporting Server (B). The Distributor is on (B) and we have approximately 30 Publications with 700 Articles setup in Push Subscriptions executing at various times throughout the day. All agents run at the Distributor. Due to the size of a few key tables, we have setup a handful of single Pubs to account for our larger Articles, although the term large is relative with max table size at 5M Rows and smallest of our largest tables at 1M rows. The prior snapshot size for a 1M row table was approx. 950,000KB.

Recently we needed to reinitialize a subscription and marked the sub for “Use a new snapshot”. A prior snapshot for this table would typically take 60 – 120 seconds to generate and could be performed without issue until now. When attempting to create the snapshot (during Non-Peak or Peak Hours) , the agent instantaneously jumps to 31% and hangs. The same is true for all of our larger tables.  The problem is not isolated to a single Pub/Article but appear to be tied to the total size of the Articles in the Pub.     During the holiday maintenance window, the agent for the subject Snapshot ran for more than 7 hours and never completed, never advanced and eventually manually canceled.

My thought was the location that stores the Snapshot may be low on disk space but have confirmed we have 30GB’s available / 30% available free space (100GB Drive). When watching the BCP file size, it does appear to increase from 4000kb to 4100kb to 4200kb but literally at a snail’s pace with no hope of reaching the 950,000KB size that I know it will eventually need to reach.

When executing the BCP command line tool, we get decent throughput at 14K RPS so by those standards a 1M Row table should take approximately 71 seconds which is in line with prior successful results.

As a test, I took the exact same Article and created a Publication on Server B (my reporting server which also houses the distributor). The snapshot took 48 seconds to complete which is in line with Server A’s prior results when the system was functioning properly. Not 100% sure on what I’ve ruled out by conducting this test; I’d like to think I ruled out the distributor as the bottleneck…

We had a similar problem 2 years ago and found over a thousand orphaned records in MSSubscription, MSArticles and MSPublications Table. Apparently the SQL2005 GUI doesn’t do a very good job of cleaning up after a change is made in replication.

Over the holiday, I tried dropping all Subs and Pubs and creating everything from scratch (scripts).  The smaller tables generate snapshots without issue, but the larger tables just sit and spin.  Running out of options with current in-house skill set.  Does anyone have any thoughts on the issue or maybe could point me in different direction?   

Many Thanks,


How do you find a transaction given the LSN

$
0
0

Hi.. 

I'm pretty sure I have the problem where an undistributed transactions is causing my t-log to grow to infinity.  Well, maybe not quite.. 54 G t-log for < 2 G data.  We are backing up the t-log.  We're running 2008R2 10.50.4000

My log_wait_reuse_desc = REPLICATION.

My output for dbcc opentran is:

Replicated Transaction Information:
        Oldest distributed LSN     : (0:0:0)
        Oldest non-distributed LSN : (14628:9126:1)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Is there a way to find the transaction and cancel it.. ok  cancelling is probably asking too much, but is there a way to see the SQL behind the transaction?  Actually, it could be a quite old transaction.

My first guess was sys.dm_tran_database_transactions, but there is nothing there.

Here's the article I've been working off of:

http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/01/size-of-the-transaction-log-increasing-and-cannot-be-truncated-or-shrinked-due-to-snapshot-replication.aspx

It sounds like my only option is to run sp_repldone.  I see this recommended a lot, but as I understand there are caveats? Also, I see comments that suggest this may be a bug, but I think those threads are mostly related to 2005.

Thank you for your time.

Ria Caussyn

 


Ria Caussyn

Web sync requires port 1433

$
0
0

I've been able to configure merge replication using web sync and it has been working fine.  I then tried to use a client that has port 1433 blocked and found out that I could not pull a new subscription without having the client access port 1433 on the database server.

I was under the impression that the only machine that needed direct access to the SQL instance was IIS machine hostingreplisapi.dll.

Replication Issue - Sql server 2005

$
0
0

Hello,

We have sql 2005 and running Replication fro m3ed party s Publication and we have subscription.

Sometimes performance is too slow for our other user and we have to kill those users which ones are waiting.

The DB runs for suvscription is almost above 200 GB.

Thanks.

how to replicate from mysql xml file to mssql

$
0
0

i have xml file disgn by "sql designer" for  mysql 

and i wont to convert from mysql to mssql   , how can i do it  ?

i need mssql replication 2012

i am new here so i apoligy if i wrote wronge


Merge Replication - Auto Identity Range Management

$
0
0
Hello everyone...  I'm having a problem with merge replication.  My publisher and subscriber are SQL 2008 SP1, and my distributor is SQL 2008 R2.  Currently, there is no access to the subscriber data aside from the replication agents, so there are no data changes going on there, data is only being modified on the Publisher.  My plan was to get everything setup and do some internal testing before releasing the subscriber for use.

I am getting the following errors (from the merge agent job log):

"The Publisher failed to allocate a new set of identity ranges for the subscription. This can occur when a Publisher or a republishing Subscriber has run out of identity ranges to allocate to its own Subscribers or when an identity column data type does not support an additional identity range allocation. If a republishing Subscriber has run out of identity ranges, synchronize the republishing Subscriber to obtain more identity ranges before restarting the synchronization. If a Publisher runs out of identit"

and

"Error converting data type nvarchar to numeric."

I have an alert setup on the replication agent failure, and the email says this...  "Replication-Replication Merge Subsystem: agent PubSQL-Customer-tables-mer-SubSQL-2 failed. The Publisher failed to allocate a new set of identity ranges for the subscription. This can occur when a Publisher or a republishing Subscriber has run out of identity ranges to allocate to its own Subscribers or when an identity column data type does no"

I started getting these errors a few days after implementing merge replication, so I removed the articles from the publication.  I did start a trace and then start the merge agent so the error would show up, but my trace doesn't show an exception (not sure why).  I think I have found the issue in the trace, I see the following command:

declare @p4 smallintset @p4=0declare @p5 numeric(38,0)set @p5=468269declare @p6 numeric(38,0)set @p6=473269declare @p7 numeric(38,0)set @p7=473269declare @p8 numeric(38,0)set @p8=478269exec sys.sp_MSallocate_new_identity_range '07576F87-BA91-4863-BFE3-89228285F4A3','B241AAA2-1EAB-4AA5-B702-4966FE0A408E',2,@p4 output,@p5 output,@p6 output,@p7 output,@p8 output,N'tables-merge',N'SubSQL',N'Customer'select @p4, @p5, @p6, @p7, @p8

Then, right after, this is executed:

declare @p4 smallintset @p4=0declare @p5 nvarchar(40)set @p5=N'468269                                  'declare @p6 nvarchar(40)set @p6=N'473269                                  'declare @p7 nvarchar(40)set @p7=N'473269                                  'declare @p8 nvarchar(40)set @p8=N'478269                                  'exec sys.sp_MSallocate_new_identity_range '07576F87-BA91-4863-BFE3-89228285F4A3','B241AAA2-1EAB-4AA5-B702-4966FE0A408E',2,@p4 output,@p5 output,@p6 output,@p7 output,@p8 output,N'tables-merge',N'SubSQL',N'Customer'select @p4, @p5, @p6, @p7, @p8

The parameters to sys.sp_MSallocate_new_identity_range in the second command are not supposed to be sent as nvarchar, which would explain why I am getting the "Error converting data type nvarchar to numeric." message.

Why are these parameters being sent as nvarchar?  Is this causing the other error message to be raised?

Here is the script I used to add the article to the publication:

use [Customer]exec sp_addmergearticle @publication = N'tables-merge',
	@force_reinit_subscription = 1, @column_tracking = N'true', @subset_filterclause = null,
	@description = null, @creation_script = null, @pre_creation_cmd = N'none', @type = N'table',
	@vertical_partition = N'false', @verify_resolver_signature = 1, @allow_interactive_resolver = N'false',
	@fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0,
	@delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'false',
	@partition_options = 0, @force_invalidate_snapshot = 1,
	@schema_option = 0x000000014C034FD1,
	@source_owner = N'dbo', @destination_owner = N'dbo',
	@article = N'dbo.GroupActivity', @source_object = N'GroupActivity',
	@identityrangemanagementoption = N'auto', @pub_identity_range = 5000, @identity_range = 5000, @threshold = 90
go

How can I fix this?

Any help would be greatly appreciated.  Thanks in advance.

Jarret

Reorganize Indexes on Replicated Articles

$
0
0

Hi All,

what happens in case Replication Log Reader Agent couldn't able to send a batch with 1 lac records? 

1) It stops but doesn't start until we manually starts?

2) It restarts within retry interval and sends a new batch with commands?

Thankful to your advice on this.

Regards,

Kalyan 


----Learners Curiosity Never Ends----


Replication Script Monitoring On Not Running Subscriptions

$
0
0

Hello,

SQL 2008 R2 Ent SP2 on Windows 2008 R2 Ent SP1

I have been monitoring the replication using table MSreplication_monitordata. However, this is only capturing errored out replication. This is not capturing anything where the status of All Subscriptions is "Not Running".

How do I capture any subscriptions that are not running, so I can get alerted comprehensively?


Thanks.

How to find which command/transaction caused replication agent failed?

$
0
0

Hi there,

Our production replication server was down and got the following error message:

String or binary data would be truncated. [SQLSTATE 22001] (Error 8152).

We restarted the agent, and it worked fine, did not get the same errors again.

Could you please let us know how can we get the command which caused this issue?

Regards,

Tracy

Getting replication error, publisher login must be a member of the 'db_owner' role at the publisher database

$
0
0
We have a server (thankfully QA) that had transactional replication configured.  After changing the password for the service account, suddenly replication fails with the message below.  I've torn replication completely out and reconfigured it, but still get the error.  The service account and distributor account are both AD accounts and belong to sysadmin server role.  I'm at a loss, any ideas?

Replication

$
0
0

Hi,

I having some queries on replication:

1. What happens with publishing large columns like XML data?

2. How many publications,distribution and subscription can create in single instance?

3. What if subscription expires?

4. What if i delete/add table at publication?

5.What if i delete/add table at subscription?

How to determine which record is latest in replication - Publisher record or Subscriber record

$
0
0

Hi,

I am implementing custom conflict handler to resolve the conflict at the time of replication.

I want to get which record is updated either publisher or subscriber.

Because i want to replicate updated record.

Is there any way to find out latest record , Please suggest me .

Thanks in advance.

Ghost distribution agent job

$
0
0

SQL SERVER 2008 R2
Pull subscription transactional.

I deleted the default distribution agent job and recreated by scripting out the similar job for another publication.
The new job works fine but the issue now is that, my monitoring system is still picking up the old Job:
The following alerts related to the old job which doesnot exist now are being generated now:

Unable to retrieve steps for job gloss123-salesApp-Trans_salesapp-glossrep-Reporting_salesapp-RT65456-FR456-3456-6T56-5743567TYTG6.

When I query the following table, it shows me the old job not the new one. 
SELECT * from  distribution.dbo.MSdistribution_agents

My question is
1.

how to clean this unwanted alert.  This is most important for me to fix at the moment.

2.
How can the query above show the new job name (replication meta data change)

recreate a pull subscription distribution agent job with out reinitializing or recreating replication

$
0
0

Replication type: Pull subscription transactional replication.
SQL Server 2008 R2

everything is working fine except that by mistake I deleted the pull distribution agent job for one of the publications.
I recreated the job by scripting out the similar job for another publication.
The new
However, I see there are complications with these manually created jobs (Can be explained if required).
I now want to recreate the distribution agent Job for this publication through proper replication process.
I want to ensure that for Just as simple as recreating the Agent Job, I dont have to reinitialize the whole subscription or drop and recreate the subscriptions or recreate the whole replication for this publication.
I tried to recreate the job with sp_addpullsubscription_agent, I got the error message:

Msg 21002, Level 11, State 1, Procedure sp_addpullsubscription_agent, Line 250
The Distribution Agent for this subscription already exists
(Gloss11-SalesData-Trans_sales-Gloss22-Reporting_SalesData_-2R454415-E456-5T67-S345-D45T9243373B52).

Please review and suggest me if there can be something I need to do better.


Transactional Replication Error

$
0
0
Publisher (pub is own Distributor) SQL 2008 Enterprise SP1 on Win2003 x64 Server SP2

Created a trans repl pub with 1 table and recieved the following error. I have created multiple trans reps with no errors.
Error messages:
Message: A .NET Framework error occurred during execution of user-defined 
routine or aggregate "sp_scriptdropinsreconciliationproc_sqlclr": 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlConnection' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> 
System.Configuration.ConfigurationErrorsException: The value of the property 
'name' cannot be parsed. The error is: Request failed. (C:\Program 
Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.config 
line 21)
System.Configuration.ConfigurationErrorsException: 
  at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] 
keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, 
SectionRecord sectionRecord, Object parentResult)
  at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord 
factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean 
getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
  at 
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String 
configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, 
Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
  at 
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String 
configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, 
Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
  at System.Configuration.BaseConf
	...
System.TypeInitializationException: 
  at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
  at 
Microsoft.SqlServer.Replication.TransSqlClrCodeGenerators.ScriptDropReconciliationProcedure(SqlInt32 
articleId, CustomStoredProcedureType customProcedureType)
  at Microsoft.SqlServer.Replication.TransSqlC...
A .NET Framework error occurred during execution of user-defined routine or 
aggregate "sp_scriptdropdelreconciliationproc_sqlclr": 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlConnection' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 
'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> 
System.Configuration.ConfigurationErrorsException: The value of the property 
'name' cannot be parsed. The error is: Request failed. (C:\Program 
Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.config 
line 21)
System.Configuration.ConfigurationErrorsException: 
  at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] 
keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, 
SectionRecord sectionRecord, Object parentResult)
  at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord 
factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean 
getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
  at 
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String 
configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, 
Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
  at 
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String 
configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, 
Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
  at System.Configuration.BaseConf
	...

Can I migrate a publisher to 2012 and have it continue to replicate to 2008R2 Subscriber without missing a beat

$
0
0

I will be migrating our Production DB to SQL 2012 shortly (no service interruption using mirroring from 2008R2 to 2012).  that part works well.  

But our Production DB is a publisher feeding a Reporting DB and I'm not clear if replication can pick up from where it left off after the migration or whether I have to re-build the publication / Snapshot from scratch and whether I can continue to use the existing 2008R2 distributor or have to switch to a 2012 distributor.  Either way I would like to know the prescribed upgrade method from some experts who have given this a shot.

Are there good articles (advice) on the subject?

I'd rather not have to fully re-build the Transaction publication but could do that (including the lengthy snapshot)  if that is the best/safest approach.

In which case I might just re-configure the whole lot now to a 2012 Distributor now and make the new subscriber Reporting database a 2012.

Thoughts?

...Ray



...Ray

Deferred Updates happed even if the value does not change in SQL Server 2012

$
0
0

I am not sure if this was an intentional compatibility break for SQL Server 2012, but I have not been able to find any docs on it, so I am going to post it here to see.

We upgraded our SQL Server that publishes reference data to other servers.  The upgrade moved us from SQL Server 2008 R2 to SQL Server 2012.

After the upgrade we noticed that some of our replications would break because tables that were designed to never delete rows were trying to replicate deletes.

After a lot of research I found that my SSIS package that populates the source table every night was starting the chain of events that lead to the deletes.  This SSIS package fills a stage table, then does a MERGE to the "live" data.  (The idea is that any changes to data will then be replicated to the subscribing databases.  This all worked perfectly with SQL Server 2008 R2.)

The SSIS Package is very careful to never delete any rows.  Any NOT MATCHED on Source rows have an IsActive column set to false (not a DELETE).

However, after upgrading to SQL Server 2012, this merge statement would cause  every row in the table to try to publish a delete and an insert statement to the subscribers.

In an attempt to get to the point of this issue I need to define a scenario that can cause a Deferred Update:

If a MERGE statement has the clustered key in an UPDATE statement (in the MATCHED clause) then every row affected will post as a Deferred Update (Causing a Delete and an Insert to be published to subscribers).

However, new in SQL Server 2012, is the fact that even if the value of the clustered keyDOES NOT CHANGE it will still replicate as a Deferred Update.  Infact, even ifnothing in the row has changed at all, the row will still replicate a delete and an insert.

I tested this with traces an found it to be true and totally reproduceable every time.

So, I have 3 questions:

  1. Has anyone else seen this?  (Can it be reproed by more than just me?)
  2. Is it a Bug?
  3. Is there a way around it (besides using a compatibility mode)? 
    (NOTE: Trace Flag 8207 will only work if you are updating a single row, my merge statement affects the whole table.)

For now we removed the Clustered Key (Primary Key) from the update part of the merge statement.  (It never, ever, changes, so we did not need it there anyway.)  But I would still like to know what is going on here.



Need to set up Pull subscription to Publications already involved in Push subscriptions

$
0
0
I have a SQL 2005 instance that is a Publisher in a Push subscription scenario.  There are currently two subscribers.  I want to develop a pull subscription to a SQL 2008R2 instance on a different box.  I want to run the pull subscription on a schedule from 8am to 2359.  I then have a thrid party etl process that is going to read the data from the 2008R2 instance some time after midnight when there is no contention due to data changing via replication.  When I run sp_helppublication on my SQL 2005 Publisher, the "allow_pull'' option is set to off.  Can I have both allow_pull and allow_push enabled?  Is this really as simple as change the allow pull option to yes?  If so, how would I do that?

Lee Markum

Rowguid Different Between Publisher and Subscriber Causing Conflict

$
0
0
I am running merge replication and have a case where a single subscriber is constantly throwing conflicts and retrying rows.  In the conflict viewer it's showing that the conflicts are all due to constraint violations.  Looking deeper into the issue I can see the same row exists at the subscriber and publisher but with different rowguids.  The rowguid column is the PK for that table but another column in the table is also marked as a unique index, causing the conflict.  The merge agent sees the different rowguid as another column and is trying to resend it but can't because of the unique index.  Not sure how things got this way, the only way rows are getting added to this table are from the publisher (the clients don't add any rows).  Any ideas how things got out of whack and how to fix it.  Should i just update the rowguids at the subscriber?  I don't really want to reinitialize but might have to.
Viewing all 4054 articles
Browse latest View live




Latest Images