Error, "Line 434, Cannot insert duplicate key in object 'ResourceUpdateSummary'"

Article:TECH37929  |  Created: 2008-01-11  |  Updated: 2008-01-11  |  Article URL http://www.symantec.com/docs/TECH37929
Article Type
Technical Solution


Issue



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 '9bc22d17-c0cf-45d5-9a8f-d62bbafd955d' --asset costcenter

In certain conditions, the error below may be thrown:

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


Environment



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

Cause



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.


Solution



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 Cost Center Owner percentages for a resource, the percentages will be evenly split between all Cost Center Owners for the resource. For example, you manually add two Cost Centers to a resource and split the ownership percentages at 40 and 60 percent respectively; those percentages will become 50 and 50 percent after completing the following steps:

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

    --remove all entries from inv_cost_center_ownership
    TRUNCATE TABLE Inv_Cost_Center_Ownership

    --remove all entries from invhist_cost_center_ownership
    TRUNCATE TABLE InvHist_Cost_Center_Ownership

    --remove all records from ResourceInventoryHistory table for inv_cost_center_ownership class
    DELETE FROM ResourceInventoryHistory
    WHERE InvClassGuid = '4aafad02-4ef3-48ef-82e6-6822a82f8da5'

    --remove all records from ResourceUpdateSummary table for inv_cost_center_ownership class
    DELETE FROM ResourceUpdateSummary
    WHERE InventoryClassGuid = '4aafad02-4ef3-48ef-82e6-6822a82f8da5'

    --re-run asset cost center owners upgrade proc
    EXEC spConvertRAHistToSnapshotHist '9bc22d17-c0cf-45d5-9a8f-d62bbafd955d' --asset costcenter

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


Legacy ID



39762


Article URL http://www.symantec.com/docs/TECH37929


Terms of use for this information are found in Legal Notices