Recently I had configured transactional replication and later I wanted to disable the publishing and distribution settings but I was getting Microsoft SQL Server Error: 15517 which states that SQL Server could not disable publishing and distribution on ‘YourDBName’. Below is the error detail.
TITLE: Microsoft.SqlServer.ConnectionInfo ------------------------------ SQL Server could not disable publishing and distribution on 'YourDBName'. ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission. Changed database context to 'master'. (Microsoft SQL Server, Error: 15517) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2218&EvtSrc=MSSQLServer&EvtID=15517&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
Later I analysed the issue and used sp_changedbowner on the database and again tried to disable the publishing and distribution and this time I was successful. Insufficient privileges causes this error so I thought to share this information with you, if you will face this issue then you will be able to solve it.
When you get error 15517 – SQL Server could not disable publishing and distribution on ‘YourDBName’ then kindly solve it by.
USE <YourDBName> GO sp_changedbowner 'sa'
You can also solve this issue by executing:
ALTER AUTHORIZATION ON DATABASE::[YourDBName] TO [sa]
Reference: Manzoor Siddiqui [www.SQLServerLog.com]