xDB Replication Console unable to connect JRMP connection establishment
Remove a script previously added by sp_addscriptexec
Using SQL Server 2012 Enterprise. I have recently added a script to my transactional replication publication, that I would now like to remove.
I originally added the script using sp_addscriptexec
How do I drop or remove that script from the publication without having to drop and re-create the publication?
Sync SQL Server 2014 and SQL Server 2014 Express database using stored procedure or C#
I have a C# Windows Forms application (writen in Visual Studio 2013) and I have the same database schema in both SQL Server (for master user) and in SQL Server Express (for clients). My database size is around 2 GB for each client.
I want to synchronize this databases once in a day or when needed. In SQL Server 2008, we have used RMO, but that API has been deprecated with SQL Server 2012.
I have tried using Merge Replication using T-SQL and able to create publication, add articles to publication, create subscriber and also able to register subscriber to publication but data was not synchronized.
Is there any good example for this(merge replication) which will work for SQL Server 2014 or later version then please suggest it.
Thanks.!
What is the "Replication" key for in a SQL Server connection string?
In a SQL Server connection string you can specify a boolean value for the Replication
key, for example:
Data Source=.;Initial Catalog=Example;Integrated Security=True;Replication=True;
The closest I can find to documentation of this is here, which says:
Gets or sets a Boolean value that indicates whether replication is supported using the connection.
But to me that doesn't really explain in enough detail what the setting actually does. Can someone give a deeper explanation of this?
I am working with databases that make use of replication, so it seems that this setting could be relevant.
SQL Server : merge replication error
Can anyone please help me out to solve this error in SQL Server merge replication?
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. (Source: MSSQLServer, Error number: -2147200990)
A query executing on Subscriber 'DB-TEST' failed because the connection was chosen as the victim in a deadlock. Please rerun the merge process if you still see this error after internal retries by the merge process. (Source: MSSQLServer, Error number: 20245)
Cannot issue SAVE TRANSACTION when there is no active transaction. (Source: MSSQLServer, Error number: 628)
SQL Merge Replication Error-1
I'm facing a problem in SQL merge replication:
Error message:
The merge process was unable to verify the existence of a generation at 'publisher'. Îf this failure persists, reintilialize the subscription.
TCP Provider: The semaphore timeout period has expired. (Source: MSSQLServer, Error number:121)
Communication link failure (Source: MSSQLServer: Error number: 121) Get help:
While I'm not in position to reintialize subscription due to production database environment.
Advice on distributed applications using SQL-Replication or AlwaysOn
I'm considering building a distributed application and would like some advice on the best way to go about it. It is an internally used application that is used by offices all over the world, currently all the users use a centrally host application in one data centre (yes, we do have a D.R. site too) but there is performance degradation with the users at remote (the side of world) sites.
I want performance and response times to be comparable to a locally located application, so I am thinking of regional servers hosting both IIS and MS-SQL, however data changes have to be synchronised between each regional DB server in as close to real-time as I can get (5 second delay would be acceptable).
I am considering SQL Replication or AlwaysOn, both work on paper, but what about in an operational environment, and what issues when they go wrong?
So any advice on best approach to do this, and also any experiences of these failing and the recovery issues getting it all back working would be appreciated.
Thanks.
what happens to the unsent data from distributor in Replication
In Replication, My Subscriber has stopped working. All the unsent data are present in Distributor. And as per distributor, all the history will get removed after 72 hours(default value). So my doubt is, whether my unsent data will also get removed from the distributor after 72 hours if Subscriber doesn't come online?
stored procedure MSenumgenerations90 is slowing down merge replication
I have a merge replication that has been running fine for a year (the system has been active for several years but I recreated the replication a year ago because of some other problems).
Everything is still working but when someone is (re-)initializing a subscription (downloading a new subscription-database) it takes much longer time and there are some locks appearing. the subscribers are ca 300 windows ce devices with sql server compact.
What I can see is that a stored procedure called MSenumgenerations90
is the culprit and it takes up alot of IO and CPU. the most common wait i can see in activity monitor i CXPACKET and I understand that this is parallelism. I can see some pageiolatch and at least some of them is pointing to the tempdb. the table msMerge_GenHistory contains a bit more then 1,5 million records and i tried to add indexes to it to make the expensive operation in the stored procedure to run quicker but with no success.
My retention period is high. it is set to 60 days but i can still see that there is generations in MSMerge_GenHistory
that is created (coldate) when I recreated the replication a year ago however there seems to be some generations removed since the generationid of the latest one is above 2,2 million. could there be something wrong with the metadata cleanup or is this normal behavior?
When the CXPACKET waits are showing i get Buffer I/O wait times at 2000 ms/s and there is also a lot of IO_COMPLETION waits, when I monitor the disk at the server i can see that tempdb-file is getting the most reads and writes. One of the things I have read is that you can setup multiple files for tempdb and that it could relieve the pressure on tempdb, could this be something that would help my situation?
Is it safe to add more files to tempdb when you have a merge replication running?
UPDATE. I ran the stored procedure to get the actual execution plan and there is a sort warning that says the sort is spilling to tempdb. I am guessing this is the reason for my problem, the sp is running in parallel and it spills to tempdb and 8 consecutive threads are accessing the the tempdb to try and sort results and that is why the waits in IO is high and why CXPACKET is showing!?my sort waring how can i get it to stop spilling to tempdb? could it be done by indexing better? I cannot modify the sp since it is part of the replication. Any help is welcome.
Sortspill in system stored procedure in merge replication
I have a merge replication that has been running fine for a year (the system has been active for several years but I recreated the replication a year ago because of some other problems).
Everything is still working but when someone is (re-)initializing a subscription (downloading a new subscription-database) it takes much longer time and there are some locks appearing. the subscribers are ca 300 Windows CE devices with SQL server compact.
What I can see is that a stored procedure called MSenumgenerations90
is the culprit and it takes up a lot of IO and CPU. the most common wait i can see in activity monitor i CXPACKET and I understand that this is parallelism. I can see some pageiolatch and at least some of them is pointing to the tempdb. the table msMerge_GenHistory
contains a bit more then 1,5 million records and i tried to add indexes to it to make the expensive operation in the stored procedure to run quicker but with no success.
My retention period is high. it is set to 60 days but i can still see that there is generations in MSMerge_GenHistor
y that is created (coldate) when I recreated the replication a year ago however there seems to be some generations removed since the generationid
of the latest one is above 2,2 million. could there be something wrong with the metadata cleanup or is this normal behavior? When the CXPACKET waits are showing i get Buffer I/O wait times at 2000 ms/s and there is also a lot of IO_COMPLETION waits, when I monitor the disk at the server i can see that tempdb-file is getting the most reads and writes. One of the things I have read is that you can setup multiple files for tempdb and that it could relieve the pressure on tempdb, could this be something that would help my situation?
Is it safe to add more files to tempdb when you have a merge replication running?
UPDATE.
I ran the stored procedure to get the actual execution plan and there is a sort warning that says the sort is spilling to tempdb. I am guessing this is the reason for my problem, the sp is running in parallel and it spills to tempdb and 8 consecutive threads are accessing the the tempdb to try and sort results and that is why the waits in IO is high and why CXPACKET is showing!? my sort waring how can i get it to stop spilling to tempdb? could it be done by indexing better? I cannot modify the sp since it is part of the replication. Any help is welcome.
UPDATE 2.
I created a covering index for the part of the sp that was getting the sort and now there is no warning any more, the tempdb read and writes are back to normal and the time for sync has been reduced. Unfortunatly there is still CXPACKET waits going on in the activity monitor and the sp is still consuming very mutch cpu, anyone have a tip for how to continue?
MsMerge_genhistory has alot of rows with pubid = null
I have a merge replication and I am worried that the cleanup of metadata might not be enough. I have a retention period of 60 days and I can see thet the metadatacleanup-job do remove rows i msmege_genhistory that are older but only for rows that has the right guid in pubid. most of the rows, about 1,6 million, has the value NULL in pubid and I cannot figure out why. does anybody know why there is so many null-values?
Anonymous subscribers does not get expired in merge replication
I have a Merge replication with anonymous subscribers, in my sysmergesubscriptions there are old subscriptions that still has the status 1 (active) and the last_sync_date is way below the retentionperiod, in fact all of the subscriptions in the table has the status of active!?
The job "Expired subscription clean up" runs every night without errors but does not seem to set them to inactive. I have tried to follow the stored procedures that it uses to understand but I do not really follow.
Do anybody know why this is happening or have some input to what i should investigate?
Strange UPDATE results in presence of merge replication
I have an MS Access front-end database that accesses an SQL Server backend. This (as far as we can tell) works flawlessly when the SQL Server database is not replicated. Once we introduce replication (from SQL Server Standard on a proper server as the publisher to SQL Server Express on a laptop as a subscriber using Merge Replication) we start getting weird database corruption that I can't explain.
What happens is that we have UPDATE queries which run against several tables in the database, and we also have Access itself doing CRUD operations against multiple tables as well (this corruption is not limited to one table). The result we see is that randomly (about 1 in 10 operations) a row other than the one we wanted to update is being updated, which overwrites data we didn't want to overwrite.
The replication, when set up, runs on demand on the laptop as a pull merge, and the corruption happens regardless of whether replication is performed. It only has to be enabled. No corruption seems to occur when replication isn't enabled.
I'm not accusing Microsoft of any fault here - it's entirely probable I've just forgotten to tick some box to prevent this. I'm just not sure what it is that I need to look for.
Edit: What I mean by corruption is this: Let's say I have rows:
ID | FirstName | LastName
--------------------------
1 | John | Smith
2 | Emma | Citizen
3 | Bob | May
I then run something along the lines of:
UPDATE Table SET FirstName = "Test" WHERE ID = 1
And after that happens I end up with this:
ID | FirstName | LastName
--------------------------
1 | Test | Smith
2 | Test | Citizen
3 | Bob | May
There are no error messages in any of the system tables dealing with replication. The only change in the schema is that when replication is enabled it creates the rowguid column.
Peer to Peer Replication Current Identity Not Similar
I am using peer to peer replication for 2 databases. I am replicating some tables with ID as primary key and identity(1,1). I noticed that in the subscriber database, the current identity of the table is not similar with the current identity of the table being published. The data being inserted is correct. If the insert will happen on the subscriber table, it will cause duplicate error. How do I sync both current identity?
SQL Server merge replication composite keys with per-location transaction sequences
Our company is currently working on more reliably replicating data from our locations into a central server for accounting and reporting purposes. We are a Windows only shop, so we are using SQL Server Standard in our central cloud and SQL Server Express at individual locations. We are currently trying to use SQL Server's built in merge replication, since the internet connection to our customers are generally poor and we have a large number of locations (~200 as of now).
Where we are stuck is trying to figure out how to replicate transactional data to the cloud reliably. Specifically, we have requirements that some types of records have to have sequential transaction numbers. Each sequence must not have gaps, but transaction numbers can be reused between locations. For example, location 1 and location 2 can both have a transaction 1, 2, and 3, but it is not OK for location 1 to have the sequence 1, 2, 5 and location 2 have the sequence 3, 4, 6.
Currently we use identity columns at the location, and a composite key that includes the location ID in the cloud. The problem comes with merging all of these records into a central repository, since Microsoft wants all of the tables to look exactly the same. From what I can gather, this keeps us from having an identity column at the location that holds its sequence position, and a non-identity composite key in the cloud to just hold a copy of the data.
We are using each location's unique identifier to filter by overwriting HOST_NAME().
We want to set up the data like this
Cloud:
create table Cash
(
LocationID int not null,
TransactionID int identity(1,1) not null,
Amount money not null,
rowid uniqueidentifier, -- For merge replication
constraint PK_Cash primary key (LocationID, TransactionID)
)
Location (ideally, though if we need to have LocationID on the table still we can, in which case the schema would be the same as above):
create table Cash
(
TransactionID int identity(1,1) not null,
Amount money not null,
rowid uniqueidentifier, -- For merge replication
constraint PK_Cash primary key (TransactionID)
)
By design each location will be assigned a unique LocationID that no other location shares. And each location only has a single database. So there won't be any problem with unique key constraint failures.
How would we go about handling the TransactionID column, since in merge replication using the identity type is specifically prohibited, and in a non-replicated table it would be a different identity sequence per potential value of LocationID.
Is this even possible to do, or are we using the wrong technology? We are trying to avoid having to roll our own replication system so we can leverage the stability of Microsoft's system. Really we are only using replication to push data to the cloud, as the cloud uses it for reporting and does not create new data that would need to be replicated down to the location. I've tried looking around, but all of the questions have to do with the sequence being shared across all of the subscribers, instead of each subscriber needing to have their own sequence.
Using HADR Standby as replication source
Trying to figure out if there's way to replicate a subset of tables (columns) from HADR Standby, with ROS enabled. Latency of O(10) sec can be tolerated. We are using luw V10.5FP8 right now and will upgrade to V11 at some point.
I understand the read-only limitation on HADR Standby, and that eliminates some options, eg. QRepl / infosphere CDC, which write monitoring/metadata back to source.
Furthermore, assuming we still limit ourselves to db2 heterogeneous env and the repl user have read access to all the tables/columns, is there a replication tool that doesn't depends on constant source db connection? Meaning such tool only scans transaction log files, and writes to its own external metadata/file, without bothering with source db at all? It would be even better if it can capture once, and replay in multiple targets.
Really appreciate your inputs.
MS SQL Server merge replication cannot find file specified
I'm trying to setup merge replication between two MS SQL Server 2012 databases on different hosts in one domain.
When replication is set up and first snapshot is generated replications starts. Replication monitor shows that tables are being prepared and bulk copied, but after about 40 minutes i get messages like
The process could not bulk copy into table "table_name".
...
The system cannot find the file specified.
The table is different every time. I'm trying to locate these missing files but they are absent. When i just sit and monitor these folders - i can see some folders being deleted a few moments before the error occurs. Tried both push and pull with similar results.
Answers on the web show it may be caused by
- User having insufficient privileges. I suppose this one is wrong because data is replicated till the error occurs - i can see tables being cleaned and filled with replicated data.
- Using local path for replication files. I'm using UNC path located on Publisher. Both publication and subscription occur with windows domain account with sufficient permissions.
Replication silently restarts and subscriber is constantly in inconsistent state.
Does anyone have any idea why this may happen or how can i debug the problem?
Can I Configure SQL Server 2012 Replication on Windows 10 Ultimate?
I have windows 10 Ultimate, I need to install SQL Server 2012 Full Edition and configure SQL Server Replication on it, is that possible or must work on Windows Server?
sp_dboption in SQL server 2012 for Published property
Currently working on migrating SQL server from 2008 to 2012 project. We aware that sp_dboption is deprecated and it will not work in SQL server 2012. In 2008, had code to set the value for Published property.
EXEC master..sp_dboption DBName, published, TRUE
In 2012, below query is not working. I think i am using incorrect property name 'PUBLISHED'.
ALTER DATABASE DBName SET PUBLISHED ON
Please help me on the same.
How to make SQLServer Web Merge Replication use non-default port?
I'm setting up a web synchronization for SQL Server Merge Replication. My IIS box is in my DMZ, and the SQL Server machine is behind the firewall, so I need to specify a non-default port (not 1433) to get to the publisher and distributor. I've tried setting it up like 192.168.4.5_1234 and similarly 192.168.4.5:1234 where 192.168.4.5 is my firewall IP and 1234 is the port number (well, I'm giving examples anyways).
The one with the colon blows up completely, and I'm fairly certain that's bad form for windows port specification - I just wanted to show I've tried that. The other gives this:
replmerg -Publisher [192.168.4.5_1234] -PublisherDB [MyDB] -Publication [MyPub] -Subscriber [ME] -SubscriberDB [MyPub] -SubscriptionType 2 -SubscriberSecurityMode 1 -Distributor [192.168.4.5_1234]
...
Message: The process could not connect to Distributor '192.168.4.5_1234'. 2017-10-25 21:53:27.892 Category:SQLSERVER Source: 192.168.4.5_1234 Number: 53 Message: Named Pipes Provider: Could not open a connection to SQL Server [53]. 2017-10-25 21:53:27.894 Category:SQLSERVER Source: 192.168.4.5_1234 Number: 53 Message: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. 2017-10-25 21:53:27.895 Category:SQLSERVER Source: 192.168.4.5_1234 Number: 0 Message: Login timeout expired 2017-10-25 21:53:27.896 Category:SQLSERVER Source: 192.168.4.5_1234 Number: 0 Message: The merge process failed to execute a query because the query timed out. If this failure continues, increase the query timeout for the process. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write.
Why its trying to use named pipes is beyond me, TCP/IP is listed above Named Pipes in my client protocols.
I notice in Microsoft's documentation, it doesn't even tell you how to do this... they just say it will "typically" use the default port. Is this even possible? Anyone ever gotten this to work?
https://technet.microsoft.com/en-us/library/ms151255(v=sql.105).aspx