Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Symptoms

Assume that you have a Microsoft SQL Server 2008 R2, SQL Server 2012, or SQL Server 2014 Transactional Replication environment. There are multiple distribution instances of SQL Server in the environment. In this situation, an access violation may occur, and the SQL Server replication distribution agent crashes. Additionally, a mini dump file is generated.

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:


Hotfix update package for SQL Server 2008 R2 Service Pack 1The fix for this issue was first released in the hotfix update package for SQL Server 2008 R2 Service Pack 1.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

After you apply the hotfix, add the following script to the Distribution Agent job:DECLARE @JobID BINARY(16)
DECLARE @AgentID int
DECLARE @command varchar(max)
DECLARE JobCur CURSOR FOR SELECT Job.job_id, Agent.id FROM msdb.dbo.sysjobs AS Job
INNER JOIN msdb.dbo.syscategories AS Cat ON Job.category_id = Cat.category_id
INNER JOIN msdb.dbo.sysjobsteps AS Steps ON Job.job_id = Steps.job_id
INNER JOIN distribution.dbo.MSdistribution_agents AS Agent ON Job.job_id = Agent.job_id
WHERE Job.name like '%Put Text Mask To Identify Your Publisher DB Jobs Here%' AND Cat.name = 'REPL-Distribution'
GROUP BY Job.job_id, Agent.id
HAVING COUNT(step_id) = 3
OPEN JobCur
FETCH NEXT FROM JobCur INTO @JobID, @AgentID
WHILE @@FETCH_STATUS = 0 BEGIN
IF (@JobID is not NULL) BEGIN
set @command = N'if (select top 1 runstatus from MSdistribution_history where agent_id = ' + convert(varchar, @AgentID)+ N' order by timestamp desc) = 5
raiserror(''Agent was scheduled for retry. Performing restart now'',16,1)'
EXEC msdb.dbo.sp_add_jobstep @job_id=@JobID, @database_name=N'distribution', @step_name=N'Check for retry', @step_id=4, @on_fail_action=4, @on_fail_step_id=1, @command=@command
EXEC msdb.dbo.sp_update_jobstep @job_id=@JobID, @step_id=2, @on_success_action=4, @on_success_step_id=4
END
FETCH NEXT FROM JobCur INTO @JobID, @AgentID;
END
CLOSE JobCur;
DEALLOCATE JobCur;
GO

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×