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

Msg 14074, The server ‘%s’ is already listed as a Publisher

$
0
0

My question is what should I do when I get this error

The server '' is already listed as a Publisher

I already have a replication going on for another database between two servers. I am trying to replicate another db by creating another publication and subscriber. What should I do to setup TR for another db by adding new publisher and subscriber.

Command to add publisher that I am using is:

EXEC sp_adddistpublisher @publisher = @@ServerName,
         @distribution_db = N'distribution',​
         @security_mode = 0,
         @login = N'',
         @password = N'',
         @working_directory = N'',
         @storage_connection_string = N'';

Is this way is right then please guide me for my mistakes and if not then please explain in brief What should be done to successful TR setup.


Cannot drop the distribution database 'distribution' on managed instance

$
0
0

I am not able to delete the distributor and distribution database because it is saying that it is currently in use on Azure Managed Instance.I tried transactional replication between azure managed instance to azure sql vm. Then I was trying to delete replication ,publisher,subscriber and distributor.I was successful in dropping replication,publisher and subscriber but my distributor is not getting deleted. I am trying to do:

exec sp_dropdistributor @no_checks = 1, @ignore_distributor = 1

Then I got this below statement as error:

Msg 21122, Level 16, State 1, Procedure sys.sp_dropdistributiondb, Line 125 [Batch Start Line 6]

Cannot drop the distribution database 'distribution' because it is currently in use.

I even tried to disable distributor using Disable publishing and distributor wizard.The process was unsuccessful. What steps should I now follow to delete my distributor?

How to give permissions to the server to access the publication in ssms?

$
0
0

I am trying to setup transactional replication between azure managed instance and azure sql VM through SSMS tool.I successfully configured distributor and publisher but while configuring subscriber it is showing me some error.

The error says:

There are no publications to which you can subscribe, either because this server has no publications or because you do not have sufficient privileges to access the publications.

Please Guide me on how to resolve this error so that I am able to configure subscriber for replication.

Indexing with transactional replication snapshot

$
0
0

Is there a way to set up a database table structure and indexes on a replication subscriber prior to running the snapshot agent in order to skip having to add the indexes AFTER the snapshot has been applied on the subscriber?

The reason for asking is that we have an almost unindexed database as publisher that we are going to replicate to a subscriber and have the data indexed in order to get faster lookups of the data. The database itself is around 2TB so applying the indexes takes pretty long to apply afterwards.

SQL Replication Subscriber job throws error

$
0
0

Sql subscriber job throws 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.

Have created the replication process in same server in different DB,While running the subscriber job the above error occurs.Several Table schema has been moved to new db and while moving the table structure the error occurs

how to autogen the replication trigger procedures as part of creating a new table article

$
0
0

I have an internal transactional replication question as to how to get the replication trigger stored procedures (insert/update/delete) to be automatically created in the subscription database when adding a new table article to an existing transactional replication publication via T-SQL. (mini-snapshot method, avoiding full publication syncronisation)

I create the article and subscription as the T-SQL code below, but I always end up having to manually create
the replication trigger stored procedures it relys on, in the subscription database with sp_scriptpublicationcustomprocs @publication = 'myPub' - they don’t automatically get created in the subscriber db.

Is there a option I am missing/adding here preventing this happening as part of adding the new table article/subscription? Thanks.

-- add the article on the publisher db
use [myDB];
exec sp_addarticle @publication = N'myPub', 
@article = N'myTable', 
@source_owner = N'dbo', 
@source_object = N'myTable', 
@type = N'logbased', 
@description = N'', 
@creation_script = N'', 
@pre_creation_cmd = N'none', 
@schema_option = 0x0000000000030073,
@identityrangemanagementoption = N'manual', 
@destination_table = N'myTable', 
@destination_owner = N'dbo', 
@status = 16, 
@vertical_partition = N'false', 
@ins_cmd = N'CALL [dbo].[sp_MSins_dbo_myTable]', 
@del_cmd = N'CALL [dbo].[sp_MSdel_dbo_myTable]', 
@upd_cmd = N'CALL [dbo].[sp_MSupd_dbo_myTable]'
GO

