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

CDC capture job fails with error #2601

$
0
0

Hello.

I used CDC feature for a time to collect application data and send it to data warehouse and everything worked well. Then few weeks ago I noticed that my function that retrieves net changes (in my case [cdc].[fn_cdc_get_net_changes_dbo_info_rg_3830]) became to work very slow. I found article (https://support.microsoft.com/en-us/kb/2989478) about poor performance for cdc.fn_cdc_get_net_changes_<capture_instance> in SQL Server 2012 SP2 and since my SQL Server version was 11.0.5343.0 (2012 SP2) I decided to update Microsoft SQL Server 2012 to Service Pack 3 (version 11.0.6020.0).

So, after update I'm unable to use CDC at all. Each time I try to start capture job in Agent it fails and raises a bunch of errors first of those is 2601:

Entry Time 2016-03-10 11:58:44.173, Msg 2601, Level 14, State 1, Cannot insert duplicate key row in object "cdc.dbo_info_rg_3830_CT" with unique index "dbo_info_rg_3830_CT_clustered_idx". The duplicate key value is (0x00e6dd33000043080012, 0x00e6dd33000042d0000d, 1). For more information, query the sys.dm_cdc_errors dynamic management view.

Neither sys.dm_cdc_errors nor sys.dm_cdc_log_scan_sessions DMV provide any valuable information.

That clustered index on the changes table is defined as follows:

CREATE UNIQUE CLUSTERED INDEX [dbo_info_rg_3830_CT_clustered_idx] ON [cdc].[dbo_info_rg_3830_CT]
(
	[__$start_lsn] ASC,
	[__$seqval] ASC,
	[__$operation] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [com_cdc_fg]
GO

Of course specific values of index columns that cause error every time are different. But I noticed that [__$operation] is always 1. So duplicates are always about deleting rows.

I tried do disable/re-enable CDC on database and table, tried to enable different table in the same database, tried to backup/shrink transaction log and then re-enable CDC and result was always the same. The database I try to enable CDC for doesn't participate in mirroring, replication etc.

What is interesting is that I can enable CDC on different database on the same server instance and it works well, collects data and writes it to the changes tables just as it should. So the problem is relevant with that specific database.

Any ideas?


Transactional Replication

$
0
0

We are planning for migration project from sql 2005 to sql 2012, For moving this huge data we planned for using Transactional replication From server A (sql 2005) to Server B(Sql 2012). On the Go -live during the cut off time i am thinking to script out the replication and then resume it and take a tail log backup and want to apply this on to the Server B(SQL 2012). But we have another replication which is going from Server B to Server C both on sql 2012. What happens when i restore the tail log backup from server A and apply it on the server B. Does the replication still work, Do i have to follow any steps

Please help

Thanks 

Vamshi

Created Transactional replication publisher and subscription. What follows next? Server Agent Job ? SSIS Package to run Job?

$
0
0

Hi Experts,

First of all please accept my apologies for the strange title and for this question itself if it is too naive. 

I am wondering what follows next after creating a Transactional Replication Publisher and Subscription on Source and Target Server Databases.

I have a Table in server A that is loaded with the SSIS and updated daily(2 weeks data updation-Inserts and Deletes).

Now I have created a Publication on server A. After this I have created Subscription on server B which is my production server.

However, not sure if anything else I have to do to keep the production server Table updated with any changes in the server A Table.

I have tried to google and understand if I need any SQL server agent job to run the publication/subscription and do I need to create any SSIS package to execute the Server Agent job on daily basis.

I had tried to look at forums and sites to understand what comes next but bit confused where to start.

I appreciate if anyone can shed some light on this topic and provide any links which can guide me to the next steps.

Thanks a Ton in advance.

Maintenance tasks in Subscriber Database

$
0
0

Hi All,

I have a question regarding the maintenance tasks that we run on subscriber databases involved in transactional replication.

Will there be any latency in applying replicated transactions from distributor to subscriber when rebuild/reorg index or update statistics or checkdb is running.

Thanks

Udhayan

Determine replication type from subscriber in sql server 2008

$
0
0
Is there a way to determine replication type from subscriber in sql server 2008 ? i have access only to the subscriber & can't figure out whether it is transactional or snapshot. I know for sure it is not a merge setup as there are no merge related system tables.

Problem with RMO programming on computer with SQL Server 2014 Express

$
0
0

Hello

I'm trying to implement merge replication (pull subscription) on the computer with installed SQL server 2014 Express. I've crested codes according to spec:

https://msdn.microsoft.com/en-us/library/ms146869%28v=sql.120%29.aspx

All is working properly on computer with full SQL Server 2014 Developer.

However on computer when SQL Server 2104 express is installed I have an exception wehn trying to run code:

System.BadImageFormatException: Could not load file or assembly 'Microsoft.SqlServer.Replication, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.

I've run code with x86 and Any  CPU complitaion on full sql server computer.

I've tried both compilation x86 and Any CPU and nothing is working on computer with SQL server 2014 Express.

I tried to attach libraries found in GAC, with copy local. And issue is the same.

I've compiled application on computer with SQL server 2014 express, without issue, in Any CPU or x86 mode. Both have the same exception.

Based on documention RMO suppose to work with SQL Server express.

RMO depends on the replication components and client connectivity components that are included with all versions of SQL Server except SQL Server Compact.

So the only exclusion is SQL Server Compact. But it is not working...

The format of a message during Web synchronization was invalid. Ensure that replication components are properly configured at the Web server.

$
0
0

Hi


We have 2 publications - merge - on a SQL 2008 Server - they sync over HTTPS anonymously

The subscriber has subscriptions to both - they have been ticking along nicely - though the bandwidth and server for the subscriber environment is not the best.

One of the subscriptions is now failing with:

Error messages:
The process could not read the request message due to OS error 10054. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147014842)
Get help: http://help/MSSQL_REPL-2147014842
The format of a message during Web synchronization was invalid. Ensure that replication components are properly configured at the Web server.  (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199374)
Get help: http://help/MSSQL_REPL-2147199374
The subscription to publication 'eliza main' could not be verified. Ensure that all Merge Agent command line parameters are specified correctly and that the subscription is correctly configured. If the Publisher no longer has information about this subscription, drop and recreate the subscription.  (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201019)

I've seen posts saying that this might be because of a mismatch of IIS components - but as one is working ok, this can't really be the case you would think. Also, when it starts to sync - it says there is about 2 gig to upload!  This isn't the case

I tried changing (we sync via RMO)
agent.DownloadGenerationsPerBatch = 1
agent.UploadGenerationsPerBatch = 5

.. but it didn't seem to help

Thanks
Bruce

Replication Error number: 18752

$
0
0

Hi Everyone,

Could someone help on this issue?

Please check the error message and kindly let me know how to troubleshoot this issue!

Error messages:
The process could not execute 'sp_repldone/sp_replcounters' on 'SLSERVER01'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure. (Source: MSSQLServer, Error number: 18752)
Get help: http://help/18752
The process could not set the last distributed transaction. (Source: MSSQL_REPL, Error number: MSSQL_REPL22017)
Get help: http://help/MSSQL_REPL22017
The process could not execute 'sp_repldone/sp_replcounters' on 'SQLSERVER01'. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037

Thanks,

V


DBA


Transactional Replication Unspecified error SQL 2008 R2

$
0
0

I have a set up of Transaction Replication with the Publisher being the distributor. It works on Push mode. While replicating, more frequently for the past few weeks, the data is not being pushed to the Subscriber. I see that the publisher is able to push data to the subscriber and as well, the commands reaching the subscriber. But, it seems like the commands are not being committed at the subscriber. This results in replication running for a long time and then failing. Below is how the error when it fails looks like:

Date 5/12/2016 6:40:01 AM Log Job History (Publisher_PublisherDB_Subscriber_Subscriberdb)

Step ID 2 Server Publisher Job Name Publisher_PublisherDB_Subscriber_Subscriberdb Step Name Publisher_PublisherDB_Subscriber_Subscriberdb Duration 06:20:59 Sql Severity 0 Sql Message ID 0 Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0

Message 2016-05-12 17:22:18.982 Delivering replicated transactions 2016-05-12 17:23:18.993 Delivering replicated transactions 2016-05-12 17:24:19.199 Delivering replicated transactions 2016-05-12 17:25:19.214 Delivering replicated transactions 2016-05-12 17:26:16.894 2016-05-12 17:26:19.390 Delivering replicated transactions 2016-05-12 17:27:19.434 Delivering replicated transactions 2016-05-12 17:28:19.463 Delivering replicated transactionsd 2016-05-12 17:29:19.695 Delivering replicated transactions 2016-05-12 17:30:19.880 Delivering replicated transactions 2016-05-12 17:31:16.898 2016-05-12 17:31:19.924 Delivering replicated transactions 2016-05-12 17:32:20.094 Delivering replicated transactions 2016-05-12 17:33:20.403 Delivering replicated transactions 2016-05-12 17:34:20.426 Delivering replicated transactions 2016-05-12 17:35:20.741 Delivering replicated transactions 2016-05-12 17:36:17.071 2016-05-12 17:36:20.926 Delivering replicated transactions 2016-05-12 17:37:21.287 Delivering replicated transactions 2016-05-12 17:38:21.481 Delivering replicated transactions 2016-05-12 17:39:21.761 Delivering replicated transactions 2016-05-12 17:40:22.080 Delivering replicated transactions 2016-05-12 17:41:17.264 2016-05-12 17:41:22.216 Delivering replicated transactions 2016-05-12 17:42:22.244 Delivering replicated transactions 2016-05-12 17:43:22.382 Delivering replicated transactions 2016-05-12 17:44:22.645 Delivering replicated transactions 2016-05-12 17:45:23.001 Delivering replicated transactions 2016-05-12 17:46:17.445 2016-05-12 17:46:23.124 Delivering replicated transactions 2016-05-12 17:47:23.381 Delivering replicated transactions 2016-05-12 17:48:23.654 Delivering replicated transactions 2016-05-12 17:49:23.958 Delivering replicated transactions 2016-05-12 17:50:24.329 Delivering replicated transactions 2016-05-12 17:51:17.782 2016-05-12 17:51:24.617 Delivering replicated transactions 2016-05-12 17:52:24.836 Delivering replicated transactions 2016-05-12 17:53:24.845 Delivering replicated transactions 2016-05-12 17:54:24.985 Delivering replicated transactions 2016-05-12 17:55:25.109 Delivering replicated transactions 2016-05-12 17:56:17.807 2016-05-12 17:56:25.132 Delivering replicated transactions 2016-05-12 17:57:25.238 Delivering replicated transactions 2016-05-12 17:58:25.551 Delivering replicated transactions 2016-05-12 17:59:25.939 Delivering replicated transactions 2016-05-12 18:00:59.563 Unspecified error 2016-05-12 18:00:59.855 Category:COMMAND Source: Failed Command Number:
Message: if @@trancount > 0 rollback tran 2016-05-12 18:00:59.873 Category:NULL Source: Microsoft SQL Server Native Client 10.0 Number:
Message: Unspecified error

I am able to find out that usually, it is because of transactions on one table. If I remove the transactions of this table and push the rest of the data, it is able to replicate the details. However, this happens quite often. I did some googling and could not find any information. Any kind of information would help.

Huge log file on distribution database for Merge replication

$
0
0

Hi,

We have couple Merge replication publications and now we noticed that distribution database log file is about 60gb. We would like to reduce size of log file.

What I have tried:

EXEC dbo.sp_MSdistribution_cleanup @min_distretention = 0, @max_distretention = 12
EXEC dbo.sp_MShistory_cleanup @history_retention = 12

DBCC SHRINKFILE (N'distribution_log',471)

but no luck.

These does not return anything:

select * FROM [distribution].[dbo].[MSrepl_transactions](nolock)
select * FROM [distribution].[dbo].[MSrepl_commands](nolock)

log_reuse_wait_desc shows NOTHING:

SELECT log_reuse_wait_desc,name from sys.databases

Subscription expiration is set to 36 hours on all publications.

Any ideas?

Thanks


Errors in Merge Replication

$
0
0

We are using SQL Server 2012 version 11.0.6020.0, we have setup merge replication on 2 SQL servers, the replication is running fine, but encounter 2 errors during load test. 

May I know the cause and how to solve the problems ?

First error:

Command attempted:
{call sp_MSensure_single_instance (N'[JOB_NAME]', 4)}

Error messages:
The merge process could not connect to the Publisher. Check to ensure that the server is running. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199368)
Another merge agent for the subscription or subscriptions is running, or the server is working on a previous request by the same agent. (Source: MSSQLServer, Error number: 21036)

