Recently one of my client has faced weird situation related to SQL Server Replication. Their main database goes down so they started running mirroring database as a primary database, removed subscriber and distributor. Once they have setup primary server back properly, they have restored mirrored database backup to primary server.

Now situation is complicated as subscriber was removed, distributor was removed but in primary server, they are seeing publication as well as subscriber. They have already tried the way I have explained in one of my earlier article “Forcefully remove replication publisher, subscriber and distributor in SQL Server” but no luck.

When they tried to remove publication by pressing “Del” key after selecting “Publication” under “Replication” in SSMS, they faced following message.

TITLE: Microsoft SQL Server Management Studio
------------------------------
Could not delete publication 'SMXPPublisher'. For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1&EvtSrc=Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Replication.ReplicationMenuItem&EvtID=CantDeletePublication&LinkId=20476
------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ Cannot drop the publication because at least one subscription exists for this publication. Drop all subscriptions to the publication before attempting to drop the publication. If the problem persists, replication metadata might be incorrect; consult Books Online for troubleshooting information.
Changed database context to 'SMXP'. (Microsoft SQL Server, Error: 14005)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500&EvtSrc=MSSQLServer&EvtID=14005&LinkId=20476
------------------------------
BUTTONS: OK
------------------------------

Here is the screen capture of the error:

This is obvious message that they can’t delete Publisher until and unless they remove subscriber under publication but the twist is they have already deleted subscriber from the secondary server and primary server were down at that time so effect doesn’t came there so while deleting subscriber from the primary server, they were greeted with following message.

TITLE: Microsoft SQL Server Management Studio
------------------------------
"MARS:SMXPRepl" does not exist on the server anymore. Please refresh its parent tree node.
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1&EvtSrc=Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.Replication.ReplicationMenuItem&EvtID=ObjectNoLongerExists&LinkId=20476
------------------------------ BUTTONS: OK
------------------------------

Here is the capture for this error:

Now, there is a big question, how to remove this replication?

After getting in this clumsy situation, they have called me up to help. They needed very fast solution so I provided undocumented and dirty but yet workable way. Here is what I have asked them to perform and update me with the result.

Here is the small TSQL script I told them to run on primary server in replicated database.

USE master
EXEC sp_removedbreplication @dbname='smxp'
GO sp_dropsubscription @subscriber='smxprepl' sp_droppublication 'smxppublisher'

After executing above given commands, they were facing following error:

--Cannot drop the table 'dbo.MSpeer_lsns' because it is being used for replication.

Well, my suggestion now is to unmark “MSPeer_lsns” object from replication with following command and then try to execute above script to remove and drop replication.

sp_MSunmarkreplinfo 'MSpeer_lsns'

Again there wasn’t luck with them so finally I send them one more TSQL which did the magic.

DROP TABLE sysarticleupdates
DROP TABLE sysarticles
sp_removedbreplication 'smxp'
GO
DROP TABLE syspublications
DROP TABLE sysschemaarticles
DROP TABLE systranschemas
DROP TABLE syssubscriptions
DROP TABLE sysarticlecolumns
DROP TABLE MSpub_identity_range
DROP TABLE MSpeer_response
DROP TABLE MSpeer_request
DROP TABLE MSpeer_lsns
DROP VIEW sysextendedarticlesview

After executing above given TSQL script, it has removed everything related to replication. However, I don’t recommend this script for normal situation.

原文链接

