MsSql

关注公众号 jb51net

关闭
首页 > 数据库 > MsSql > SQL Server错误18752

SQL Server复制删除发布时遇到错误18752的问题及解决方法

作者:潇湘隐者

朋友反馈他无法删除一台SQL Server数据库上的发布,具体情况为删除一个SQL Server Replication的发布时,遇到这样的错误问题如何解决呢,下面小编给大家分享SQL Server复制删除发布时遇到错误18752的问题及解决方法,感兴趣的朋友一起看看吧

朋友反馈他无法删除一台SQL Server数据库上的发布,具体情况为删除一个SQL Server Replication的发布时,遇到下面错误

TITLE: Microsoft SQL Server Management Studio
------------------------------

无法删除发布“REPL_ITSMS”。

------------------------------
ADDITIONAL INFORMATION:

执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)

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

Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection with session ID 75 over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection with session ID 75 over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection with session ID 75 over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection with session ID 75 over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
Only one Log Reader Agent or log-related procedure (sp_repldone, sp_replcmds, and sp_replshowcmds) can connect to a database at a time. If you executed a log-related procedure, drop the connection with session ID 75 over which the procedure was executed or execute sp_replflush over that connection before starting the Log Reader Agent or executing another log-related procedure.
在执行 'sp_droppublication' 的过程中出错。调用 'sp_replcmds' 失败,错误代码: '18752',返回代码: '1'。
已将数据库上下文更改为 "itsms"。 (Microsoft SQL Server, Error: 18752)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=15.00.4312&EvtSrc=MSSQLServer&EvtID=18752&LinkId=20476

好久没有维护SQL Server数据库了,感觉生疏了很多,检查后发现其实出现这个错误,是因为一次只能有一个日志读取器代理或日志相关过程(sp_repldone、sp_replcmds 和 sp_replshowcmds)连接到某个数据库。 如果执行了一个日志相关过程,那么在启动日志读取器代理或者执行另一个日志相关过程之前,请删除执行第一个过程时所用的连接,或者在该连接上执行 sp_replflush。

其实,官方文档[1]关于错误代码18752有详细的说明,只要详细阅读文档,就能知道如何解决这个错误了。这里特此记录一下。具体如下所示:

说明

有多个当前连接正在尝试执行以下任一日志相关过程: sp_repldone、 sp_replcmds或 sp_replshowcmds。 sp_repldone (Transact-SQL) 和 sp_replcmds (Transact-SQL) 存储过程是日志读取器代理用于查找和更新已发布数据库中复制事务的相关信息的存储过程。 sp_replshowcmds (Transact-SQL) 存储过程用于排查某些类型的事务复制问题。

在以下情形下将引发此错误:

用户操作

以下步骤可以帮助您解决这个问题。 如果任何一个步骤能正确启动日志读取器代理,则没有必要完成剩余的步骤。

其实这里的解决方法也很简单,就是执行命令sp_replflush后,就可以正常的删除复制的发布了。

参考资料

[1]

1: https://learn.microsoft.com/zh-cn/sql/relational-databases/replication/mssql-eng018752?view=sql-server-ver16

到此这篇关于SQL Server复制删除发布时遇到错误18752的文章就介绍到这了,更多相关SQL Server错误18752内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文