Rajanand Ilangovan
Rajanand's Blog

Follow

Rajanand's Blog

Follow

How to fix "This database is not enabled for publication" issue when the replication option is already enabled in SQL Server?

Rajanand Ilangovan's photo
Rajanand Ilangovan
·Sep 25, 2022·

1 min read

Error

Msg 14013, Level 16, State 1, Procedure sp_MSrepl_addpublication, Line 188 This database is not enabled for publication.

I have used the below script to enable the database for replication option publish.

use master;
exec sp_replicationdboption 
@dbname = N'publisher_database_name', 
@optname = N'publish', 
@value = N'true'
GO

image.png

After this, I tried creating a publication and I was getting the same error once again.

Msg 14013, Level 16, State 1, Procedure sp_MSrepl_addpublication, Line 188 This database is not enabled for publication.

When I executed the above script once again, I got the below message.

The replication option 'publish' of database 'TyMetrix360' has already been set to true.

Solution:

To solve this issue, execute the script under the context of the same database you are trying to enable.

use publisher_database_name;
exec sp_replicationdboption 
@dbname = N'publisher_database_name', 
@optname = N'publish', 
@value = N'true'
GO

After this, I was able to create the publication.