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

Duplicate key inserting row to subscriber

$
0
0
Greetings, have transactional replication set up and has been working for over a year now. Publisher and distributor on same SQL 2008 R2 with the publication database still 2000 (all in the process of upgrading). Multiple subscribers, they are 2008 R2 servers and databases. A publication was added 4 months ago, has 3 tables in the publication, 2 type tables and one detail table, the details table has been adding rows from the publisher to subscribe since it was set up, no problem. Yesterday we inserted a row into one of the type tables on the publisher and started getting an error "Error executing a batch of commands. Retrying individual commands. Violation of PRIMARY KEY constraint Cannot insert duplicate key in object" and the undistributed commands started piling up. Eventually I initialized this subscription to "fix" it and get the row over there. I have a test environment set up and I am getting the same error there when I go through the same steps.  Its a simple insert statement, table has a primary key of a char(1) and another column char(60). if I insert the row to the publisher it works fine on the publisher, but it gets a dup pk on the subscriber and the row is not there on the subscriber when I run a select. Ultimately the distribution agent gets hung up with the "Error executing a batch of commands" and "Violation of PRIMARY KEY constraint Cannot insert duplicate key in object" and continues retrying. I can run a trace and see all this on the subscriber, I am at a loss where else to look to resolve. It seems a straight forward error, any suggestions? Thanks.

Controlling SQL Server Replication using Powershell

$
0
0

Hi,

I have a Powershell script to refresh the databases

My requirement: 

I have a database which has replication in it. I used powershell to generate replication scripts and refreshes the database with another backup copy. After refreshing, I need to start the snapshot agent. 

How do I start the snapshot agent after refresh using powershell ?

Is it possible to monitor the replication synchronization using powershell ?

My ultimate goal is not to use Management studio, so that I can automate the nightly refresh process using powershell itself. 

Please advise. 

Applying snapshot not working (generation batches)

$
0
0

Hi

I have a filtered publication setup on a database and I am looking to setup a new subscription on a brand new PC. I am able to create the new subscription on the new PC and generated the required snapshot - a full snapshot first and then one for the data partition due to the filters on the publication. Filters on the publication include only pulling down data to the new subscriber for the last 1 month.

When I then go to apply the snapshot onto the new subscription, it will get so far and then start to run through generation batches and will go as high as 91k before then timing out. It appears as if the snapshot is not being applied correctly, is there something I am doing wrong?

I have setup replication for other databases during the years and never experienced this same issue.

Any help would be greatly appreciated.

Merge Replication Issue

$
0
0

We have configured Merge Replication on SQL Server 2014 (SP3-CU4)

Publisher and one Subscriber.

Everything working fine but after 2 hours ,we identified  4 tables at Subscriberside the date and time fields are automatically changed to Varchar(16). But publisher side everything looks good.

Look like it's strage to me. 

Data consistency in Merge Replication

$
0
0

We have confifured Merge Replicatioin on SQL Server 2014 Ent With Sp3-CU4 (Both Publisher and Subscriber on Same Version)

After replication i compared rows in each and every table. But some of the data was not copied to subscriber. Missing data in few table almost empty.

Snapshot agent was worked fine and no issues found.


How can a sql distribution sever use a database in an availability group?

$
0
0

Hi,

The requirement is for a database already in a sql availability group to be replicated via a distribution server to a subscription server.

The data flow is: db in AG to distributor to subscriber...

How in principle can this be done?

Merge Replcation between SQL versions 10.5 and 14.0

$
0
0

Having successfully configured merge replication between a number of SQL version 12.0 SQL Express databases and a SQL 14.0 server, hosting the respective distributor databases, I have run into a problem with the final database (which is SQL Version 10.5). The first thing that I noticed was that when the SQL Express backup was restored to the SQL version 14.0 server, an upgrade process occurred, which I did not see when restoring restoring 12.0 databases.

The were no problems creating the merge publication but there was an error when attempting to create the subscription for the SQL version 10.0 database. When the Subscription Wizard attempted to connect to the subscriber database, the following error occurred.

Invalid object name 'sys.availability_group_listeners'. (Microsoft SQL Server, Error: 208)

The SSMS has no problem connecting to the SQL 10.5 database from the SQL 14.0 server, so I assume that this is not a basic connection error, but more related to something that the Subscription Wizard attempts to immediately after connecting.

I think that I probably need to upgrade the the SQL 10.5 SQLEXPRESS to at least SQL 12.0, but before I do that, I would like to see whether this is actually necessary.


R Campbell

Uninitialized Subscription

$
0
0

Dear All

 I  created new publication and new subscription, it created successfully with no errors. When i go to server subscription and  clicked start in the 'View sync status's OK

But when i go to publication->My Publishers->Server Publisher->Status->OK and i clicked on  subscription Watch List says Uninitialized subscription. i look back to server subscription server and no see stored procedures.