Second error:

Error messages:
The merge process was unable to create a new generation at the 'Publisher'. Troubleshoot by restarting the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147200994)
A query executing on Publisher 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: MSSQL_REPL, Error number: MSSQL_REPL20245)

Thx, Zen

Minimizing Downtime in SQLServer 2012 Standard Edition

$
0
0
Hello,

I am using SQLServer 2012 Standard Edition SP3. I am trying to avoid the downtime which is almost 5 hours per day from 12 to 5 AM. During this down time I am archiving data older than x days to an OLAP database and then deleting it from the OLTP database and then rebuilding the indexes in OLTP. Since this is standard edition I cannot rebuild indexes online. Besides while I am doing deletes there are table locks as well.

So I wanted to test if this downtime can be avoided by switching the applications every night from one server to another server. My approach  is to set up bidirectional transaction replication between Server 1 and Server 2 and have apps point to one server and one database at any given point of time. 

By bidirectional replication I don't mean the exact architecture but a little customized one. I am setting up transaction replication between server 1 and server 2 and also between server 2 and server 1 on the same database but at any given point of time only one set of replication jobs are up an running and the other server's replication jobs will be stopped and disabled. Also when I am configuring transaction replication from server 2 to server 1, I am not using snapshot because it will throw errors as the database is participating in replication. Also the distribution databases are sitting on their own servers.

