Exception Message: The snapshot could not be generated because the publisher is inactive.

-> Snapshot agent failed with below error,

Date 8/12/2020 3:04:32 PM
Log Job History (JBPUB-PRIMARY-JBREPL-TranProducts-1)

Step ID 2
Server JBDIST-PRIMARY
Job Name JBPUB-PRIMARY-JBREPL-TranProducts-1
Step Name Run agent.
Duration 00:00:01
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0

Message
2020-08-12 15:04:33.78 Microsoft (R) SQL Server Snapshot Agent
2020-08-12 15:04:33.78 [Assembly Version = 14.0.0.0, File Version = 14.0.3335.7 ((SQL17_RTM_QFE-CU).200613-0316)]
2020-08-12 15:04:33.78 Copyright (c) 2016 Microsoft Corporation.
2020-08-12 15:04:33.78 The timestamps prepended to the output lines are expressed in terms of UTC time.
2020-08-12 15:04:33.78 User-specified agent parameter values:
2020-08-12 15:04:33.78 ————————————–
2020-08-12 15:04:33.78 -Publisher JBPUB-PRIMARY
2020-08-12 15:04:33.78 -PublisherDB JBREPL
2020-08-12 15:04:33.78 -Publication TranProducts
2020-08-12 15:04:33.78 -Distributor JBDistributor
2020-08-12 15:04:33.78 -DistributorSecurityMode 1
2020-08-12 15:04:33.78 -XJOBID 0x40AB86AB011ECA4A899B7478D326C1AF
2020-08-12 15:04:33.78 ————————————–
2020-08-12 15:04:33.78 Connecting to Distributor ‘JBDistributor’
2020-08-12 15:04:33.86 The replication agent had encountered an exception.
2020-08-12 15:04:33.86 Source: Replication
2020-08-12 15:04:33.86 Exception Type: Microsoft.SqlServer.Replication.ReplicationAgentException
2020-08-12 15:04:33.86 Exception Message: The snapshot could not be generated because the publisher is inactive.
2020-08-12 15:04:33.86 Message Code: 54057
2020-08-12 15:04:33.86

-> On the distributor server execute below command,

EXEC sp_helpdistpublisher

Check “Active” column in the output window and you will see value 0 for the publisher.

-> Execute below query to make it active,

EXEC sp_changedistpublisher  
@publisher = '<Publisher SQL Server Instance>'
,  @property = 'active'
, @value = 'true'
GO

EXEC sp_changedistpublisher  
@publisher = 'JBPUB-DR'
,  @property = 'active'
, @value = 'true'
GO

-> Start the snapshot agent and it will complete fine.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Leave a Reply