Quantcast
Channel: StackExchange Replication Questions
Viewing all 17268 articles
Browse latest View live

SQL Server Msmerge_content

$
0
0

I just joined my new office as database administrator. Here we are using SQL Server merge replication. It surprises me that 3 of major replication tables

  1. Msmergre_contents
  2. Msmergre_genhistory
  3. Msmergre_tombstone

Size of Msmergre_contents grew up to 64GB & no of records about to 64 billion and this is happening due to None set as the Expiration Period for subscriptions.

Now I want to clean up this table. As we are using a Simple recovery model, when I wrote a delete query on this table, everything got stuck. I have no downtime to stop/pause replication process.

Can anyone help me out how to minimize its size or delete half of its data?


Merge Replication - Detect nonlogged agent shutdown

$
0
0

I have never worked with SQL Server replication and am now in an environment with SQL Server 2012 merge replication. On 3/29 and 3/30 there are 13 of 19 replication jobs which are failing with detect nonlogged agent shutdown on the subscribers.

The publisher and distributor are on the same server. There are 2 publications which are failing. Some of the errors are

The process could not connect to Subscriber

and some errors are

The merge process failed because it detected a mismatch between the replication metadata of the two replicas

I am able to successfully ping the publisher from the subscribers.

All revalidations are failing. Do I need to recreate the subscribers? SQL Server Express is running on the subscribers.

Thanks..

Merge replication with Filestream

$
0
0

I have the scenario where I am using a FILESTREAM enabled table to upload and download files from.

I need the files available in two instances, database A and database B. Files can be uploaded to both A and B and must be synced to the other party. There is no restriction on uniqueness, identical files might be uploaded to the databases. Note the table to be replicated is used only for the files and nothing else.

How reliable is a Merge replication in this case? Some of the files can be up to 2GB in size. Is the replication revertible, i.e. if it fails midway while streaming the files to the other database will all the changes, caused by the replication, be rolled back?

MS SQL Merge replication

$
0
0

I am looking for solution to replicate MS SQL Server (2012 standard) database on 4 servers and so far merge replication suit most to my needs. Unfortunately once server which is a publisher is down or not accessible replication isn't working anymore. Is there any way to have more publishers/merge agents?

SQL Merge Replication - Parameterized Filters and Republishing

$
0
0

Here is my scenario:

I have a Merge publisher with articles and parameterized filter. All identity management is set to automatic and I have allocated within range of 10000000. I have 5 subscribers subscribing from this publisher, each with their own subset of data depending on the parameterized filters I have set. On initial setup everything is OK. When setting up a new subscriber to receive their own subset of data, I am faced with the following error:

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 (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199417)https://docs.microsoft.com/en-us/sql/relational-databases/replication/mssql-repl-2147199417?view=sql-server-2017

I am using SQL Standard Ed 2014 for all publisher and subscriber nodes.

I checked back to the publisher and the identity col for the articles are not sync with the last subscriber i setup so that means I have to manually manage it and run the merge agent.

Has anyone been faced with this error? How do you handle identity management if subscriber are getting their own subset of data with their own identity ids?

Thank you in advance!

SQL Server merge replication locking

$
0
0

I created a publication in my existing replication environment, all steps completed succeeded.

Now I'm facing locking problems whenever I start merge replication agent (this publication) it creates locks on the database and due to this users face time out exceptions.

Can anyone help me out how to overcome by this problem?

Thank you.

Where Merge Replication actually stores data?

$
0
0

I've read some non-official articles that say merge replication actually stores data as transactions and replicate them as transactions. But no official info about that on MSDN or any kind of official sources I could reach.

Please, can someone make it clear for me? If it stores transactions - is there any link in MSMerge_contents to the corresponding transaction? How come that it filters inserts/updates/deletes as it said here?

If it does not replicate transactions, where it stores actual data for replication?

In my own opinion Merge Replication does not use transaction log to store data.

Table triggers (MSmerge triggers) transforms each transaction in incremental generation information and stores that information in system metadata tables MSmerge_contents, MSmerge_tombstone and MSmerge_genhistory where you can join each table by tablenick and use rowguid column to find row (for MSmerge_contents and MSmerge_tombstone).

Replication Agent compares contents of MSmerge_contents for publisher and subscriber, it copy new rows and change existing depending on rowguid column and generation number of each row. It uses actual rows in actual tables, joining by rowguid. Same thing for MSmerge_tombstone table.

It does not use transaction log. It also does not even have Log Reader active.

Disabling/removing merge replication filtered article without reinitiallizing subscriptions