1. On Day 1 at 12:00 AM Server 1 Database 1 is in Sync with Server 2 Database 2. (data matches).
2. On Server 2 replication jobs are stopped and disabled. Apps point to Server 1 and maintenance jobs run in server 2 and not on server 1
3. On Day 2 at 12:00 AM I will make sure data is all synced up between server 1 and server 2 and at 12:00 AM I am going to stop the replication jobs  from Server 1 to Server 2 and then disable them 
4. I will then enable the replication jobs from Server 2 to Server 1 and make sure I will seed the identity columns in all tables to match the max value 
5. on this day The maintenance jobs will run in Server 1 and replication is from Server 2 to Server 1
6. I will make sure data is synced up between two servers by 12:00 AM and repeat the same process the next day.

This reduces my downtime from 5 hours to probably less than 5 mins a day. So far I havent seen any issue other than seeding the identity column values which can be fixed through an agent job or a script.

Experts I need your valuable inputs on this. I have only tested it out on a dummy database with 5 tables. Do you see any issues with this kind of set up?

Thanks a ton.

merge replication error

$
0
0

I set up merge replication between a server and b server.

but it seems to stuck in error on regular time

log information

message : the job was invoked by schedule 10(replication agent schedule).the last step to
run was step1(run agent)

delete failed becuase the following set options have incorrect settings
ANSI_NULLS.QUOTED_IDENTIFIER. verify that set options are correcte for
use with indexed views and/or indexs on computed and/or filtered indexes
and/or query notifications and/or xml data type methods
and/or spartial indexes operations [SQLSATE 42000(error 1934)]
the merge process could not clean up the conflict table A for publication B
(error 20709) the step failed.

