Home Service Manager

MP Import Fails

James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

I created a sealed MP to add one field to Incidents but when I try to import it I get the following error.

The management pack import failed. 

Errors (1):

Database error. {0} failed with exception: 

{1}

: Database error. MPInfra_p_ManagementPackInstall failed with exception: 

[MP ID: 274e0da6-3864-144c-4287-2c5489b19c3e][MP Version: 1.0.0.1][MP PKT: 6f3f805fe8620115] Database error. MPInfra_p_ManagementPackInstall failed with exception: 

Violation of PRIMARY KEY constraint 'PK_TypedManagedEntity'. Cannot insert duplicate key in object 'dbo.TypedManagedEntity'. The duplicate key value is (af16d689-7538-b05e-0d69-385bfdc01f51).

The statement has been terminated.


I can't seem to find out what the TypedManagedEntity table is for or why I'm getting the duplicate key error.


Thanks,

James

Answers

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Hi @James_Johnson

    Can you include your MP (or at least EntityTypes section of it)?

    Does it contains any properties marked as Keys?

    Geoff

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    Hi @Geoff_Ross

    Here is the full MP. The only thing I'm adding is one new string property to the incident class.

    <ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

     <Manifest>

      <Identity>

       <ID>RTS_IncidentDeptExt</ID>

       <Version>1.0.0.1</Version>

      </Identity>

      <Name>RTS_IncidentDeptExt</Name>

      <References>

       <Reference Alias="System">

        <ID>System.Library</ID>

        <Version>7.5.8501.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

       </Reference>

       <Reference Alias="Console">

        <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>

        <Version>7.5.7487.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

       </Reference>

       <Reference Alias="Alias_45da2b0e_d24a_4701_ae62_7f5b89030f4a">

        <ID>System.WorkItem.Incident.Library</ID>

        <Version>7.5.7487.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

       </Reference>

      </References>

     </Manifest>

     <TypeDefinitions>

      <EntityTypes>

       <ClassTypes>

        <ClassType ID="ClassExtension_5f2cf1a0_98e2_44b7_9523_0fb7b5bb5a4c" Accessibility="Public" Abstract="false" Base="Alias_45da2b0e_d24a_4701_ae62_7f5b89030f4a!System.WorkItem.Incident" Hosted="false" Singleton="false" Extension="true">

         <Property ID="WIDepartment" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />

        </ClassType>

       </ClassTypes>

      </EntityTypes>

     </TypeDefinitions>

     <Categories>

      <Category ID="RTS_IncidentDeptExt.Category" Value="Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">

       <ManagementPackName>RTS_IncidentDeptExt</ManagementPackName>

       <ManagementPackVersion>1.0.0.0</ManagementPackVersion>

      </Category>

     </Categories>

     <LanguagePacks>

      <LanguagePack ID="ENU" IsDefault="true">

       <DisplayStrings>

        <DisplayString ElementID="RTS_IncidentDeptExt">

         <Name>RTS_IncidentDeptExt</Name>

        </DisplayString>

        <DisplayString ElementID="ClassExtension_5f2cf1a0_98e2_44b7_9523_0fb7b5bb5a4c">

         <Name>IncidentDeptExt</Name>

         <Description>Extension of class Incident</Description>

        </DisplayString>

        <DisplayString ElementID="ClassExtension_5f2cf1a0_98e2_44b7_9523_0fb7b5bb5a4c" SubElementID="WIDepartment">

         <Name>WIDepartment</Name>

        </DisplayString>

       </DisplayStrings>

      </LanguagePack>

     </LanguagePacks>

    </ManagementPack>


    Thanks,

    James

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.

    James,

    It all looks great to me.

    What do you get if you run the following against your database?

    SELECT *
    	FROM [ServiceManager].[dbo].[TypedManagedEntity] TME
    JOIN BaseManagedEntity BME
    ON TME.BaseManagedEntityId = BME.BaseManagedEntityId
    WHERE TME.TypedManagedEntityId = 'af16d689-7538-b05e-0d69-385bfdc01f51'
    
  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    Hi @Geoff_Ross

    That query doesn't turn up any results.

    Thanks,

    James

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Just to rule out something (as basically because I'm a bit stumped here) can you also try:

    SELECT *
    	FROM [ServiceManager].[dbo].[TypedManagedEntity] TME
    WHERE TME.TypedManagedEntityId = 'af16d689-7538-b05e-0d69-385bfdc01f51'
    
  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    No result on that one either.

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    @Geoff_Ross not sure if it helps but this seems to be related to the incident class. I tried to import a MP that added an extension to both the Incident class and SR class. It was a single string for each of them. If I tried to import that MP I got the same error. Breaking it out into two separate MPs I could import the one for SR extension but the Incident one throws the error.

    Thanks,

    James

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    Does anyone else have any ideas why the import could be failing or where to start troubleshooting this?

    Thanks!

    James

  • Bryan_McCuenBryan_McCuen Customer IT Monkey ✭

    Hello,

    I ran into this same issue, and I did get results from the suggested query. It came back with one of my CI's. The MP I am importing does extend the Windows Computer Class so that makes sense...just not sure what to do with the query results now to fix the issue.

    Only using the one default primary key for the Windows Computer Class, principal name.

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭

    Hey @Adam_Dzyacky,

    Would you be able to help provide some insight for Bryan and I why importing a management pack is failing with Cannot insert duplicate key in object 'dbo.TypedManagedEntity'

    Thanks!

    James

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭

    Unfortunately not much more than what Geoff has covered here. It's syntactically correct, it seals, and imports for me. Is there perhaps another extension you've made in another MP where you've defined a key property for Incidents or Computers?

    Otherwise - I'd raise a ticket with Microsoft on this as this is such a core/fundamental process to SCSM.

Sign In or Register to comment.