$
0
0

As I found from many sources, there is no option to drop/remove filtered article from merge replication without reinitializing all subscriptions.

Here is my workaround for that problem. I've tested it on test environment.

To stop merge replication from using filtered article I disabled/dropped all MSmerge triggers on both publisher and subscriber sides and also deleted row for that table in sysmergecontents on both sides. At publisher I first deleted row from sysmergecontents and then dropped triggers. At subscribers you can do it in any order.

After that, my merge replication worked good. I created snapshot, changed some filtered data on both sides - everything synced ok. No reinitializing needed.

Any arguments against what I've done?

Update: removing last filtred article caused replication to break.


SQL Server replication datatype change from tinyint to int

$
0
0

I am trying to change the datatype of one of the columns of a table which is there in the publisher by using the alter command.

And trying to see the changes done at the subscriber end of the table after running the agent. However I'm unable to see the changes.

Please guide.

SQL Replication identity conflict

$
0
0

Attached is the error i get when i tried to resolve the merge replication conflict. I have also tried sp_adjustpublisheridentityrange but to no success. the pending ids are 25501,25502 and it is on the loser side as below

enter image description here

and the error i get is

enter image description here

any help on this?

Merge Replication SQL Server 2008 R2

$
0
0

I have setup of 3 SQL Server machines (S1, S2 and S3) and have merge replication between 2 servers, S1 and S2.

Now I want to set up transaction replication between S2 and S3 for table which is merge replication between S1 and S2.

I am getting error while adding article in publication.

Automatic identity range support is useful only for publications that allows updating subscribers.

SQL Server 2014 - Merge Replication not uploading changes to distributor

$
0
0

We are using merge replication with SQL Server 2014 as the subscriber and SQL Server 2016 as the publisher and distributor. Most of the subscriptions are functioning normally. We are having an issue with some subscribers. The scenario usually involves a user on Windows 7 not replicating for a few days or attempting to replicate a large amount of data. The upload request and uploading of chunks is abnormally slow and then the merge process crashes.

Here are our standard settings:

  • DownloadWriteChangesPerBatch 1000
  • DownloadReadChangesPerBatch 1000
  • DownloadGenerationsPerBatch 1000
  • UploadGenerationsPerBatch 1000
  • UploadReadChangesPerBatch 1000
  • UploadWriteChangesPerBatch 1000

We have tried using:

  • MaxDownloadChanges 100
  • MaxUploadChanges 100
  • ParallelUploadDownload 100

We have also tried maxing out QueryTimeout and InternetTimeout and lowering the upload and download generations per batch, to no avail. The subscriber does not even seem to be trying to contact the distributor.


These are from the replmerg log. The sentence in French can be translated as “The connection with the server was interrupted abnormally”:

DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7739,  S2, :T:,100,0,0,28780,625b297f-eeec-4ee3-9866-3044b57228ce,,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7739,  S2, :T:,100,0,0,28781,1e8e2d28-542b-4083-855e-89e430a5294f,,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28814,28814,44095f3f-d332-4fa2-a1fe-18178721383a,26,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28815,28815,7a614b51-47f9-4684-b50b-a0b2459c92e1,441,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28816,28816,c86e95cf-602c-49ce-b7f8-3aeac82c8feb,13,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28817,28817,2cfa371d-4344-4f50-af6a-0e8f58216765,13,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28818,28818,44c64b16-208b-4f3e-8db2-1f91e2fd9b17,8,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28819,28819,cab0897b-0177-4814-8639-8ba26493144f,98,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28820,28820,0b36c10e-20b6-41c5-80a4-342fe5b712c7,3,,,,
DatabaseReconciler            , 2018/06/15 15:56:38.179, 5012,  7729,  S2, :T:,30,0,0,28821,28821,98572695-ed9c-492c-958b-e1cd4c59c00a,3,,,,
DatabaseReconciler            , 2018/06/15 15:57:06.097, 5012, 25578,  S2, 
INFO: [WEBSYNC_PROTOCOL] Sending client ReconcilerPhase 
WebSyncReconcilerPhase_LastRegularUpload
WinHttpClient                 , 2018/06/15 15:57:06.216, 5012,  1205,  S2, 
INFO: Exchange ID = CD83B244-6A64-4714-BACE-AA0533688A02.
WinHttpClient                 , 2018/06/15 15:59:13.095, 5012,  2514,  S1, 
ERROR: CWinHttpClient::WriteDataFromBufferToWinHttp: WinHttpWriteData failed, got error 12030.
WinHttpClient                 , 2018/06/15 15:59:13.185, 5012,  2578,  S1, 
ERROR: CWinHttpClient: La connexion avec le serveur a été interrompue anormalement, 12030
WinHttpClient                 , 2018/06/15 15:59:13.185, 5012,  2530,  S1, 
ERROR: ErrNo = 0x80042efe, ErrSrc = <null>, ErrType = 10, ErrStr = La connexion avec le serveur a été interrompue anormalement

