I like to setup a publication (transactional replication) on a SQL Server 2014 database which is part of an availability group. We have a primary and one secondary (non-readable) replica.
On the instance I have already another running publication. The distributor is running outside of the availability group, even on a different domain.
Initially the set up of the distributor was done on the other replica (which is currently the secondary). Also the other existing publication was initially created on the other hosts. That's the first publication I have to create after I did a failover of the availability group to the secondary.
Running the following command on the database to publish
EXEC sp_replicationdboption @dbname = 'mydatabase', @optname = N'publish', @value = N'true';
I received the following error:
Msg 20028, Level 16, State 1, Procedure sp_MSpublishdb, Line 56 [Batch Start Line 0]
The Distributor has not been installed correctly. Could not enable database for publishing.
I wonder why that occur as I have already on publication up and running on another database without any error and also working properly.
Checked the management logs doesn't help as nothing was logged. After cross checking the distributor I saw also that the publisher is registered properly.
Any ideas what could be issues here?