Skip to content

SQL Server Replication information, scripts, and procedures for custom alerting.

Notifications You must be signed in to change notification settings

vijaybandi/SQLReplication

 
 

Repository files navigation

SQL Server Replication Code Repository

SQL Server Replication information, scripts, and procedures for custom alerting.

Check out the files in the repository. I added two extra non-replication procs there, prc_Config_DBMail.sql which will help configure your SQL Server's DBMail feature for you. Just follow instructions it provides. I also added prc_InternalSendMail.sql which will automatically create DBMail profiles for you with zero effort.

##Chuck Lathrope an Author in Tribal SQL Redgate and MidnightDBA organized a bunch of new authors to create a book on SQL Server topics, called "Tribal SQL". I wrote the "Taming Replication" chapter on transactional replication, which covers all aspects of setup, performance, and troubleshooting. The book really covers what each of us authors thought was important tribal knowledge that we are passionate about. The books website is www.tribalsql.com and all proceeds go to Computers 4 Africa charity.

I hope you enjoy the book, I know I spent a lot of time writing and re-writing the Taming Replication chapter with lots of help from Tony Davis the lead editor.

Cheers, Chuck Lathrope

10/21/2013 - Review of Fundamentals of SQL Server 2012 Replication

I volunteered to review the book, "Fundamentals of SQL Server 2012 Replication" written by Sebastian Meine, Ph.D. and published in August 2013 by SimpleTalk publishing.

Sebastian does a great job at giving an overview of transactional and merge replication concepts, geared towards new users of replication. Each chapter reviews concepts and definitions to help solidify for the new user the knowledge you need to create your own replication environment. One of the aspects of the book that jumped out at me that differentiates it from other references on replication is the coverage of security in replication and using the least privilege access paradigm. Security in replication with least privilege access isn't that easy, but he covers it extensively in Chapter 6 - The Publication Access List and uses it as the basis for the chapter on troubleshooting replication.

He walks through examples of setting up both transactional and merge replication with lots of screen shots and explanations of what each option the replication setup wizard's ask of you. All the replication agents are covered and their purpose is explained well including how security works for each. There is even good coverage on Push vs. Pull distribution agents and why you should choose one or the other. Replication Monitor use is covered along with how to setup alerts with it and caveat's on how easy it is to miss issues with Replication Monitor. By the end of the book, you will have an excellent foundation on implementing transactional or merge replication. Some of the advanced settings and configurations are not covered in the book like custom agent profiles, scripting, advanced troubleshooting by diving into distribution database, and how you can easily get into trouble with wizards creating immediate sync publications. I cover these advanced topics in my chapter "Taming Replication" in Tribal SQL (http://rd.gt/1befi7Y) also published by SimpleTalk publishing in October 2013.

Overall, I highly recommend this book for people wanting to implement replication for the first time and want more detail than books online and a chapter of a book like Tribal SQL. Once you get going with replication, you will want to turn to my chapter on “Taming Replication” for transactional replication, but you will need to turn to other resources for merge replication.

Cheers, Chuck Lathrope

05/04/2013 - SQL Replication Distribution Cleanup Job Blocking Problem

I have been having a real issue with Replication's Distribution Cleanup job on our dedicated distributor server. It prevents the subscribers from updating their history, and making all my custom reports look like everything is latent, when in reality it may or may not be latent. I created a job to stop the job if it has been blocking for more than 5 minutes with this bit of code:

DECLARE @binaryvalue BINARY(16)
SELECT @binaryvalue = CONVERT(BINARY(16), job_id)
FROM msdb.dbo.sysjobs (NOLOCK)
WHERE name = 'Distribution clean up: distribution'
IF EXISTS (
SELECT spid
FROM sys.sysprocesses
WHERE program_name = 'SQLAgent - TSQL JobStep (Job '+ sys.fn_varbintohexstr(@binaryvalue) + ' : Step 1)'
AND DATEDIFF(mi, login_time, GETDATE()) >= 5
AND blocked > 0 )
EXEC msdb.dbo.sp_stop_job 'Distribution clean up: distribution'

I hope it helps you too!

About

SQL Server Replication information, scripts, and procedures for custom alerting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • SQLPL 72.1%
  • PLSQL 27.9%