Error while disabling distribution in replication setup

Ashfaq Pathan 1 Reputation point
2021-07-02T06:22:34.273+00:00

I was Setting up a Replication Between Azure SQL Manages Instance and SQL on-Premisses.
While deleting the distributor I have mistakenly deleted my distribution Database from Database > System Database Folder.

Now I am not able to Disable my Distributer and getting the below error.

111216-image.png

111178-image.png

Getting this below ERROR
TITLE: Microsoft.SqlServer.ConnectionInfo

------------------------------

SQL Server could not disable publishing and distribution on 'testsqlmi97.public.7ec90fc2a898.database.windows.net, 3342'.

------------------------------

ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Invalid object name 'sysschemaarticles'.
Changed database context to 'master'. (Microsoft SQL Server, Error: 208)
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-208-database-engine-error

------------------------------

BUTTONS:

OK

------------------------------

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,494 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CathyJi-MSFT 22,376 Reputation points Microsoft External Staff
    2021-07-02T07:52:44.82+00:00

    Hi @Ashfaq Pathan ,

    If your still have distribution.mdf and distribution.ldf, you can recreate the distribution database from attaching them. Then you can disable again the replication.

    If you deleted the distribution database, you also removed the files from the hard drivers and the recycle bin. Please try follow below steps to fix this.

    1. Create a new distribution database
    2. Stop SQL Server Services
    3. Copy/Paste the distribution_new files and rename them as the old distribution files database names
    4. Start SQL Server Service
    5. attach the database again
    6. Disable replication and distribution

    Please refer to the blog distribution DB was deleted by mistake to get detail steps information.


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.