Please kindly check below my attachment. 








SQL Server Transactional Replication causing the CPU spike

$
0
0

We are having an application which is a wrapper of SQL Server Transnational Replication containing only tables. The application creates all the articles, publications, subscriptions and implement the pre and post snapshot scripts.  We have deployed the same in one server which is the Distributor and the publisher (SQL Server 2017). Subscriber is another server. CPU rises when the replication runs and also because of the log reader agent causing the Tempdb contentions.
The cleaning job is running and keeping up to date. Immediate_Sync is off. Allow SnapShot Isolation and Is Read Committed Snapshot On is True.

Publisher/Distributor configuration:Memory: 432 GB, Windows Server 2016, SQL Server 2017         

Subscriber : Memory 256 GB, Windows Server 2016, SQL Server 2017

Please note that the publisher  contain around 200 other databases as well.

There is enough free spaces in the servers.

Can somebody please help me to figure out the issue?

Thanks & Regards,

Anitha John


Configure distributor - Transactiopnal replication.

$
0
0

Hi Folks 

I have configured a transactional replication of a database in instance. 

1. Publilsher and distributor is the same server with PUSH subscription.

2. Replication is working fine. 

3. Coordinated backups configured with help of https://docs.microsoft.com/en-us/sql/relational-databases/replication/administration/enable-coordinated-backups-for-transactional-replication?view=sql-server-ver15

4. Replication and Backups are working fine.

I am having issue now logs of published database isn't being truncated. Backups are via MSDPM. I can see replication is going fine, backups of database file and logs is successful. I have 2 questions. 

Q. 1 - What should be recovery model of distribution database in this case. This has grown to large with SIMPLE recovery model. 

Q. 2 - Why logs of published database are not being truncated with coordinated backups which is backing up fine. 

Thanks


Snapshot generated but not consistently applied to all subscribers on Publication with Shared Distribution Agent (SQL 2017)

$
0
0

Recently, after adding articles and refreshing the subscriptions, the snapshot will generate and then not apply to one or all subscribers.  I am adding 12 articles to a publication that shares an agent with five other publications.

The message for the distribution agent will read :

The concurrent snapshot for publication 'Pubwithsharedistagent' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted, the Snapshot Agent 

After the distribution agent runs three or four more times, that message disappears and the snapshot folder is deleted.  The articles are added to replication and when the first transaction is replicated it fails with the message that the replication proc doesn't exist. 

I tried just adding one article and it applied to both subscribers.  I also tried adding only those articles with rows and the snapshot applied to one subscriber but not the other.



David z

Maximum request length exceeded sql2017

$
0
0

SQL Server 2017 Reporting Services © 2017 Microsoft Version14.0.600.1274(October 2017)

There was an exception running the extensions specified in the config file. ---> Maximum request length exceeded.

where is the config file so that I can change this setting?


???

Transaction replication : Distribution clean up: distribution failed

$
0
0

Hi I am replicating transaction replication  2014 to 2016 . I am having error with "Distribution clean up: distribution" agent job as follows.

Msg 20015, Level 16, State 1, Procedure sp_MSreplremoveuncdir, Line 92
Could not remove directory '\\networkshareTES\unc\PUB\20191002105458\'. Check the security context of xp_cmdshell and close other processes that may be accessing the directory.
Replication-@rowcount_only parameter must be the value 0,1, or 2. 0=7.0 compatible checksum. 1=only check rowcou: agent distribution@rowcount_only parameter must be the value 0,1, or 2. 0=7.0 compatible checksum. 1=only  scheduled for retry. Could not clean up the distribution transaction tables.

++++++++++++++++++++++++++++++++++++++

Work around I did as follows

1. 

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE WITH OVERRIDE

2. Jobs running with "distributor_admin" . But I tried it manual cleaning with my access "elevated user" and still failed

use distribution
go
EXEC dbo.sp_MSdistribution_cleanup @min_distretention = 0, @max_distretention = 72. 

any one can advise on this please 

snapshot is not applied to both of the two subscribers

$
0
0
We have six publications that have a shared distribution agent.  When articles are added to one of the six publications and the snapshot is created, the snapshot is not applied to both of the two subscribers.  It is sometimes applied to one subscriber but not the other, sometimes both, sometime neither.

The agent has this message:
The concurrent snapshot for publication 'EnterpriseToDist04' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted, the Snapshot Agent for t

Kiran

Replication vs. CDC

$
0
0

I have basic understanding of both replication and CDC processes in SQL Server and I have come to wonder what is the difference between these two? I mean both use transaction logs to apply changes from server A to an external server B. What are the pros of using one over another?

Also when would one need to enable both in a database?

Thanks,
KK 


Error 55012 when running the snapshot.

$
0
0

I'm trying to set up a snapshot replication. When i run the job creating a snapshot I get an error:

