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