plz help

Is single_user (or restricted_user) needed for adding replication with sp_ replication code

$
0
0

In order to run

sp_addpublication  sp_addlogreader sp_addpubliction_snapshot  sp_addarticle  sp_addsubscription sp_addPushSubscription_Agent sp_startpublication_snapshot,

or

sp_droppublication, etc

is it necessary to Alter Database to Single_User mode and if yes? then Why?

Thank you

Db Automation

$
0
0

Hi,

Like many others, I would like to replicate "part of" the production data to my QA/UAT environment and then run tests using real data (instead of generated test data).

However, this test environment is only a small percentage of the big production environment - so, I would like to know how you are dealing with this problem.

Are there any tools out there, that are already doing this?

Main concerns I have are around:

 - Automating this process, so that for every release, I could have this process repeated

 - Foreign key violations and any other violations don't occur



SQL Server Transactional Replication and Security Setup

$
0
0

I am new to SQL Server replication. I was able to setup transactional replication successfully, but I feel like I am missing some important concepts regarding security and accounts. I have a few basic questions:

please visit this url to see the question with images.

http://dba.stackexchange.com/questions/139140/sql-server-transactional-replication-and-security-setup

Thanks



www.SaqibKhan.Com

rowguid field in merge replication

$
0
0

We have a common table that was shared and updated by two servers, one of the servers uses linked server to access it.