Message
2019-10-30 13:01:59.57 Microsoft (R) SQL Server Snapshot Agent
2019-10-30 13:01:59.57 [Assembly Version = 15.0.0.0, File Version = 15.0.1900.25]
2019-10-30 13:01:59.57 Copyright (c) 2016 Microsoft Corporation.
2019-10-30 13:01:59.57 The timestamps prepended to the output lines are expressed in terms of UTC time.
2019-10-30 13:01:59.57 User-specified agent parameter values:
2019-10-30 13:01:59.57 --------------------------------------
2019-10-30 13:01:59.57 -Publisher DB100
2019-10-30 13:01:59.57 -PublisherDB REF3_DB
2019-10-30 13:01:59.57 -Publication REF3_PDR4
2019-10-30 13:01:59.57 -Distributor DB100
2019-10-30 13:01:59.57 -DistributorSecurityMode 1
2019-10-30 13:01:59.57 -XJOBID 0xA694274CD89FAF418C8B059F22C01B85
2019-10-30 13:01:59.57 --------------------------------------
2019-10-30 13:01:59.57 Connecting to Distributor 'DB100'
2019-10-30 13:01:59.62 Parameter values obtained from agent profile:
2019-10-30 13:01:59.62 ---------------------------------------------
2019-10-30 13:01:59.62 -BcpBatchSize 100000
2019-10-30 13:01:59.62 -HistoryVerboseLevel 2
2019-10-30 13:01:59.62 -LoginTimeout 15
2019-10-30 13:01:59.62 -QueryTimeout 1800
2019-10-30 13:01:59.62 ---------------------------------------------
2019-10-30 13:01:59.62 Validating Publisher
2019-10-30 13:01:59.62 Connecting to Publisher 'DB100'
2019-10-30 13:01:59.64 Publisher database compatibility level is set to 150.
2019-10-30 13:01:59.64 Retrieving publication and article information from the publisher database 'DB100.REF3_DB'
2019-10-30 13:01:59.64 [0%] Locking published tables while generating the snapshot
2019-10-30 13:01:59.65 [0%] The replication agent had encountered an exception.
2019-10-30 13:01:59.65 Source: Replication
2019-10-30 13:01:59.65 Exception Type: Microsoft.SqlServer.Replication.ReplicationAgentException
2019-10-30 13:01:59.65 Exception Message: An unspecified error had occurred in the native SQL Server connection component.
2019-10-30 13:01:59.65 Message Code: 55012
2019-10-30 13:01:59.65

There seems to be no help whith this issue… please can anyone help me. 

SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name (Replication.Utilities)

$
0
0

Canot create subscription

Please help me

I get the error code is:

TITLE: Connect to Server
------------------------------

Cannot connect to 89.19.13.138.

------------------------------
ADDITIONAL INFORMATION:

SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name, '94DE80ACD308'. (Replication.Utilities)

------------------------------
BUTTONS:

OK
------------------------------

PLEASE CHECK THIS LINKS

my server info : http://www.tolgasimsek.com/11.jpg

and

error screen : http://www.tolgasimsek.com/22.jpg


SQL Replication groups in Windows failover clusters

$
0
0

Hello Guys, 

I have a scenario where there is a Cluster of 2 Windows servers that have SQL Standard. Between those servers is a replication, and we need to use replication groups for each database, what is the best scenario and is it better to use DFS replication or sql replication?

Thank you in advance

Question on Rebuilding existing DB Replication to New Servers

$
0
0

Fellow SQLers.

I am looking for some suggestions for this scenario.

We have Server A on SQL 2008 R2. It has the db and distributor. Server B is the subscriber - also on SQL 2008 R2.

We need to migrate the main database on SQL 2008 R2 to SQL 2016. Pretty much start over because we are having to change the db collation as well. yes, Subscriber will be on SQL 2016 as well. Yes, a mixed bag here.

Our focus was the best way to deal with setting up replication again.  I am not planning on migrating the subscriber db because it too has to have the new collation. We believe it is likely best to just start fresh.

My first thought was when we copy the table schemas to the new box, before I transfer the data, I would think I would set/make sure the tables/scripts are NOT part of replication so I can rebuild the replication model from scratch (or maybe use a script from Server A's replication to help kick start this after the transfer is done)

Is this approach reasonable?

MG





Scripting Out replication Publication/Subscription - and SQL agent jobs

$
0
0

Fellow SQLers

I am needing to rebuild a SQL 2008 R2 replication model onto SQL 2016 - same exact pubs and subs.

My approach was scripting out the publication and scripting out the subscription.

Then changing the server info in each of the scripts.

But, I do not see the agent jobs being inside these system generated scripts.

I am interpreting that I would need to script out each of the replication SQL Agent jobs manually and make the server name changes inside.

Am I missing something on generating scripts for SQL Agent or should they be included when I created the publisher script?

Thanks,

MG

Viewing all 4054 articles
Browse latest View live


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