-- then add the subscription

use [myDB];
exec sp_addsubscription @publication = N'myPub', @subscriber = N'subscriberServer', @destination_db = N'Replicated_myDB', 
@subscription_type = N'Pull', 
@sync_type = N'none', 
@article = N'myTable', 
@update_mode = N'read only', @subscriber_type = 0
GO

-- restart the snapshot agent
exec sp_startpublication_snapshot @publication =  'myPub'


Does ordinal position of columns matter for SQL Server replication

$
0
0

I am setting up replication on SQL Server 2017. Transaction replication with push subscriptions such that many smaller database are replicated into a single larger database for reporting.

The snapshots wouldn't initialize for some tables in some databases because of "field size too small" errors. The tables had the same "schema" in that they had all the same fields with the same datatypes and primary key. However, the ordinal position of the columns varies for some of the tables in question between databases. I think the snapshots wouldn't initialize because the bcp command it uses expects the tables' columns to be in the same order.

Two questions:

  1. Can anyone confirm that the the ordinal position matters for replication as far as snapshots initializing goes? It makes sense to me that it would but I can't find anything that says that it does explicitly.
  2. If I initialize the subscription manually (allowing me to skip the snapshot initialize step) would replication work with the ordinal position of the columns being different for the tables but the tables otherwise being identical? Is this supported or do I need to reorder all the columns to make sure they are the same?

Why does sp_replmonitorhelpsubscription not work without parameters?

$
0
0

I am just starting to play around with all the cool replication tools to Programmatically Monitor Replication

One of the early finds is sp_replmonitorhelpsubscription

When I run it as

 sp_replmonitorhelpsubscription

I get

Msg 20587, Level 16, State 1, Procedure sp_replmonitorhelpsubscription, Line 77 [Batch Start Line 16]

Invalid '@publication_type' value for stored procedure 'sp_replmonitorhelpsubscription'.

According to MS documents it should be valid with a null default

NULL (default)

If I run it with the Parameter it works fine.

sp_replmonitorhelpsubscription  @publication_type = '0' 

I using it with transactional replication, on a single server (Reporting Copy) I have tried and I get the same results on SQL 2017 & 2016. I am running it against the distribution database

Not sure If I am doing something stupid, if the MS docs are wrong, or what.

Why does sp_replmonitorhelpsubscription not work without parameters?


RAISERROR when replication falls behind

$
0
0

I have a third party incident management tool, that creates tickets from errors in the SQL logs.

Occasionally replication stops replicating without creating errors in the SQL logs.

I want to create a job that runs every 10 minutes or so to check on replication and then uses RAISERROR to start our ticketing (and alerting) process.

There are a number of stored procedures to Programmatically Monitor Replication that will show issues, and there is also a pretty good solution at Monitoring Transactional Replication in SQL Server(by Francis Hanlon 11 April 2013) that is good start on what I want. But would need to be tweaked a bit to meet my needs. Before I start reworking Francis's solution I am wondering if there are any other solutions I might leverage on.

I have searched around here and google, and Francis's solution is the only one I found that gets close to inhouse monitoring, without new third party tools.

Are there any solutions to monitor SQL replication real time with T-SQL?

  • SQL 2008 to SQL 2019
  • Mostly transactional replication
  • Same AND cross server replication

If the slave is empty (it crashed and got deleted), can i restore it using the most recent master mysql dump without restarting the master?

$
0
0

My slave server db got empty and stopped working, can i restore it using the latest mysql dump from the master and start it again? Or is it necessary to restart the master (so that a new binlog file gets created) and make a fresh new copy of the master database?

kafka is not electiong new leader after 2 nodes are down

$
0
0

