PK_LicenseInUse primary key violation during NetworkInventoryTask.config configuration
search cancel

PK_LicenseInUse primary key violation during NetworkInventoryTask.config configuration

book

Article ID: 172612

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

Upgrades can fail while configuring Network Inventory with the following error:

PK_LicenseInUse primary key violation 

Environment

8.x

Cause

A primary key violation of the LicenceInUse table

Resolution

The following sql can be run to resolve the issue that can cause the primary key violation:

DECLARE @temp TABLE (LicensingPolicyGuid UNIQUEIDENTIFIER, ResourceGuid UNIQUEIDENTIFIER, CreatedDate DATETIME, ModifiedDate DATETIME)

insert into @temp select 'CD39B720-F871-11D2-8643-00104B74A9DF', ResourceGuid, min (CreatedDate), max (ModifiedDate) from LicenseInUse
where LicensingPolicyGuid in ('CD39B720-F871-11D2-8643-00104B74A9DF', '1eaa6e77-0f4e-44a8-a2b3-4a035bef3b71')
group by ResourceGuid

select * from @temp

delete from LicenseInUse where LicensingPolicyGuid in ('CD39B720-F871-11D2-8643-00104B74A9DF', '1eaa6e77-0f4e-44a8-a2b3-4a035bef3b71')

insert into LicenseInUse select * from @temp

IMPORTANT: Do not change any of the guids in the script above.