Error on Line 373, 'Cannot insert duplicate key in object 'ResourceUpdateSummary''

Article:TECH37271  |  Created: 2007-12-21  |  Updated: 2007-12-21  |  Article URL
Article Type
Technical Solution


Certain Asset 6.5 upgrades are affected by the issue described in article 37874. When following the resolution in that article, the following line is executed against the Altiris database:

EXEC spConvertRAHistToSnapshotHist 'ED35A8D1-BF60-4771-9DDE-092C146C485A, 1466e770-4413-4517-a89d-6599b8a7f144' --asset-user, asset-department

In certain conditions, the error below may be thrown:

Server: Msg 2627, Level 14, State 1, Procedure spConvertRAHistToSnapshotHist, Line 373
Violation of PRIMARY KEY constraint 'PK_ResourceUpdateSummary'. Cannot insert duplicate key in object 'ResourceUpdateSummary'.
The statement has been terminated.


Notification Server 6.0 SP3 R6
CMDB Solution 6.5
Asset Management Solution 6.5


This is primarily an issue of timing.

By default in CMDB Solution 6.5, there is a Clean Ownership task scheduled to run at 10:00 a.m. and 10:00 p.m., which does some of the same work being done in step 4 in article 37874.

Having this task execute at any time between steps 2 and 4 of article 37874 can cause this issue to occur.


To prevent this issue from occurring, perform the resolution in article 37874 in a time frame such that the Clean Ownership task will not automatically run between steps 2 and 4.

If this issue has already occurred, use the following steps to recover the database to a valid post-upgrade state:

Important: If after this issue has occurred you have manually set any Asset User Owner percentages for a resource, the percentages will be evenly split between all Asset User Owners for the resource. For example, you manually add two Owners to a resource and split the ownership percentages at 40% and 60% respectively; Those percentages will become 50% and 50% after completing the following steps:

  1. Backup the Altiris database.
  2. Run the following SQL script against the Altiris database:

    --remove all entries from inv_ownership_details
    TRUNCATE TABLE inv_ownership_details

    --remove all entries from invhist_ownership_details
    TRUNCATE TABLE invhist_ownership_details

    --remove all records from ResourceInventoryHistory table for inv_ownership_details class
    DELETE FROM ResourceInventoryHistory
    WHERE InvClassGuid = '0cd0318b-ad51-4d38-8ea3-2612d12189de'

    --remove all records from ResourceUpdateSummary table for inv_ownership_details class
    DELETE FROM ResourceUpdateSummary
    WHERE InventoryClassGuid = '0cd0318b-ad51-4d38-8ea3-2612d12189de'

    --re-run asset user owners upgrade proc
    EXEC spConvertRAHistToSnapshotHist 'ED35A8D1-BF60-4771-9DDE-092C146C485A, 1466e770-4413-4517-a89d-6599b8a7f144' --asset-user, asset-department

  3. Run the Clean Ownership task found in Configuration > Solution Settings > CMDB Solution.

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices