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

SQL 2017 returns "The merge process could not replicate one or more INSERT statements to the 'subscriber'."

$
0
0

Hi,

We changed our replication system from SQL 2008 R2 to SQL 2017. This means we installed SQL 2017 developer edition with the latest CU on a brand new server. The subscriber remained on SQL 2008 R2. I recreated for the merge replication all subscriptions and everything is working like a charm.

But on one new laptop I installed SQL 2017 devlpr and created also the subscription. If I look on the subscriber the Synchronization Status, the replication is starting and after 30 minutes I get the message:

"The merge process could not replicate one or more INSERT statements to the 'subscriber'.
A stored procedure fails to execute. Troubleshoot by using SQL Profiler."

I looked in the profiler:

2018-10-01 12:08:19.439 The merge process is retrying a failed operation made to article 'TTable' - Reason: 'A query executing on Subscriber 'LAPTOP-W10\TEMP' failed because the connection was chosen as the victim in adeadlock. Please rerun the merge process if you still see this error after internal retries by the merge process.'.
2018-10-01 12:08:19.439 OLE DB Distributor 'SERVER-SQL\TEMP2017': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-10-01 12:08:19.439 The merge process could not replicate one or more INSERT statements to the 'Subscriber'. A stored procedure failed to execute. Troubleshoot by using SQL Profiler.
2018-10-01 12:08:19.441 The merge process could not replicate one or more UPDATE statements to the 'Subscriber' because a stored procedure failed to execute. Troubleshoot by using SQL Profiler.

So it seems to be a Deadlock - but I don't understand why?

There is also nothing special with this table. I also took the database from another laptop (so the database should be up to date) - but same problem here.

Anything changed in SQL 2017 replication?

Any ideas?

Patrick




Replication and Log Shipping

$
0
0

I currently have a production database being backed up/restored into a data warehouse for reporting.  I'm looking to update this more than nightly during the day so I'm looking at table level replication for specific tables. I also need to have this same database (the whole thing, almost 9000 tables) copied offsite for DR/BC.

My question is what is the best method to accomplish both of these tasks?  I'm thinking maybe log shipping and replication since I can't use just log shipping and still read from the secondary.  I'm also not sure what the performance would be on replication with that many tables.

Is there a better way to accomplish these two primary needs or am I on the right track?  Thank you for any help provided.

Running sp_dropsubscription returns error msg 637 Cannot use SAVE TRANSACTION within a distributed transaction

$
0
0

Greetings

I am hitting error ms 637 "Cannot use SAVE TRANSACTION within a distributed transaction" when I try to run sp_dropsubscription for a subscriber. When I run sp_dropsubscription using @subscriber= "all" I get msg 8526 "Cannot go remote while the session is enlisted in a distributed transaction that has an active savepoint". when I run dbcc opentran the REPL_DIST_OLD_LSN returns (305980:31746:3) and REPL_NONDIST_OLD_LSN returns (0:0:0).  Prior to this I stopped the logreader agent and ran sp_replcmds and sp_replflush successfully and closed the session.

  My environment is as follows: SQL 2008 R2 distributor, sql 2000 sp4 publisher and sql 2008 r2 subscribers.  We are using DTC for one of the procedure in the publisher database. This procedure was recently updated to use BEGIN DISTRIBUTED TRANSACTION as the subscriber was recently upgraded from SQL 2000 to SQL 2008 and this was required. I have tried setting remote proc trans from 1 to 0 on the publisher but still get the error. any one know what is going on here?

Replication setup

$
0
0
Dear All,


I‌ want to set up Replication between 2 different versions of SQL Server, I want to know how much higher I can go e.g. if I had 2008r2, would I be able to use it with 2016 etc. please?



T‌hanks in advance! 

Pull transactional replication not picking up new articles

$
0
0

Hello replication experts,

I have transactional replication set up in my enterprise SQL 2014 server. Publication has IMMEDIATE_SYNC and ALLOW_ANONYMOUS properties set to FALSE, sync_method= concurrent. 

Environment details:

1) Publisher: SQL Server 2014 EE SP2

2) Distributor: SQL Server 2014 EE SP2

3) Subscriber: SQL Server 2014 EE SP2

4) Subscription type: Pull

I added an article using the script below:

use [Test_Pub]
GO
exec sp_addarticle 
@publication = N'PubRPT', 
@article = N'artTest',
@source_owner = N'dbo', 
@source_object = N'artTest', 
@type = N'logbased',
@description = N'', 
@creation_script = N'', 
@pre_creation_cmd = N'drop', 
@schema_option = 0x00000000080010A7, 
@identityrangemanagementoption = N'manual',
@destination_table = N'artTest', 
@destination_owner = N'dbo', 
@status = 24,
@vertical_partition = N'false',
@ins_cmd = N'CALL [dbo].[sp_MSins_dboartTest]', 
@del_cmd = N'CALL [dbo].[sp_MSdel_dboartTest]', 
@upd_cmd = N'SCALL [dbo].[sp_MSupd_dboartTest]'
GO
EXECUTEsp_refreshsubscriptions @publication = N'PubRPT'
GO
EXECUTEsp_startpublication_snapshot @publication = N'PubRPT'
GO

I have used this same script several times in the past with no issues. Objects created in the subscriber and snapshot was only run for new articles. This time, even though snapshot ran with no errors for this new article, it did not create the table or objects at the subscriber. There were no errors logged in distribution agent job and was running as usual delivering transactions for rest of the articles. When snapshot job ran it did create files on snapshot location for the newly created article. 

I am clueless at this point as to why this is not working and the same thing worked in the past without any issues. Please provide your suggestions/insights to fix this issue. 

SQL Replication

$
0
0

i have two database  DB1 & DB2  (dev server), replication setup is there from DB1 to DB2.

  1. week on week this two DB needs to restored (refreshed) from ProdDB bakup file.


how to accomplish this? bcoz once setup repication on that DB , i can't  refresh this DB from prod. 


Retrieving data from Distributor

$
0
0

SQL 2017 Developer 14.0.3037.1. Management Studio 17.9/14.0.17285.0

Created merge replication. Everything in replication works with no errors.

If I connect with Replication Monitor from PC2 (Subscriber) to PC1 (Publisher and also Distributor) Monitor on PC2 works perfect.

If I connect locally with Replication Monitor it stucks with message "Retrieving data from Distributor". No errors in logs. No errors in Profiler

Reinstalled server, reinstalled studio, updated server, updated studio, executed repair from installer, recreated distributor, recreated replication. Nothing helped. Both PC1 and PC2 have same servers and versions of Studio and send same queries (caught with Profiler)

When I press on PC1 Action => Distributor settings => Connection it throws exception:

TITLE: SQL Monitor
------------------------------

SQL Monitor encountered unexpected error. Do you want to continue?

===================================

Object reference not set to an instance of an object. (ReplicationMonitor)

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.UI.PublisherSettings.ChangeConnection(Boolean changePublisher)
   at Microsoft.SqlServer.Management.UI.PublisherSettings.ChangeDistributorConnection(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Any tips how to fix this?

Updatable Subscriptions on SQL Server 2012

$
0
0
We have a primary web/database server (SQL Server 2012) which publishes data to our backup web/database server (also SQL Server 2012) subscriber using transaction replication. We want to be able to direct users to the backup server in case the primary server fails but writing to the subscription database directly from the website on the backup server throws a "cannot insert a duplicate key" error. I've read that this is by design and I've also read that "Updateable Subscriptions" was deprecated on SQL Server 2012. Since we cannot afford to purchase the Enterprise Edition, we are looking for an inexpensive/easy way to do this. I'm wondering if deleting the local subscription on the backup server would cause the identity field value to correct increment from the last value written during the replication. And I'm wondering if once the primary server is repaired if it would be possible to backup/restore the database from the backup server to the primary server. Any help would be appreciated.

Transactional replication

$
0
0


publication & sub & distri on same server

Database 1 & Database 2

after setting transaction replication

Error:

INSERT failed because the following SET options have incorrect settings: 'ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations. (Source: MSSQLServer, Error number: 1934)
Get help: http://help/1934

Transactional replication is not syncing data

$
0
0

After add more records on to Publisher site,  not replicate to subscriber site. The table already on "Articles"

local Publisher->properties ->Re-Initialization all subscribers heading to configure snapshot agent which I don't need it. Is there any way to start sync? or alternative  



last update

Transactional Replication - Error

$
0
0

Pub,sub & distr in same server : ServerA

Database :  DB1   (pub)

Database : DB2     (sub)

publication name: firstPub   (contains 50 articales)


Type:  transactional replication

but only one article (product_details) failed while insert record in pub.


Error messages:
Procedure or function sp_MSins_dboproduct_details has too many arguments specified. (Source: MSSQLServer, Error number: 8144)
Get help: http://help/8144

SSRS - Dynamic Data Bars

$
0
0

Hi ,

Is there any way we can make the data bars dynamically expandable across the columns Jan, Feb etc. based on the start month and end month ?

 

Start Month

End Month

Jan

Feb

March

April

May

Nov

Dec

1

12

 

 

 

 

 

 

 

4

11

 

 

 

 

 

 

 

Thanks,

Amrita 

SQL Merge replication Always running Job step2

$
0
0

Hi All,

i'm new to sql replication and just want to check if it's normal that the job is always running step 2 the reason I am asking is that we use SCOM to monitor our SQL and it generates an alert for the ''All Subscriptions are Synchronizing for Publication" monitor on the Publication if this job is continually running

Regards

Robert

dropping merge publication is extremely slow

$
0
0
Sometimes i need to refresh the databases and need to drop merge publication. I export the drop script and do it. I noticed some times it takes lot of time to remove the publication and it is stuck. How to run it quickly? any best practice?thank you.

Identity Range Check Problem

$
0
0

Hello all,

This problem always happens whenever a merge replication is used and whenever a table has auto-number (also known as identity).

[SQLSTATE 01000] (Message 0)  The insert failed. It conflicted with an identity range check constraint in database 'xxx', replicated table 'dbo.replicated_table', column 'id'. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentityrange; for the Subscriber, run the Distribution Agent or the Merge Agent. [SQLSTATE 42000] (Error 50000).  The step failed.

I have tried various solutions but none of them seems to work.

I read a post that they released a hotfix available to download for this bug on Microsoft SQL Server 2005, however I am using the 2016 SQL Server.

I tried changing the range of the publisher, subscriber, everything but nothing seems to work.

I am suspecting that the problem would either be:

1) A bug in the replication

2) Something from the application side causing it (The way users insert their data)

Thank you for the time you spent on reading this post, and your answer is much appreciated!


Trouble adding articles to an Publication/Subscription that are part of Availability Groups

$
0
0

I was adding a few articles (a delta of 8 tables and 2 views) to an existing publication that is part of an AG (so is subscriber).

e.g. -- Oct 16, 2018 - new tables
exec sp_addarticle @Publication = N'$(PublicationName)', @Filter_Clause = '$(FilterClause)', @article = N'InventoryPools',...
exec sp_addarticle @Publication = N'$(PublicationName)', @Filter_Clause = '$(FilterClause)', @article = N'InventoryPoolAdjustments', ...

...

I think my problem began when I used the actual SQLserverName as @Subscriber portion of this statement which I think normally forces a Snapshot of the Delta.  I think I should have used the AG Subscriber Name here.

exec sp_addsubscription 
@Publication = N'$(PublicationName)', 
@subscriber = N'$(SubscriberServerName)',-- I THINK I SHOULD HAVE USED AGSubscriberListenerName 
@destination_db = N'$(SubscriberDatabaseName)',
@subscription_type = N'Push',
@sync_type = N'automatic', -- , N'none',
@article = N'All', 
@update_mode = N'read only', 
@subscriber_type = 0

Does this assumption that this is the source of my problem make sense?

What this resulted in was a Second Subscription being created to the publication to the SAME subscriber database.   A second distribution job was created.

The snapshot agent started taking a full Snapshot instead of a delta which we want to avoid against our busy OLTP database.  Full snapshot was bad news as we have to do a lot to this DB downstream of a snapshot to get it ready for our needs.

I could see I had 2 subscriptions to the same publication both targeting the same subscription DB.

I stopped the snapshot job and I removed that new subscription. 

Sadly it clobbered ALL the MS repl procs in the subscriber DB.  It also removed the new distribution agent but the older one was still there and trying to update the DB (my light at the end of the tunnel).  But it was complaining that the MSIns proc was missing.

So I re-generated all the Procs and applied them to the subscriber DB; but now I am getting some duplicate Key errors on Inserts.

Feels like I am close but I am not sure how it got so confused as to what xact it should be applying.

If I can't save this situation by end of day I will be forced to re-build from scratch but that is a tough job that I would like to avoid.

Any suggestions for quickly determining what xact to skip and get that distributor on the right track again without loosing a beat?

Thanks very much in advance

...Ray


...Ray

SQL Server Table with huge data & Columns and not all the columns are unused.

$
0
0

Hi,

We have a table which is of a huge size 300+GB and it is growing at a 25Gb per month. We have identified that there are columns which are not being used.  Is it possible to do below option

Do a partition based on column and then implement compression based on the unused columns.

Let me know if it is doable and also if possible any examples

thanks

Vamc435


vamshi

Schema-only Replication Problem

$
0
0

Hi all,

The background = sql2014 publisher, merge replication , 500 SQL Express 2014 subscribers (user laptops).

One publication with roughly 150 articles. The subscription is filtered dynamically by the login of the subscriber, which together with merge filters defines the data partition for each subscriber.

One of the articles includes document data in a filestream column. The requirement is to take this article out of merege replication and have it managed by an alternative mechanism, taking an 'eventual consistency' approach.  However we would like to continue managing the schema via merge replication.

I have come across a few posts here and elsewhere that briefly discuss schema-only replication, and based on those I tried :

1) drop the article in question (which also drops a mergefilter definition to this article from its parent table in the hierarchy)
2) readd the article with @subset_filterclase = '0=1' (no rows will qualify at the publisher) and set @subscriber_upload_options = 1 (rows can be changed at subscriber but aren't uploaded)
3) run static snapshot job and sync

There were additional considerations to deal with identity columns and their range management (basically setting the seed to the highest in the system at all nodes)

This seemed to work well initially, but we exposed a problem that occurred when data was moved from one data partition to another, triggering an error :
"Could not find stored procedure 'dbo.MSmerge_expand_sp_4013124408D64B36AA2A6B2E04924D98'"

This missing procedure is actually for the parent table my new schema-only table. I suspect it's a 'precompute' SP.
It seems that in making my config changes, the static snapshot job decides to remove that SP (that's when it disappears), but other 'cogs in the system' seem to expect it to still exist.

So my question is whether it is possible to use merge replication to deliver a schema-only article, if so what am I missing in my actions, what are the definitive steps.
Or is it a case that merge rep is simply not designed to do this.

All insights , suggestions welcome;  thanks for reading and for any help!
BTTF

Changing Existing Transactional Replication Scenario

$
0
0

Hi,

I think this may be my first question on MS SQL DBA work, so I appreciate any constructive criticism to my post.

I am facing a restructuring of one of my site's setup to where two facilities that share a transactionally replicated server will be split, each to their own server.  Due to limitations of the vendor software currently running on these, we face severe difficulty in actually separating their data before (or even after) we split them.  So the project group's leanings have been towards duplicating the server, renaming etc., and having each facility run on their own instance.

This obviously presents great challenges for the transactional replication scenario.  We normally run a snapshot of any new facility writing to the server functioning as the data warehouse and let the transactional replication run from there on.  In this instance, we'd end up creating duplicates on the warehouse rendering it's reporting unusable.

Another challenge in the replication is that up to this point both facilities have been writing to the same tables (because they are the same server) in the warehousing db.  The reporting is set up to separate the data based on indicators throughout the data, apparently.

So at this point I'm beginning to wonder if there's a way to get Transactional Replication from two separate servers writing to the same tables, given that they won't be doing the same work and sending over the same records.

I realize this is NOT recommended, and certainly not ideal.  But it may present a functional option that the group can consider as at least feasible, if it's at all possible.

So, can two servers write to the same tables in Transactional Replication?  Is that something folks are doing?

Thank you so much for any and all comments.

Replication- add subscription issue

$
0
0

serverA : publication

Server B: subscription

type : push

created pub, while create sub am getting below error,

Viewing all 4054 articles
Browse latest View live




Latest Images