We are now trying to eliminate the use of linked server and use merge replication instead, which comes with a new rowguid.

Do we need to change all the INSERT SPs on both sides to add value to this rowid field?

Thanks in advance.

AmyDom.

Identity insert without reseed of identity column

$
0
0
I have a Peer-to-Peer replication which is not performing optimally because of BLOB data , so I have come up with customized replication wherein each server has a partitioned Identity insert range eg ( 1st server indentity range from 1 - 300 million ) and my second server the identity range starts from 300 million + . I am sure that the inserts will not cross over the range in each server.

I am using custom stored procedures to replicate data. When replicating data from the second server to the first , I do not want to reseed the identity column because of the insert . Microsoft replication is able to do so with the "NOT FOR REPLICATION" and bypass the reseed of the identity columns. How do I implement similar functionality for my custom stored procs. I tried to profile capture the sp's called but did not find anything.

It is not possible for me store and then reseed the identity on the column after every insert because the system is heavily concurrently used and may result in a primary key violation if the reseeding is not proper. 

How is Microsoft able to bypass the reseeding with the "NOT FOR REPLICATION". I was not able to find any documentation online. Please help.

Merge replication

$
0
0

HI,

i am working on SQL server merge replication in SQL server Express.

Server : SQL server 2014

Client : SQL Express 2014. 

As SQL Express 2014 is not act as publisher i have configured merge agent at server end and using push subscription to push data from server to client. Now client requesting not to merge all the data from server to client. only the cases/Records assigned to him

want to download. Please advice me how we can control merge agent generating snapshot with respect to user level?

Thanks in advance.


The Subscriber data is missing ?

$
0
0

Hi All,

In our environment we have replication like multiple publications to single subscriber.

we are replicating the data from 7 databases with same table name to single subscriber (single table).

Example: we have temp table in all 7 publications databases with total row count is 700 each table having 100 rows..the total rows are replicated to subscriber database temp table. Now some data is missing at subscriber and planning to run the reinitialize the subscriber.

Here the doubt is when we reinitialize the subscriber what will happen...it will over writer or we will get total 700 rows.

Thanks in Advance for your time,


rup

Viewing all 4054 articles
Browse latest View live




Latest Images