Again, the sentence in French can be translated as “The connection with the server was interrupted abnormally”:

WinHttpClient                 , 2018/06/15 15:31:10.916, 4520,  2514,  S1, 
ERROR: CWinHttpClient::WriteDataFromBufferToWinHttp: WinHttpWriteData failed, got error 12030.
WinHttpClient                 , 2018/06/15 15:31:10.916, 4520,  2578,  S1, 
ERROR: CWinHttpClient: La connexion avec le serveur a été interrompue anormalement, 12030
WinHttpClient                 , 2018/06/15 15:31:10.916, 4520,  2530,  S1, 
ERROR: ErrNo = 0x80042efe, ErrSrc = <null>, ErrType = 10, ErrStr = La connexion avec le serveur a été interrompue anormalement

WinHttpClient                 , 2018/06/15 15:31:10.916, 4520,  2530,  S1, 
ERROR: ErrNo = 0x80042efe, ErrSrc = <null>, ErrType = 10, ErrStr = Request message processing failed during Web synchronization. When troubleshooting, restart the Merge Agent with a higher value for -HistoryVerboseLevel and check both Merge Agent and Web synchronization output log files for errors. 
DatabaseReconciler            , 2018/06/15 15:31:11.038, 4520, 20433,  S2, :T:,110,0,6,,,,,,,
DatabaseReconciler            , 2018/06/15 15:31:11.038, 4520, 20440,  S2, 
INFO: Session Highlights: FAIL, WEBSYNC_CLIENT, 
DatabaseReconciler            , 2018/06/15 15:31:11.038, 4520, 25025,  S1, 
ERROR: Failed to upload supportability data to the publisher.
CReconcilerTask               , 2018/06/15 15:31:11.154, 4520,   692,  S1, 
INFO: =============== ENDING OF MERGE ================= 

Any help would be appreciated. Thanks.

Edit:

We installed SSMS on the client's computer and have noted that the latest lines in the MSmerge_genhistory table have a pubid = null.

How do I replicate a temporal table

$
0
0

I have a temporal table, and I want to replicate it using transactional replication. The history table cannot have a primary key required for transactional replication. When I try replicating the current table, replication fails because it cannot insert into the GENERATED ALWAYS AS ROW START or GENERATED ALWAYS AS ROW END columns.

In snapshot replication, migrating publisher to a new server and using the existing snapshot replication setup

$
0
0

Existing Setup

  • Publisher : Server 1 SQL Server 2012 Enterprise hosting database 1 (500GB)
  • Subscriber : Server 2 SQL Server 2012 Enterprise hosting database 2

Database 1 replicates to database 2 using snapshot replication. This setup is working fine.

Change: I need to migrate database 1 to Server 3 and leverage the existing replication setup (with any minor changes in the configuration to tell the subscriber that the publisher database 1 has been moved to server 3)

Problem: I understand that snapshot replication leverages the LSN of the backup files and once database 1 is migrated to server 3, its LSN changes and hence snapshot replication from database 1 (server 3) to database 2(server 2) starts failing.

Is there a workaround to this?

I cannot re-setup the replication due to the file size of 500 GB is too large for the network to handle

SQL Server 2012 Merge Replication - Full Text Indexes

$
0
0

I have an issue setting up merge replication on a SQL 2012 instance.

The push of the snapshot to the subscriber is failing and the reason I discovered was because there is a SP that uses a Full Text Index that has not been generated on a table.

A lot of searching about revealed that there is a property that is false by default that defines if a full text index should be copied.

Copy Full text indexes

I thought I had found the solution, set this property to true and triggered a new snapshot, however, the same issue was still encountered and when I went back to check the property the copy full text index property was set to false again??

I have tried a few times in the hope it was just me forgetting to save or something, from what I can see, the property stays at true until the snapshot is rerun, after that the property is back at false again, I am wondering if I have come up against a bug in SQL server, however, a google does not appear to indicate this is true.

I have tried deleting and recreating the publication. I have also tried disabling the distributor and publisher in order to force a fresh distribution DB to be created, thinking that maybe there is a corruption somewhere.

Both servers are running SQL Server 2012 on Windows Server 2012R2