we test scalein in enviorment with 3 kafka nodes each one has a broker and zookeeper service on in the replica.factor=2 after the service went down on 2 nodes the leader of the partition stayed the old one and didnt movve to the only node that is up

and a a error message is sent

Error: partition 0 does not have a leader. Skip getting offsets Error: partition 2 does not have a leader. Skip getting offsets Error: partition 3 does not have a leader. Skip getting offsets

why this could happen?

here you can see how the leaders stayed even though there is replica set

Transactional Replication - How to validate schema level objects

$
0
0

I have setup transactional replication to replicate data from one SQL server to another. I validate the data/tables I have the options of using the tablediff tool and the publication validation stored procedure shown here

https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-publication-validation-transact-sql?view=sql-server-2016

The issue I am having is both of these tools state that schema level objects like stored procedures are not validated. I am struggling to find a method or tool that can validate these schema level objects.

Can anyone help?

Mongos router for MongoDB Sharding cannot start?

$
0
0

I'm setting up MongoDB Sharding. I have configured 3 Config Servers and 2 Shard Servers (each with 3 nodes) and one mongos router. They are all running on separate VMs

For some reason my mongos router not working properly. My mongod.conf looks like this

systemLog: destination: file
 logAppend: true
 path: /var/log/mongodb/mongod.log 
net:
 port: 27017 
 bindIp: 192.168.2.111 
sharding: 
   configDB: ConfigReplica/configsvr01:27019,configsvr02:27019,configsvr03:27019

when I'm trying to restart MongoDB service after changes what I made in the config file I'm getting error

Nov 06 08:07:16 routing mongod[3728]: Unrecognized option: sharding.configDB
Nov 06 08:07:16 routing mongod[3728]: try '/usr/bin/mongod --help' for more information
Nov 06 08:07:16 routing systemd[1]: mongod.service: control process exited, code=exited status=2
Nov 06 08:07:16 routing systemd[1]: Failed to start MongoDB Database Server.
-- Subject: Unit mongod.service has failed

to start mongod service I run this command:

sudo service mongod restart

also, I tried

 sudo mongos -f /etc/mongod.conf

but this command gives no output at all

I'm using Centos7

Intentionally slow down importing of (Percona) MySQL 5.7 dump

$
0
0

I need to move a very large MySQL table (250M rows, 120 columns. 120GB of data, 310GB of index) from one database instance to another (on AWS). For reasons beyond the scope of this question, this is the only option we are considering.

Our set up uses cross-region replication on AWS with many slaves on different regions. Updates to a MySQL table are written to the binlog and replicated to these slaves immediately using a private tunnel.

The host database includes only this one table, and the table's contents are static. The target database includes hundreds of other tables with active transactions that must continue to be replicated to other regions with minimal replication lag. This is the root of the problem: if I simply import this massive dump (mysql -u username -p database_name < file.sql), the writes to this single table with overwhelm the binlog and cause replication lag for other tables on slaves, which is unacceptable.

What I'm looking for is this: Is there a way I can intentionally slow down this import to prevent it from causing a replication lag on transactions on other tables?

I'm looking for the most straightforward approach to accomplish this with minimal effort. You can, of course, write a custom script that batches the writes for you and sleeps for a period of time between each batch, but I'm trying to avoid that if possible.

This is the version of MySQL I'm running on both instances:

$ SHOW VARIABLES LIKE "%version%";

innodb_version  5.7.12-5
protocol_version    10
slave_type_conversions  
tls_version TLSv1,TLSv1.1,TLSv1.2
version 5.7.12-5-log
version_comment Percona Server (GPL), Release '5', Revision 'a2f663a'
version_compile_machine x86_64
version_compile_os  debian-linux-gnu

Heartbeat frequency in AWS DMS (Database Migration Service)?


Will changing a MySQL user's password break existing connections?

$
0
0

If I update a user's password or privileges in MySQL, how does this affect existing connections? In particular, if I change the replication user password, will it break replication for connected slaves?

