如何重新安裝 Virtual Machine Manager 2012 R2 UR8 或更新版本

摘要

當您有 Microsoft System Center 2012 R2 Virtual Machine Manager (VMM 2012 R2) 安裝時,重新安裝 VMM 更新彙總套件 8 或更新的更新將會失敗。 此外,您會收到下列錯誤訊息中,而且您必須重新安裝 VMM:

時間: InnerException.Type: System.Data.SqlClient.SqlException、 InnerException.Message: 違規的主索引鍵條件約束 'PK_tbl_WLC_ServiceTemplate'。 無法在物件 'dbo.tbl_WLC_ServiceTemplate' 中插入重複的索引鍵。 重複的索引鍵值是 < key_value >。

重新安裝 Virtual Machine Manager

請依照下列步驟執行:

  1. 解除安裝 Virtual Machine Manager。 請選取 [保留資料庫選項。

  2. 開啟 SQL Management Studio,然後將連接到 Retained 資料庫。

  3. 執行下列預存程序: /****** Object: StoredProcedure [dbo].[prc_WLC_GetVNetworkAdapterByNicId] Script Date: 12/16/2015 2:13:12 AM ******/ -- ========================================================= -- Create date: 08/31/2007 -- Description: Get VNetworkAdapter for a given NicId -- ========================================================= ALTER PROCEDURE [dbo].[prc_WLC_GetVNetworkAdapterByNicId] @VNicId uniqueidentifier AS BEGIN DECLARE @error int SET @error = 0 SET NOCOUNT ON; SELECT [Name], [Description], [OwnerIdentifier], [CreationTime], vna.[ModifiedTime], [Accessibility], [ObjectState], [VNicId], [HWProfileId], [ParentType], [VirtualNetwork], [MACAddressType], [MACAddress], [IPv4AddressType], [IPv6AddressType], [PortId], [DeviceId], [NetworkAdapterType], [VMSubnetId], [VMNetworkId], [PortClassificationId], [PortProfileSetId], [VLanEnabled], [VLanId], [VmwAdapterIndex], [VmwPortGroup], [SlotId], [MACSpoofingEnabled], [EnableGuestIPNetworkVirtualizationUpdates], [VMNetworkOptimizationEnabled], [HostId], [LogicalSwitchId], [NetworkKBytesReadTieredPerfCounterID], [NetworkKBytesWriteTieredPerfCounterID], [VMNetworkServiceSetting], [UsesSriov], [IsUsedForHostManagement], [IPv4Addresses], [IPv6Addresses], [DefaultGateways], [DNSServers], [TemplateNicName], compliance.PortClassificationComplianceErrors AS [PortClassificationComplianceErrors], compliance.VMNetworkComplianceErrors AS [VMNetworkComplianceErrors] FROM dbo.tbl_WLC_VNetworkAdapter vna LEFT JOIN dbo.tbl_NetMan_VirtualNetworkAdapterCompliance compliance ON vna.VNicId = compliance.VirtualNetworkAdapterId WHERE VNicId = @VNicId SET @error = @@ERROR SET NOCOUNT OFF RETURN @error END IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[prc_RBS_UserRole_Add]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) SET NOEXEC OFF ELSE SET NOEXEC ON GO /****** Object: StoredProcedure [dbo].[prc_RBS_UserRole_Add] Script Date: 10/03/2007 12:13:45 ******/ ALTER PROCEDURE [dbo].[prc_RBS_UserRole_Add] ( @RoleID uniqueidentifier, @ProfileType tinyint, @Description nvarchar(2048), @Name nvarchar(256), @OwnerIdentifier nvarchar(256), @ParentUserRole uniqueidentifier, @LastUpdatedTimestamp datetime, @ShowPROTips bit, @VMNetworkMaximum smallint, @VMNetworkMaximumPerUser smallint, @VPNConnectionMaximum smallint, @VPNConnectionMaximumPerUser smallint, @VMNetworkVPNMaximumBandwidthInKbps bigint, @VMNetworkVPNMaximumBandwidthOutKbps bigint, @NATConnectionMaximum smallint = NULL, @NATConnectionMaximumPerUser smallint = NULL ) AS BEGIN TRAN SET NOCOUNT ON DECLARE @error int DECLARE @IsDuplicateName bit DECLARE @IsRoleAlreadyPresent bit SELECT @IsDuplicateName = [dbo].[fn_RBS_UserRole_NameExists](@RoleID, @ParentUserRole, @Name) -- This is especially used in Upgrade scenarios where we are inserting Administrator role SELECT @IsRoleAlreadyPresent = Count(RoleID) FROM [dbo].[tbl_RBS_UserRole] WHERE RoleID = @RoleID IF (@IsDuplicateName = 0 AND @IsRoleAlreadyPresent = 0) BEGIN INSERT INTO [dbo].[tbl_RBS_UserRole] ([RoleID] ,[ProfileType] ,[Description] ,[Name] ,[OwnerIdentifier] ,[ParentUserRole] ,[LastUpdatedTimestamp] ,[ShowPROTips] ,[VMNetworkMaximum] ,[VMNetworkMaximumPerUser] ,[VPNConnectionMaximum] ,[VPNConnectionMaximumPerUser] ,[VMNetworkVPNMaximumBandwidthInKbps] ,[VMNetworkVPNMaximumBandwidthOutKbps] ,[NATConnectionMaximum] ,[NATConnectionMaximumPerUser] ) VALUES ( @RoleID, @ProfileType, @Description, @Name, @OwnerIdentifier, @ParentUserRole, @LastUpdatedTimestamp, @ShowPROTips, @VMNetworkMaximum, @VMNetworkMaximumPerUser, @VPNConnectionMaximum, @VPNConnectionMaximumPerUser, @VMNetworkVPNMaximumBandwidthInKbps, @VMNetworkVPNMaximumBandwidthOutKbps, @NATConnectionMaximum, @NATConnectionMaximumPerUser ) -- Insert flattened tree of the hierarchy for this user role INSERT INTO [dbo].[tbl_RBS_UserRoleHierarchy] SELECT RoleId, ParentRoleId, hl FROM view_RBS_UserRoleParentChildRelation ur where ur.RoleID = @RoleID SELECT @error = @@ERROR END ELSE BEGIN SET @error = 50008 END SET NOCOUNT OFF COMMIT TRAN RETURN @error Go SET NOEXEC OFF -------------------------------------------------------------------------------------------- IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[prc_RBS_UserRole_CommonUpdate]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) SET NOEXEC OFF ELSE SET NOEXEC ON GO /****** Object: StoredProcedure [dbo].[prc_RBS_UserRole_CommonUpdate] Script Date: 10/03/2007 12:13:45 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[prc_RBS_UserRole_CommonUpdate] ( @RoleID uniqueidentifier, @Description nvarchar(2048), @OwnerIdentifier nvarchar(256), @Name nvarchar(256), @LastUpdatedTimestamp datetime, @ShowPROTips bit, @VMNetworkMaximum smallint, @VMNetworkMaximumPerUser smallint, @VPNConnectionMaximum smallint, @VPNConnectionMaximumPerUser smallint, @VMNetworkVPNMaximumBandwidthInKbps bigint, @VMNetworkVPNMaximumBandwidthOutKbps bigint, @NATConnectionMaximum smallint = NULL, @NATConnectionMaximumPerUser smallint = NULL ) AS SET NOCOUNT ON DECLARE @error int DECLARE @ParentUserRole uniqueidentifier DECLARE @IsDuplicateName bit DECLARE @OldName nvarchar(256) SELECT @ParentUserRole = [ParentUserRole], @OldName = [Name] FROM [dbo].[tbl_RBS_UserRole] WHERE [RoleID] = @RoleID IF (@OldName = @Name) BEGIN -- We are not changing role name. This is necessary if Admin has already an SSU1 and TA created SSU1, we should not error out here SELECT @IsDuplicateName = 0 END ELSE BEGIN SELECT @IsDuplicateName = [dbo].[fn_RBS_UserRole_NameExists](@RoleID, @ParentUserRole, @Name) END IF (@IsDuplicateName = 0) BEGIN UPDATE [dbo].[tbl_RBS_UserRole] SET [Description] = @Description, [OwnerIdentifier] = @OwnerIdentifier, [Name] = @Name, [LastUpdatedTimestamp] = @LastUpdatedTimestamp, [ShowPROTips] = @ShowPROTips, [VMNetworkMaximum] = @VMNetworkMaximum, [VMNetworkMaximumPerUser] = @VMNetworkMaximumPerUser, [VPNConnectionMaximum] = @VPNConnectionMaximum, [VPNConnectionMaximumPerUser] = @VPNConnectionMaximumPerUser, [VMNetworkVPNMaximumBandwidthInKbps] = @VMNetworkVPNMaximumBandwidthInKbps, [VMNetworkVPNMaximumBandwidthOutKbps] = @VMNetworkVPNMaximumBandwidthOutKbps, [NATConnectionMaximum] = @NATConnectionMaximum, [NATConnectionMaximumPerUser] = @NATConnectionMaximumPerUser WHERE [RoleID] = @RoleID SELECT @error = @@ERROR END ELSE BEGIN SET @error = 50008 END SET NOCOUNT OFF RETURN @error GO SET NOEXEC OFF

  4. 從原始安裝媒體安裝 VMM 2012 R2。 在某些情況下,可能無法正常啟動 VMM 服務。 不過,這種行為可以放心忽略這個時候。

  5. 套用更新彙總套件 (例如,更新彙總套件 7 或 8) 對應到 VMM 2012 R2 先前安裝的版本。 這是必要的資料庫才能正確運作。 如果您更新從發行版本 UR7 或 UR8 上方的 UR,您可以直接與該 UR 中更新。 您沒有安裝 UR7 或 UR8。 比方說,您可以安裝發行版本,直接到 UR14,升級,然後再執行在步驟 6 中的 [第二個指令碼。

  6. 您可以使用 SQL Management Studio VMM 資料庫上執行下列預存程序: /****** Object: StoredProcedure [dbo].[prc_WLC_GetVNetworkAdapterByNicId] Script Date: 12/16/2015 2:13:12 AM ******/ -- ========================================================= -- Create date: 08/31/2007 -- Description: Get VNetworkAdapter for a given NicId -- ========================================================= ALTER PROCEDURE [dbo].[prc_WLC_GetVNetworkAdapterByNicId] @VNicId uniqueidentifier AS BEGIN DECLARE @error int SET @error = 0 SET NOCOUNT ON; SELECT [Name], [Description], [OwnerIdentifier], [CreationTime], vna.[ModifiedTime], [Accessibility], [ObjectState], [VNicId], [HWProfileId], [ParentType], [VirtualNetwork], [MACAddressType], [MACAddress], [IPv4AddressType], [IPv6AddressType], [PortId], [DeviceId], [NetworkAdapterType], [VMSubnetId], [VMNetworkId], [PortClassificationId], [PortProfileSetId], [VLanEnabled], [VLanId], [VmwAdapterIndex], [VmwPortGroup], [SlotId], [MACSpoofingEnabled], [EnableGuestIPNetworkVirtualizationUpdates], [VMNetworkOptimizationEnabled], [HostId], [LogicalSwitchId], [NetworkKBytesReadTieredPerfCounterID], [NetworkKBytesWriteTieredPerfCounterID], [VMNetworkServiceSetting], [UsesSriov], [IsUsedForHostManagement], [IPv4Addresses], [IPv6Addresses], [DefaultGateways], [DNSServers], [TemplateNicName], compliance.PortClassificationComplianceErrors AS [PortClassificationComplianceErrors], compliance.VMNetworkComplianceErrors AS [VMNetworkComplianceErrors], [AccessControlListID], compliance.NetworkAccessControlListComplianceErrors AS [NetworkAccessControlListComplianceErrors] FROM dbo.tbl_WLC_VNetworkAdapter vna LEFT JOIN dbo.tbl_NetMan_VirtualNetworkAdapterCompliance compliance ON vna.VNicId = compliance.VirtualNetworkAdapterId WHERE VNicId = @VNicId SET @error = @@ERROR SET NOCOUNT OFF RETURN @error END GO

  7. 重新啟動 VMM 2012 R2 伺服器,並確定 VMM 服務成功啟動。

