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

MySQL replication slave hangs after encountering SET @@SESSION.GTID_NEXT= 'ANONYMOUS';

$
0
0

I recently installed two identical default installations of MySQL 5.7 under Ubuntu Server 16.04, and configured them to do a binary log replication. Until now this has been working fine, but suddenly the replication stops continuing and the slave query thread runs at 100% CPU without doing any work.

After some searching I found that the slave status tells that it is way behind master. Using mysqlbinlog on the binlog file indicated by Relay_Master_Log_File and position Exec_Master_Log_Pos, I found out that the statement executed at this position is:

SET @@SESSION.GTID_NEXT= 'ANONYMOUS';

Somehow the slave hangs when trying to execute this statement, sending the CPU load to 100% (which is how I discovered the situation in the first place).

Except by having the slave skip that statement using SET GLOBAL sql_slave_skip_counter=1 it is unclear to me what is the actual cause of this issue, and how I should solve this.

Any help would be really appreciated!


rows deleted in the subscriber - what to do? - transactional replication sql server

$
0
0

someone has delete by mistake a row of a table in the subscribed server/database.

I am getting the following error message:

The row was not found at the Subscriber when applying the replicated (null) command for Table '(null)' with Primary Key(s): (null) (Source: MSSQLServer, Error number: 20598)

Now I have restored the deleted row in the replicated server, but the distributor to the subscriber agent is taking so long to apply the changes (currently nearly 1.5 hours).

How can I make it do this update immediately?

enter image description here

How can I remove a channel from replication slave?

$
0
0

Today my question is about MySQL replication cleanup.

I used mysqldump with the --master-info --all-databases tag and restored it to a new host to be used as a replication slave.

After restore, I see some artifacts of slave information from the master. This is the third host in a replication chain.

I issued reset slave for channel 'xxxxx'; which returned Query OK, 0 rows affected (0.00 sec). When I later query using show slave status for channel 'xxxxx';, I still see information for this replication channel appearing.

How can I cleanup this replication channel such that it never accidentally starts, as well as cleanup the output of show slave status \G to only show the intended replication channel?

Mysql replication, error 13 (permission denied) with slave_load_tmpdir

$
0
0

I've setup a virtual machine on Azure with Ubuntu 16.10 and Mysql 5.7 for a database replication Master/Slave from another server.

I followed this article: https://www.opsdash.com/blog/mysql-replication-howto.html

All seems to works correctly, replication works but I've serious problems with the use of DATA LOAD INFILE. If I use this command, the replication doesn't works.

I tried with relative varible "slave_load_tmpdir", creating a new directory '/var/slavetmp' and updating my.cnf with these values, but this is the error in mysql with "SHOW SLAVE STATUS":

Unable to use slave's temporary directory /var/slavetmp - Can't read dir of '/var/slavetmp/' (Errcode: 13 - Permission denied)

Have any ideas?

Thanks in advance

Re-initializing a transactional replication wihch was initially synced from backup

$
0
0

I have a transactional replication which was initially synced from backup. Now I need to add a new table which is really big so we have decided to backup and restore a fresh copy of the db to subscriber to re-intializing it.

My question is, in this scenario should I be dropping the subscription, backup restore and then re-add the subscription? is that the correct way or is there any other way of going about it?

Thanks

SQL Server 2016 very slow snapshot generation

$
0
0

We've faced such a problem after migrating from SQL Server 2008 to SQL Server 2016: there's a merge replication implemented and it takes up to 2 hours (!) to generate a snapshot, instead of 5 minutes like it was before the upgrade.

We've tried to increase MaxBcpThreads, have changed the agents' parameters- but nothing from that seems to help. Would be glad to hear any kinds of solutions.

SQL 2008 R2 Merge Replication - Clearing Skipped Schema Changes

$
0
0

A developer made a change to our production database that is using merge replication to a table (Activity). That table has a Foreign constraint that points to a table that is not part of replication and does not exist at the replicated database. This broke replication. To get replication up and running, I used the sp_markpendingschemachange procedure to skip the schema changes. This worked, but now I am left with the records still in the sysmergeschemaarticles table, just marked skipped. At this point, I want to get rid of the records so they get executed in the future.

My solution is to perform a snapshot (at a less busy time) assuming that the this will clear the sysmergeschemaarticles table of any ddl changes but have not found any supporting documentation to support this. Anyone have an experience with this type of situation that can support this solution or propose a new better one?

Thanks!

Merge replication - sp_MSadd_merge_history90 is called many times and takes long time in total

$
0
0

I'm investigating a random long replication issue. SQL version is 2008 sp4 and we use merge replication with pull subscription. When I run replmerg.exe with verbose logging, I found out that sp_MSadd_merge_history90 is called so many times and taking lot of time aggregate.

  • Distributor-side History Logging Time = 42557 msec.
  • Number of Distributor-side History Messages Logged = 67
  • Subscriber-side History Logging Time = 21999 msec.
  • Number of Subscriber-side History Messages Logged = 67