Edit: Assume I am using FLUSH PRIVILEGES after updating the information.

How does AWS postgres RDS read replication handle schema switching?

$
0
0

I am wanting to know how an AWS postgres RDS does replication where I rename schemas to "swap" them within the read/write instance of the database.

Does it replicate this action to the read-replicas by sending on the "alter schema" rename commands I gave to my read/write instance? Or after my renames, does it see wholly different sets of data in the schemas and do a whole new copy of each out to the read-replicas?


For example...

In my RDS instance I have a read/write instance of "my_mega_database" which I want to create read-replicas of for my applications to connect to.

Typically, in "my_mega_database" there are two schemas "my_data" and "my_data_old", whereby "my_data" contains data that was delivered last night, and "my_data_old" contains data from the previous night. Each contains many tables and huge amounts of data.

If I were to do the following...

ALTER SCHEMA my_data_old RENAME TO my_data_tmp;
ALTER SCHEMA my_data RENAME TO my_data_old;
ALTER SCHEMA my_data_tmp RENAME TO my_data;

... I have affectively swapped these around.

My expectation is that these actions are replicated via the postgres WAL (ie: it sends the rename commands out to the replicas) and AWS RDS replication won't try and waste time copying huge amounts of data all over the place.

Is this correct?

Pub/Sub replica in GCP

$
0
0

If you have a Pub/Sub in project A on GCP, is it possible to create a replica of it in project B? Meaning, are Pub/Sub or Pub/Sub topic replicable?

Mysql master-master replication using blackhole engine

$
0
0

I've got a master-slave mysql replication using blackhole engine for some tables on slave, so I'm wandering what will happen if I enable master-master replication? Will the tables become empty on my 1st master?

MongoDB replica has no primary

$
0
0

I have an existing MongoDB setup (part of a Graylog installation) where I'm attempting to configure a replica set with a primary, secondary and arbiter. I had the primary and arbiter configured successfully but then for some reason my primary has become the secondary and the application is unable to start now and also isn't allowing me to add in any other nodes in the replica set.

my_mongodb_0:SECONDARY> rs.status()
{
    "set" : "my_mongodb_0",
    "date" : ISODate("2019-01-02T19:50:19.291Z"),
    "myState" : 2,
    "term" : NumberLong(12),
    "heartbeatIntervalMillis" : NumberLong(2000),
    "members" : [
        {
            "_id" : 1,
            "name" : "node2:27017",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 9182,
            "optime" : {
                "ts" : Timestamp(1545938968, 1),
                "t" : NumberLong(12)
            },
            "optimeDate" : ISODate("2018-12-27T19:29:28Z"),
            "configVersion" : 166709,
            "self" : true
        },
        {
            "_id" : 2,
            "name" : "arbiter1:27017",
            "health" : 0,
            "state" : 8,
            "stateStr" : "(not reachable/healthy)",
            "uptime" : 0,
            "lastHeartbeat" : ISODate("2019-01-02T19:50:18.868Z"),
            "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
            "pingMs" : NumberLong(0),
            "lastHeartbeatMessage" : "Connection refused",
            "configVersion" : -1
        }
    ],
    "ok" : 1
}

...

my_mongodb_0:SECONDARY> rs.add( { host: "node1:27017", force: true } )
{
    "ok" : 0,
    "errmsg" : "replSetReconfig should only be run on PRIMARY, but my state is SECONDARY; use the \"force\" argument to override",
    "code" : 10107
}

Ideally I'd like to add the other node but with the state that it's in now not sure if I can still do this or if I have to revert it to a stand-alone setup first and configure it again. I know the primary election can't occur now and I haven't found a way to force the primary but just wanted to see if anyone else had any ideas.

I'm guessing now it matters what order you add the DB servers and the arbiter but I haven't been able to find a definitive answer to this...

Viewing all 17268 articles
Browse latest View live


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