Undocumented Gotchas of Transactional Replication
This discussion started on Twitter via the #sqlhelp hash tag. The question that was asked is, “What are the undocumented gotchas of Transactional Replication? #SQLHelp”. I responded with several things that came to mind. I thought these would be good to capture in a blog post and hopefully others would contribute some more gotchas to the list.
If you can think of any other gotchas about any type of replication, not just transactional, please add it to a comment. Also, if you have a blog post on it, please include the link to the post. I’m getting the ball rolling with the ones I mentioned on Twitter.
Gotchas of Replication
- Transactional replication
- If you run the agent continuously, and it stops (fails), it won’t restart or raise an alert until the subscription expires.
- If the agent is failing, it will retry forever and you may never notice it is failing unless you are monitoring closely.
- If you add/remove an article using the GUI, it will regenerate the entire snapshot. Use TSQL to avoid this.
- Where you place the distribution db is very important for performance and manageability. Plan this point very well.
- Check the VLFs in your db log before configuring repl. as it can have a very high impact on performance of the log reader
- Be wary of non-replicated trans that create lots of log records (eg, index maint.) as it affects log reader performance
- DML ops. to LOB columns in repl. tables will fail if the length of value exceeds the “max text repl size (B)” setting.
- Make sure you are testing deployments in repl. preprod. environ. so you aren’t surprised by related failures in Prod.
- When the publication is mirrored. Transactions will not replicate until hardened on mirror, unless a trace flags used
- Reported by John Sansom (blog|@JohnSansom)
- John and Martin Cairns (blog|@MartinCairnsSQL) report that the whitepaper can be downloaded here.
- Log reader fails if it encounters blank (empty) XML in an XML column.
- Including an article in multiple publications can lead to performance problems.
- Altering articles to not replicate deletes may not be set on all articles as expected.
- Merge replication
- Changing conflict tracking level from row to column generates conflicts when different columns are updated
- Reported and blogged by David Williams (blog|@is_brandon) here.
Undocumented Gotcha in Merge Replication Tracking | SQLREPL | Brandon Williams
[…] the spirit of Robert Davis's (blog | @SQLSoldier) blog post: Undocumented Gotchas of Transactional Replication, I decided to contribute an undocumented gotcha in Merge Replication to his list. First, let me […]
Brandon Williams
Hi Robert,
I’m liking the list so far.
I thought of one particular gotcha with Merge Replication that came to mind and wrote a blog post about it here: http://www.sqlrepl.com/sql-server/undocumented-gotcha-in-merge-replication-tracking/
SQLSoldier
Thanks Brandon! Page updated. Looks like you have some great info on replication on your blog. Going to have to read through it.
Lewis
I’ve done the same 🙂 my blog is kind of all about technology (and other things), but I just wrote an article (that I think is incredibly useful) teaching people how to deal with SQL replication conflicts (which is actually how I found your blog!).
Here’s me: http://public.madeinengland.co.nz/sql-server-conflict-resolution/
SQLSoldier
Thanks Lewis! There aren’t a lot of replication bloggers, and it’s always good to learn about others.
Gareth Tupper
If you’re able to alert on the result of SQL queries, these can help to monitor replication states:
/****** SQL Replication Minutes behind ******/
select
datediff(minute, min(entry_time), getdate())
from
distribution.dbo.msrepl_transactions (nolock)
/******SQL Replication Number of unreplicated commands ******/
select
count(*)
from
distribution.dbo.msrepl_transactions (nolock)
SQLSoldier
Thanks for providing some sample monitoring queries, Gareth!
Trials and Tribulations of SQL Transactional Replication | Ned Otter Blog
[…] Undocumented “gotchas” of transactional replication by Robert Davis can be found here. […]