Does anyone have any fresh ideas?


Can you replicate a scalar valued function?

$
0
0

We use transaction replication in SQL Server 2016. In the source there is a scalar valued function which I want to replicate.

Is this possible in MS SQL Server?

When creating a publication I only see tables and stored procedures.

How to load Oracle table data from one database to another hosted in different servers without using DB links?

$
0
0

Currently, we have a working solution to replicate OLTP data to Dataware house. This job can be run multiple times in a day to load OLTP data to DWH.

OLTP and DWH are in two different database. So we are using DB links to load data across DB.

We are now planning to move to cloud platform, there are restrictions of using DB links so we have been told by our DBAs to find out a different solution to load data across DB instead of using DB links.

One of the main feature or requirement is that load should happen dynamically as it is happening in out current job. That means, job should automatically load all tables in OLTP. If any new table is added, a simple configuration update will make sure that table is replicated.

Some of the options we have explored are below.

  1. Informatica PowerCenter: Only problem is that we need to manually edit the mapping whenever a new table or columns is added.

  2. Informatica Dynamic mapping: This will take care of loading all tables in the schema but licensing cost is more.

Request you to let is know if there are any other approach used for this requirement.

One other point to be considered is that we would like to keep the control with developers than DBAs whenever any issue occurs.

Thanks

removing an object from Publication database sys.sp_droparticle and sp_dropsubscription

$
0
0

SQL Server Admin is not my forte. So please bear with while I explain this
A SQL Server 2012 cluster is involved in a Change data capture ( CDC ) effort using a 3rd party CDC utility. for it to work replication needs to be turned on, without replication CDC will not work. The CDC taps some 2000+ odd tables from SQL Server in a database Db1. Out of these we found out that some 200+ tables undergo truncate and load as against increments. So we removed those from our CDC lists but since replication is turned on at DB Level we also need to remove these from publication database so that truncates happening to this exception list wont need replication switched off DB level ( aka truncates to these tables and replication can co-exist. As its known, for truncates to happen we need to switch off replication. The code is in prod so replacing truncate by delete is not an option now besides the fact that for billion row tables deletes are going to be expensive & time consuming )
The above is the requirement. So based on that if a better solution can be conceived do let me know
What I tried :

EXEC sys.sp_droparticle @publication = 'pub', @article = 'art', @force_invalidate_snapshot = 1

Error I get

Msg 14013, Level 16, State 1, Procedure sp_MSrepl_droparticle, Line 104 [Batch Start Line 2]
This database is not enabled for publication.

Another SP

DECLARE @subscriber AS sysname;

EXEC sp_dropsubscription @publication = 'AR_PUBLICATION_00010', @article = 'BPA_BRGR_RUL_GRP_R' ,@subscriber=@subscriber

Msg 14013, Level 16, State 1, Procedure sp_MSrepl_dropsubscription, Line 55 [Batch Start Line 1]
This database is not enabled for publication.


But using GUI I am able to uncheck the tables I dont want in that publication. ( right click publication --> properties --> articles --> check /uncheck whatever you want excluded ) . I dont have any subscription just there is a publication.
Whatever code I ran through GUI above I can def. run through T-SQL But I dont know what code was it that was run ? How do I get this done using a scripting approach. I have 200+ tables to deal with and unchecking em 1 by 1 ain't helping

Change database compatibility for published database (merge replication)

$
0
0

I have 3x Sql Server 2008 R2 servers running. The first is publisher and distributor. The other 2 are subscribers. Some databases have a merge replication setup. For one of those db's I would like to change the database compatibility level from 'Sql Server 2000(80)' to 'Sql Server 2008(100)'. On the subscription servers, the target database already has the 'Sql Server 2008(100)' compatibility level. But I'm not sure if I can do that without any problems. Not from an application point of view. Application is our own. I just want to be sure that on SQL level replication doesn't brake. The publication already has the compatibility level 'Sql Server 2008 or later'.

Anybody here who has already done that?

Kind regards

Koen

Transactional replication data

$
0
0

I have this error when i try to implement transactional replication.

TITLE: New Publication Wizard

SQL Server could not create publication 'AWK2017'.


ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)


The Publisher 'REPLIDATA3' does not exist. To view a list of Publishers, use the stored procedure sp_helpdistpublisher. Changed database context to 'AdventureWorks2017'. (Microsoft SQL Server, Error: 21618)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=14.00.3037&EvtSrc=MSSQLServer&EvtID=21618&LinkId=20476


BUTTONS:

OK

Viewing all 17268 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>