SQL Server復(fù)制刪除發(fā)布時(shí)遇到錯(cuò)誤18752的問(wèn)題及解決方法
朋友反饋他無(wú)法刪除一臺(tái)SQL Server數(shù)據(jù)庫(kù)上的發(fā)布,具體情況為刪除一個(gè)SQL Server Replication的發(fā)布時(shí),遇到下面錯(cuò)誤
TITLE: Microsoft SQL Server Management Studio
------------------------------無(wú)法刪除發(fā)布“REPL_ITSMS”。
------------------------------
ADDITIONAL INFORMATION:執(zhí)行 Transact-SQL 語(yǔ)句或批處理時(shí)發(fā)生了異常。 (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.
在執(zhí)行 'sp_droppublication' 的過(guò)程中出錯(cuò)。調(diào)用 'sp_replcmds' 失敗,錯(cuò)誤代碼: '18752',返回代碼: '1'。
已將數(shù)據(jù)庫(kù)上下文更改為 "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
好久沒(méi)有維護(hù)SQL Server數(shù)據(jù)庫(kù)了,感覺(jué)生疏了很多,檢查后發(fā)現(xiàn)其實(shí)出現(xiàn)這個(gè)錯(cuò)誤,是因?yàn)橐淮沃荒苡幸粋€(gè)日志讀取器代理或日志相關(guān)過(guò)程(sp_repldone、sp_replcmds 和 sp_replshowcmds)連接到某個(gè)數(shù)據(jù)庫(kù)。 如果執(zhí)行了一個(gè)日志相關(guān)過(guò)程,那么在啟動(dòng)日志讀取器代理或者執(zhí)行另一個(gè)日志相關(guān)過(guò)程之前,請(qǐng)刪除執(zhí)行第一個(gè)過(guò)程時(shí)所用的連接,或者在該連接上執(zhí)行 sp_replflush。
其實(shí),官方文檔[1]關(guān)于錯(cuò)誤代碼18752有詳細(xì)的說(shuō)明,只要詳細(xì)閱讀文檔,就能知道如何解決這個(gè)錯(cuò)誤了。這里特此記錄一下。具體如下所示:
說(shuō)明
有多個(gè)當(dāng)前連接正在嘗試執(zhí)行以下任一日志相關(guān)過(guò)程: sp_repldone、 sp_replcmds或 sp_replshowcmds。 sp_repldone (Transact-SQL) 和 sp_replcmds (Transact-SQL) 存儲(chǔ)過(guò)程是日志讀取器代理用于查找和更新已發(fā)布數(shù)據(jù)庫(kù)中復(fù)制事務(wù)的相關(guān)信息的存儲(chǔ)過(guò)程。 sp_replshowcmds (Transact-SQL) 存儲(chǔ)過(guò)程用于排查某些類(lèi)型的事務(wù)復(fù)制問(wèn)題。
在以下情形下將引發(fā)此錯(cuò)誤:
如果某個(gè)已發(fā)布數(shù)據(jù)庫(kù)的日志讀取器代理正在運(yùn)行,而另一個(gè)日志讀取器代理試圖在同一個(gè)數(shù)據(jù)庫(kù)上運(yùn)行,則對(duì)第二個(gè)代理引發(fā)此錯(cuò)誤,并且此錯(cuò)誤將出現(xiàn)在代理歷史記錄中。
有時(shí)看起來(lái)像是有多個(gè)代理,則可能其中一個(gè)代理是執(zhí)行孤立進(jìn)程的結(jié)果。
如果啟動(dòng)了已發(fā)布數(shù)據(jù)庫(kù)的日志讀取器代理,而用戶(hù)在同一個(gè)數(shù)據(jù)庫(kù)上執(zhí)行 sp_repldone、 sp_replcmds或 sp_replshowcmds ,則在執(zhí)行存儲(chǔ)過(guò)程的應(yīng)用程序(如 sqlcmd)中將引發(fā)此錯(cuò)誤。
如果已發(fā)布數(shù)據(jù)庫(kù)的日志讀取器代理不在運(yùn)行狀態(tài),而用戶(hù)在執(zhí)行 sp_repldone、 sp_replcmds或 sp_replshowcmds 后沒(méi)有關(guān)閉用于執(zhí)行此過(guò)程的連接,則當(dāng)日志讀取器代理嘗試連接到數(shù)據(jù)庫(kù)時(shí)將引發(fā)此錯(cuò)誤。
用戶(hù)操作
以下步驟可以幫助您解決這個(gè)問(wèn)題。 如果任何一個(gè)步驟能正確啟動(dòng)日志讀取器代理,則沒(méi)有必要完成剩余的步驟。
檢查日志讀取器代理的歷史記錄,查找可能導(dǎo)致此錯(cuò)誤的其他任何錯(cuò)誤。 有關(guān)在復(fù)制監(jiān)視器中查看代理狀態(tài)和錯(cuò)誤詳細(xì)資料的信息,請(qǐng)參閱使用復(fù)制監(jiān)視器查看信息和執(zhí)行任務(wù)。
檢查 sp_who (Transact-SQL) 的輸出,了解連接到已發(fā)布數(shù)據(jù)庫(kù)的特定進(jìn)程標(biāo)識(shí)號(hào) (SPID) 。 關(guān)閉所有可能運(yùn)行 sp_repldone、 sp_replcmds或 sp_replshowcmds的連接。
重新啟動(dòng)日志讀取器代理。 有關(guān)詳細(xì)信息,請(qǐng)參閱啟動(dòng)和停止復(fù)制代理 (SQL Server Management Studio).
在分發(fā)服務(wù)器上重新啟動(dòng) SQL Server 代理服務(wù)(使之在群集中脫機(jī)或聯(lián)機(jī))。 如果計(jì)劃的作業(yè)有可能在任何其他 實(shí)例中執(zhí)行了sp_repldone 、 sp_replcmds 或 sp_replshowcmds SQL Server ,則也要為那些實(shí)例重新啟動(dòng) SQL Server 代理。 有關(guān)詳細(xì)信息,請(qǐng)參閱啟動(dòng)、停止或暫停 SQL Server 代理服務(wù)。
sp_replflush (發(fā)布服務(wù)器上對(duì)發(fā)布數(shù)據(jù)庫(kù)執(zhí)行 Transact-SQL) ,然后重啟日志讀取器代理。
如果錯(cuò)誤繼續(xù)出現(xiàn),請(qǐng)?jiān)黾哟淼娜罩居涗洸⒅付ㄈ罩镜妮敵鑫募?此操作可能會(huì)提供找到該錯(cuò)誤和/或其他錯(cuò)誤消息的步驟,具體取決于錯(cuò)誤的上下文。
其實(shí)這里的解決方法也很簡(jiǎn)單,就是執(zhí)行命令sp_replflush后,就可以正常的刪除復(fù)制的發(fā)布了。
參考資料
[1]
到此這篇關(guān)于SQL Server復(fù)制刪除發(fā)布時(shí)遇到錯(cuò)誤18752的文章就介紹到這了,更多相關(guān)SQL Server錯(cuò)誤18752內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- Java連接SqlServer錯(cuò)誤的完美解決方法
- 驅(qū)動(dòng)程序無(wú)法通過(guò)使用安全套接字層(SSL)加密與?SQL?Server?建立安全連接,錯(cuò)誤:“The?server?selected?protocol?version?TLS10?is?not?accepted?by?client
- 還原Sql?Server數(shù)據(jù)庫(kù)BAK備份文件的3種方式以及常見(jiàn)錯(cuò)誤總結(jié)
- sqlserver連接錯(cuò)誤之SQL評(píng)估期已過(guò)的問(wèn)題解決
- SQLServer 錯(cuò)誤: 15404,無(wú)法獲取有關(guān) Windows NT 組/用戶(hù) WIN-8IVSNAQS8T7\Administrator 的信息
- 由于系統(tǒng)錯(cuò)誤 126 (SQL Server),指定驅(qū)動(dòng)程序無(wú)法加載
相關(guān)文章
sqlserver 快速生成漢字的首拼字母的函數(shù)(經(jīng)典)
經(jīng)常要對(duì)姓名按拼音搜索,所以需要做如下函數(shù)來(lái)快速獲取首拼,需要的朋友可以參考下2012-05-05SQL數(shù)據(jù)庫(kù)存儲(chǔ)過(guò)程示例解析
這篇文章主要針對(duì)SQL數(shù)據(jù)庫(kù)存儲(chǔ)過(guò)程示例進(jìn)行解析,感興趣的小伙伴們可以參考一下2016-04-04sqlserver登陸后報(bào)不能為空不能為null的錯(cuò)誤
sqlserver登陸后報(bào)不能為空的錯(cuò)誤,參數(shù)名:viewinfo (microsoft.sqlserver.managemenmen),這個(gè)情況的解決方法如下2014-07-07SqlServer Mysql數(shù)據(jù)庫(kù)修改自增列的值及相應(yīng)問(wèn)題的解決方案
這篇文章主要介紹了SqlServer Mysql數(shù)據(jù)庫(kù)修改自增列的值及相應(yīng)問(wèn)題的解決方案的相關(guān)資料,需要的朋友可以參考下2016-01-01SQL Server誤區(qū)30日談 第20天 破壞日志備份鏈之后,需要一個(gè)完整備份來(lái)重新開(kāi)始日志鏈
事務(wù)日志備份會(huì)備份自上次事務(wù)日志備份以來(lái)所有的事務(wù)日志(如果從來(lái)沒(méi)有過(guò)日志備份的話,那就從上一次完整備份開(kāi)始)。有好幾種類(lèi)型的操作會(huì)中斷事務(wù)日志的連續(xù)性,也就是說(shuō)除非重新開(kāi)始新的日志鏈,SQL Server無(wú)法再進(jìn)行日志備份2013-01-01用sql腳本創(chuàng)建sqlserver數(shù)據(jù)庫(kù)范例語(yǔ)句
創(chuàng)建sqlserver數(shù)據(jù)庫(kù)腳本 范例 ,主要是熟悉下用sql語(yǔ)句創(chuàng)建數(shù)據(jù)庫(kù)的代碼。2010-09-09sql中參數(shù)過(guò)多利用變量替換參數(shù)的方法
工作中遇到一個(gè)需求,需要非常多的參數(shù),本文為大家介紹下sql中利用變量替換參數(shù)過(guò)多的方法,需要的朋友不要錯(cuò)過(guò)2014-01-01