重新安裝高可用性的 Virtual Machine Manager (HAVMM)

如果要執行這項操作,請依照下列步驟執行:

  1. 針對 SCVMM 管理伺服器解除安裝。 當您執行這項操作,請選取所有的 HAVMM 節點上的 [保留資料庫] 選項。

  2. 開啟 SQL Management Studio,然後再連線到保留 VMM 資料庫。

  3. VMM 資料庫,請重新安裝 Virtual Machine Manager一節的步驟 3 中執行指令碼。

  4. 在第一個 [HAVMM] 節點中,請依照下列步驟執行:

    1. 選取現有的資料庫,VMM 2012 R2 安裝從原始安裝媒體。 附註在某些情況下,可能無法正常啟動 VMM 服務。 不過,您可以放心地忽略這種行為到目前為止。

    2. 套用最新先前的更新彙總套件 (UR8 或更新版本) 之前安裝您 VMM 伺服器解除安裝。

  5. VMM 資料庫中,執行安裝後期的指令碼中重新安裝 Virtual Machine Manager一節的步驟 6。

  6. 重複步驟 4 和 5 剩下的 HAVMM 節點重新安裝 VMM 伺服器上。

  7. 升級至最新可用的 UR 或已被核准執行您的環境,所有的 VMM 伺服器上的 UR,然後更新至最新的 VMM 代理程式,該 UR 層級的所有主機。

需要更多協助?

擴展您的技能
探索訓練
優先取得新功能
加入 Microsoft 測試人員

這項資訊有幫助嗎?

您對翻譯品質的滿意度為何?

會影響您使用體驗的因素為何?

是否還有其他的意見反應? (選填)

感謝您的意見反應!

×