前些天部署了一套事務復制環(huán)境,訂閱端只需要最近五年的數(shù)據(jù)。
復制采用的是備份文件初始化,復制搭好后用了一個腳本在訂閱端刪除五年前的數(shù)據(jù)。
今天早上復制出問題了。出現(xiàn)了The row was not found at the Subscriber when applying the replicated command.的錯誤
導致堆積了大量的未分發(fā)命令。
--------------------------------------------------------------------------------------------------------------------------
解決方案1):
根據(jù)http://technet.microsoft.com/en-us/library/ms151331(v=sql.105).aspx
在分發(fā)數(shù)據(jù)庫上運行:
sp_helpsubscriptionerrors [ @publisher = ] 'publisher' , [ @publisher_db = ] 'publisher_db' , [ @publication = ] 'publication' , [ @subscriber = ] 'subscriber' , [ @subscriber_db = ] 'subscriber_db'
找到返回值中最大的xact_seqno
之后在訂閱端數(shù)據(jù)庫上運行:
sp_setsubscriptionxactseqno [ @publisher = ] 'publisher' , [ @publisher_db = ] 'publisher_db' , [ @publication = ] 'publication' , [ @xact_seqno = ] xact_seqno
但是,如果再次出現(xiàn)同樣的問題,還得重復同樣的步驟來忽略錯誤。
--------------------------------------------------------------------------------------------------------------------------
解決方案2):
通過在分發(fā)代理配置文件中設置Continue On Data ConsistencyErrors,直接跳過事務復制中的錯誤。(因為我根本就不關心5年前的數(shù)據(jù)的變更)
新聞熱點
疑難解答