Total session stats

  • Change Delivery Time: 31 sec
  • Schema Change and Bulk Insert Time: 4 sec
  • Delivery Rate: 5.94 rows/sec
  • Total Session Duration: 59 sec

I'm not able to track down why history logging is so slow even with the profiler running. Also, I'm not sure if I'm going against the right thing or I'm missing something. I would have attached entire log but not sure how to attach it here.


sql merge replication trace

$
0
0

Dear all as i am using SQL merge replication in OLTP environment in which there is about 2 publishers and 28 subscribers. One row has been replicated from one subscriber to another subscriber.

i just wanna trace its time of replication. can any one help me out how can i trace its date and time of replication.

SELECT *  FROM [subscriber2].[Databae_name].[schema_name].book_rack c WHERE book_no = ABCDEF
UNION all
SELECT *  FROM [subscriber1].[Databae_name].[schema_name].book_rack c WHERE book_no = ABCDEF

SQL merge replication - Violation of PRIMARY KEY constraint on download only table

$
0
0

Recently some synchronizations have been failing. The last message shown in the replication monitor and in their local replication logs is:

The process is waiting for a response from the query '{call sys.sp_MSinitdynamicsubscriber(?,?,?,?,90,1,0)}'

On at least some of our subscribers, before receiving the dynamicsubscriber message one of the following errors occur:

The merge process is retrying a failed operation made to article 'myTable' - Reason: 'The merge process was unable to synchronize the row.'.

or

The merge process is retrying a failed operation made to article 'myTable' - Reason: 'Violation of PRIMARY KEY constraint 'PK__myTable__7DADF02A8A30D649'.

'myTable' is marked as "download only". Any idea how we are getting PK violations on a download only table?

Some subscribers with this issue eventually get a successful sync. It usually takes an abnormal amount of time. The vast majority timeout.

Additional Info: We are using sql merge replication with pull subscriptions. We use filters to keep data separate among users. We do not 'Automatically generate snapshots'. I've tried to reinitialize the subscription. Also tried removing the subscription and their local database. The agents QueryTimeOut is set to 36000. Some users have synced as long as 5 hours without resolve.

Migrate replication from SQL Server 2008 R2 to SQL Server 2016 - Old to new hardware

$
0
0

I will be working on a project shortly that would involve moving the replicated databases off of old to the new SQL Server instance. I haven't done this in the past so I don't have much knowledge either on how to move ahead except to do some research.

As of this date our current config sits on a Windows 2008 R2 server with SQL Server 2008 R2 and publisher along with the distributor is the same SQL Server instance e.g sqla and the subscriber is sqlb and also now sqlb is acting as a publisher and distributor for sqlc... these are all pull subscribers with one way transactional and snapshot replication.

Now, back to my original question. Is there a way to migrate the databases off of the old to the new with least downtime so I don't have to script out and reinitialize subscriptions as it would take a lot of time (that's what most of the people mentioned on google). Do we have any hacks or tricks to make this work without causing problems or if there is any step by step to work it out even if we use script method.

SQL Server Replication: insert on subscriber not working

$
0
0

I have some merge replications with Microsoft SQL Server 2014 as distibutor and subscriber. All replications are on the same database. I replicate several articles and the error happens in every article. I use PUSH replication. The configuration of the articles is like

  • Automatically manage identity range: Automatic
  • Publisher range size: 1000000
  • Subscriber range size: 100000
  • Range threshold percentage: 80
  • Identity increment: 1

The datatype of the column is INT or BIGINT. Some articles are filtered by an integer column and the filter is like WHERE ([column_name] & 1) > 1 for the first replication or WHERE ([column_name] & 2) > 1 for the second replication and so on.

Sometimes if I insert a new dataset on subscriber I get the error

Error Number: 547 Sererity: 16 State: 0 Message: statement conflicted with CHECK-Contraint 'repl_identity_range_*'. The conflict occurred in database *, table 'dbo.***', column 'id'.

The Contraint is checking the ID that is managed by merge replication. The next insert is running fine even if there is a shor time span 30 seconds between the inserts.

If I run the query

select * from MSmerge_identity_range_allocations 
where publication = 'PUBLICATION NAME' and article = 'TABLE NAME'

I can see that value of the column time_of_allocation is the same than the error of the insert happens.

For me it looks like the subscriber is not allocation a new identity range if the threshold percentage is full used. Anyone a hint how to solve this problem?

If you need more information feel free to ask :-)

Merge replication Problem

$
0
0

I have got some problem to implement Merge Replication in SQL server 2008 R2 which send me the error response at the time of Synchronization using PULL from Publisher. I have tried to solve the problem by Stopping Merge Agent from JOB in sql server, Restart SQL Server Agent services, from Sql Server Agent JOB history i have again tried to restart specific Merge JOB agent but i have got still same problem which Show in below error :enter image description here

