匯總複寫錯誤的疑難排解

不直接修改匯總資料庫資料

Ivanti 採取 SQL Server 複寫做為從發行者到訂閱者的單向交易複寫。如果您對於訂閱者修改「複寫的」資料,這些變更不會複寫到發行者。此外,發行者不會注意到這些變更。如果您要回溯這些變更,您必須使用 SQL Server 的複寫監控,並且使該發行者的快照無效,然後使用新的快照。

升級 Endpoint Manager 版本後的 ProductSnapshot 複寫錯誤

如果您看見下列錯誤訊息:

程序無法大量複製到表格 '"dbo"."PRODUCTSnapshot"'

問題是更新的核心伺服器之中的 ReplProductV 檢視並未與匯總資料庫中較舊的 ProductSnapshot 表格同步。

若要修正此錯誤,檢視需要符合架構。對於檢視和表格執行 sp_help,並確定「Nullable」欄相符。可能是 Version 和 ProductGUID 欄不同步。您可以修改匯總資料庫中的表格 (但是您也必須改變各個非更新的核心伺服器之中的檢視):

alter table productsnapshot alter column version nvarchar9255) not null

alter table productsnapshot alter column productguid nvarchar(255) not null

您也可以修改更新的核心伺服器之中的檢視。若要修改檢視,您必須停止在本機發佈的內容對話方塊中複寫該檢視。

欄位大小過大複寫錯誤

如果您在複寫監控中看見這個錯誤,問題是核心伺服器上的檢視和匯總資料庫上的表格有不相符的架構。雖然可能是欄的長度不符,不過這一般是欄的 NOT NULL 屬性不符。核心伺服器上的 Repl<tablename>V 與匯總資料庫的表格名稱之間的所有欄定義必須相符。

如果錯誤列出以 Snapshot 為結尾的表格時,該表格將做為匯總資料庫上的暫時表格。核心伺服器上的相對應檢視將不包含「Snapshot」這個字 (例如,ProductSnapshot = ReplProductV)。

ISA 和 IDE 表格的複寫錯誤

問題:使用較舊 (或更新) 版本的 Ivanti 資料庫,ISA 和 IDE 表格可能出現複寫錯誤。ISA 和 IDE 表格中的識別欄已經在 2011 年更名。

解決方法:複寫執行時,您需要捨棄 ISA 和 IDE 表格的訂閱和發行項。變更檢視,並且在 SELECT 子句中使用舊的識別欄名稱。建立檢視的 UNIQUE CLUSTERED 索引,並重新加入發行項和發行項篩選器。重新整理訂閱。最後,您可以按一下「快照代理程式狀態」視窗中的「開始」,也可以等候快照代理程式偵測變更。查看複寫監控,確定是否成功複寫資料。

使用以下的指令碼修正問題。確保 sp_dropsubscription 程序中使用的是您的訂閱者和資料庫 (<your subscriber server name> 和 <your subscriber database name>)。

--捨棄 ISA 表格的訂閱和發行項

sp_dropsubscription 'LDMS', 'ISACSO', '<your subscriber server name>', '<your subscriber database name>'

go

sp_droparticle @publication = 'LDMS', @article='ISACSO'

go

 

--變更 ISA 表格的檢視,並且在特定清單中使用舊的 ISAPorts_Idn 欄。

alter VIEW [dbo].[ReplISAV] (Computer_Idn, ISA_IDN, DeviceNum, Description, Designation, Location, Manufacturer, Type, COREGUID)

WITH SCHEMABINDING AS

SELECT isnull((b.Computer_Idn + 2097152), b.Computer_Idn) Computer_Idn, isnull(cast(b.ISAPorts_IDN as int), cast(0 as int)) ISAPorts_IDN, isnull(b.DeviceNum, 0) DeviceNum, b.Description, b.Designation, b.Location, b.Manufacturer, b.Type, isnull(cast(a.SYSTEMGUID as uniqueidentifier), cast(cast(0 as binary) as uniqueidentifier)) COREGUID

FROM dbo.METASYSTEMS a, dbo.ISA b

WHERE a.SYSTEM_IDN = 0

GO

 

--重建叢集索引

在 ReplISAV 上建立唯一的叢集索引 PKReplISAV (CoreGuid, Computer_Idn, ISA_Idn)

go

 

--將發行項和篩選器重新新增到發佈

sp_addarticle @publication = 'LDMS', @article='ISACSO', @source_object='ReplISAV', @destination_table='ISA', @type='indexed view logbased', @sync_object='ReplISAV', @pre_creation_cmd='delete', @schema_option=0x00, @status=24, @ins_cmd='CALL sp_LDins_ISA', @del_cmd='CALL sp_LDdel_ISA', @upd_cmd='MCALL sp_LDupd_ISA', @fire_triggers_on_snapshot='FALSE'

go

sp_articlefilter @publication = 'LDMS', @article='ISACSO', @filter_name='CoreGuidISA', @filter_clause='CoreGuid = cast(''C192290A-8FAC-4ABF-8183-D6B911ACFE73'' as uniqueidentifier)'

go

 

--捨棄 IDE 表格的訂閱和發行項

sp_dropsubscription 'LDMS', 'IDECSO', '<your subscriber server name>', '<your subscriber database name>'

go

sp_droparticle @publication = 'LDMS', @article='IDECSO'

go

 

--變更 IDE 表格的檢視,並且在特定清單中使用舊的 IDEPorts_Idn 欄。

ALTER VIEW [dbo].[ReplIDEV] (Computer_Idn, IDE_IDN, DeviceNum, Description, Designation, Location, Manufacturer, Type, ProdName, COREGUID)

WITH SCHEMABINDING AS

SELECT isnull((b.Computer_Idn + 2097152), b.Computer_Idn) Computer_Idn, isnull(cast(b.IDEPorts_Idn as int), cast(0 as int)) IDEPorts_IDN, isnull(b.DeviceNum, 0) DeviceNum, b.Description, b.Designation, b.Location, b.Manufacturer, b.Type, b.ProdName, isnull(cast(a.SYSTEMGUID as uniqueidentifier), cast(cast(0 as binary) as uniqueidentifier)) COREGUID

FROM dbo.METASYSTEMS a, dbo.IDE b

WHERE a.SYSTEM_IDN = 0

GO

 

--重建叢集索引

在 ReplIDEV 上建立唯一的叢集索引 PKReplIDEV (CoreGuid, Computer_Idn, IDE_Idn)

go

 

--將發行項和篩選器重新新增到發佈

sp_addarticle @publication = 'LDMS', @article='IDECSO', @source_object='ReplIDEV', @destination_table='IDE', @type='indexed view logbased', @sync_object='ReplIDEV', @pre_creation_cmd='delete', @schema_option=0x00, @status=24, @ins_cmd='CALL sp_LDins_IDE', @del_cmd='CALL sp_LDdel_IDE', @upd_cmd='MCALL sp_LDupd_IDE', @fire_triggers_on_snapshot='FALSE'

go

sp_articlefilter @publication = 'LDMS', @article='IDECSO', @filter_name='CoreGuidIDE', @filter_clause='CoreGuid = cast(''C192290A-8FAC-4ABF-8183-D6B911ACFE73'' as uniqueidentifier)'

go

 

--重新整理訂閱

sp_refreshsubscriptions @publication='LDMS'

go