Error Fix – Replication subscriber does not exist on the server anymore(删除Replication时报错的解决办法)的更多相关文章

  1. mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法

    首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not conn ...

  2. error: Failed to start domain lb error: Failed to activate service 'org.freedesktop.machine1': timed out 报错的解决办法

    能正常查看kvm虚拟机列表: virsh list 但在执行virsh start lb启动虚拟机时卡顿了好几秒,然后报以下错误: error: Failed to start domain lber ...

  3. 【LR11】Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误解决办法

      场景描述:被测系统是发布在远程服务器上的,假设IP是10.10.10.10,端口是8066,那么访问地址是http://10.10.10.10:8066/,在control机器上我设置了IP欺骗. ...

  4. android eclipse 报error loading /system/media/audio/ xxx 错的解决办法。

    只针对 报错..error   loading /system/media/audio/ xxx.ogg 一步操作 解决烦恼..把 模拟器声音 关了..所有的错 都没了. 包括 关闭按键声音,触摸声音 ...

  5. 安装“Microsoft SQL Server 2014 Management Objects”时报错"Error Writing to file: Microsoft.SqlServer.XEvent.Linq.dll."

    问题: 当安装的软件依赖Microsoft SQL Server 2014 Management Objects时,会把这个组件打进安装包里,但是在服务器上安装时却报如下错误: “Error Writ ...

  6. [AS3.0] Error #1069: Property onBWDone not found on flash.net.NetConnection and there is no default value.解决办法

    在运用FMS录制视频时,假如出现这个错误,最直接的解决办法如下: _netConnection.client = { onBWDone: function():void{ trace("on ...

  7. 【Runtime Error】打开Matlib7.0运行程序报错的解决办法

    1.在C盘建立一个文件夹temp,存放临时文件: 2.右键我的电脑-属性-高级系统设置-环境变量-系统变量,将TEMP.TMP的值改成C:\temp: 3.还是在第2步那里,新建变量,变量名称为BLA ...

  8. Mac上csv导入mysql提示错误[Error Code] 1290 - The MySQL server is running with the --secure-file-priv option解决办法

    1.进入mysql查看secure_file_prive的值 $mysql -u root -p mysql>SHOW VARIABLES LIKE "secure_file_priv ...

  9. 错误error: Exception at 0x613baa14, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance)的解决办法

    一.错误原因 出现这个错误的原因多半是由于指针出现错误,即出现了空指针,也有说是变量没有初始化,笔者碰到的情况是发生了内存溢出. 二.定位方法 一般这种问题直接导致程序崩溃,直接调试,就能找到对应的问 ...

随机推荐

  1. Centos iptables防火墙关闭启动详解

    CentOS .0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下 .直接关闭防火墙 systemctl stop firewalld.service #停止firewal ...

  2. Hibernate的Api以及三种查询方式

    Hibernate  Api |-- Configuration       配置管理类对象 config.configure();    加载主配置文件的方法(hibernate.cfg.xml) ...

  3. 详解Java中的final关键字

    本文原文地址:https://jiang-hao.com/articles/2019/coding-java-final-keyword.html1 final 简介2 final关键字可用于多个场景 ...

  4. java 正则例子

    1.不易开头.结尾:小数:圆角字符 包含数字.字母.圆角字符 不以<br/>开头.结尾,但中间可以存在 小数中的小数点是半角 正则表达式 "^(?!<br/>)(([ ...

  5. 在Java的反射中,Class.forName和ClassLoader的区别

    前言 最近在面试过程中有被问到,在Java反射中Class.forName()加载类和使用ClassLoader加载类的区别.当时没有想出来后来自己研究了一下就写下来记录一下. 解释 在java中Cl ...

  6. vue-cli + element-ui + webpack 新建项目

    1.进入项目目录 2.全局安装vue-cli 输入命令:npm install vue-cli -g 若报错:ENOENT: no such file or directory, access.... ...

  7. [转]centos7 移动mysql5.7.19 数据存储位置

    本文转自:https://blog.csdn.net/chpllp/article/details/78211351 场景:随着数据量的增加,mysql所在的磁盘已占满,需要将data移动到空间较大的 ...

  8. XML Parsing Error: no element found Location: moz-nullprincipal:{23686e7a-652b-4348-92f4-7fb3575179ed} Line Number 1, Column 1:^

    “Hi Insus.NET, 我有参考你下午发布的一篇<jQuery.Ajax()执行WCF Service的方法>http://www.cnblogs.com/insus/p/37278 ...

  9. 本地SQL数据库执行作业定时修改其他数据库内容

    --exec sp_addlinkedserver 'xkp', ' ', 'SQLOLEDB', '192.168.66.66'  定义链接--exec sp_addlinkedsrvlogin ' ...

  10. windows中80端口被System占用,PID=4的问题

    在windows中如果tomcat需要使用80端口,发现该端口已经被占用,而netstat -ano发现该80端口被一个System的进程占用了,而PID=4.我们可以通过下面的方式找到对应的进程,然 ...