After that when i forcefully tried to start above synchronization process then another error message shown which is below :enter image description here

Can you please help me to resolve this issue in SQL server. ​

Merge replication Identity columns for already existing databases

$
0
0

I'm attempting to setup merge replication with Pull subscriptions (SQL Server 2014 for Subscribers and 2016 for the Publisher). I have a number of databases at remote sites which operate independently, and have been operating independently for years, and we have never had a central server (Publisher) where all remote site data rolls up.

The database schema is essentially the same at all sites (it's the same application after all). What this also means is that, since all DBs have been operating independently, there is definitely going to be duplication of values for Identity columns between Subscriptions (though the actual row data itself will be site specific). Say, Subscriber A Table X has ID column 25 with row data (a,b,c,d) and Subscriber B Table X has ID column 25 with row data (e,f,g,h).

I've been reading up on automatic identity range management, etc., which is all fine if I'm setting up brand new subscriptions. However, here I am inheriting a bunch of Subscriber databases and I have to setup replication so that the data is aggregated at a central location. Which means I am inheriting duplicate identity column values across subscribers. Auto range management is fine for new rows, but I'm not sure what is the best way to manage the identity conflicts that come with the existing databases.

Any help will be greatly appreciated!

Regards, Vikram

Is it possible to ignore NOT FOR REPLICATION in Visual Studio's Schema Compare?

$
0
0

I have two environments: dev and test. Dev has a single SQL instance. Test has three which use merge replication.

When I use Schema Compare between dev and test, every table is always flagged as different because the tables in Test have a few replication artifacts:

  • A generated unique ID for replication: [rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [MSmerge_df_rowguid_DDDF85B24558D414B8FD278B2219C33A]
  • The primary key marked as NOT FOR REPLICATION (I see there is an option to ignore this in the General tab in Schema Compare Options)
  • CONSTRAINT [repl_identity_range...] that requires the primary key be within the range assigned to that instance

Is there a way to ignore the rowguid column and the repl_identity_range_... constraint when running a schema compare?


Sync data from local db to Central SQL Server

$
0
0

I have a requirement to sync local db data with central SQL server. The remote users (mostly around 10 people) will be using laptop which will host application and local db. The internet connection is not 24x7. During no connectivity, the laptop user should be able to make changes in local db and once the connection is restored, the data should be synced with central SQL server automatically. The sync is just usually data updates. I have looked at options Sync framework and Merge replication. I can’t use sync framework as I am not C# expert. For Merge replication, additional hardware is required I believe which is not possible. The solution should be easy to develop and maintain.

Are there any other options available? Is it possible to use SSIS in this scenario?

SQL Merge Replication DR Planning

$
0
0

In a proactive approach I'm planning to make a database Disaster Recovery environment.

I have set a environment with this structure:

  • Database1: Publisher
  • Database2: Subscriber of Database1 + Publisher of
  • Database3 Database3: Subscriber of Database2

All databases are on different physical machines in different locations: All databases have 5 different publications named Pub1, Pub2, Pub3, Pub4, Pub5

I just dropped a Subscriber (Pub3) on Database3

What will be the best approach to restore dropped subscriptions?

  1. Each publication have more than 200 tables and database size is almost 800GB.
  2. Each Database is on different location & Machines (Network Involved)
  3. Having very Short Recovery Time

Replicate trigger on subscriber in merge replication of SQL Server

$
0
0

I have deployed 1 subscriber and 1 publisher server in merge replication configuration of SQL Server. I added a table along with a trigger on that table on publisher and want to replicate that table and trigger on subscriber. I have set 'replicate schema changes' and 'copy user triggers' to true but still the trigger is not replicated on subscriber.

How can I solve the problem?

Sync databases without changing database structure

$
0
0

I have two databases on different physical locations. Both databases have the same structure and will remain the same. I need to sync data between the two databases (both ways). Merge replication is out of scope because it adds columns to the published articles, which causes errors in the vendors software. I want a solution which will sync data bidirectional, without any changes in the database structure (schema). Can you suggest such solutions?

EDIT PEER TO PEER Peer to Peer Transactional Replication is also out of scope because some of the tables (which needs to be synced) contain TIMESTAMP columns.

Disaster recovery planning for existing merge replication environment

$
0
0

In a proactive approach I'm planning to make a database Disaster Recovery environment.

I have set a environment with this structure:

Database1: Publisher Database2: Subscriber of Database1 + Publisher of Database3 Database3 Database3: Subscriber of Database2 All databases are on different physical machines in different locations: All databases have 5 different publications named Pub1, Pub2, Pub3, Pub4, Pub5

I just dropped a Subscriber (Pub3) on Database3

What will be the best approach to restore dropped subscriptions? by keeping in mind that 1. Each publication have more than 200 tables and database size is almost 800GB. 2. Each Database is on different location & Machines (Network Involved) 3. Having very Short Recovery Time

Viewing all 17268 articles
Browse latest View live


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