Ownership Details data class can't be displayed in the Resource Manager due to Index out of range exception.
search cancel

Ownership Details data class can't be displayed in the Resource Manager due to Index out of range exception.

book

Article ID: 157490

calendar_today

Updated On:

Products

CMDB Solution IT Management Suite

Issue/Introduction

While accessing Computer > Resource Manager > View > Inventory > Data classes > CMDB Data Classes > Ownership Details, Server Error in '/Altiris/Resource' Application occurs due to Index out of range exception.

Unhandled exception. Type=Altiris.NS.Exceptions.AeXException Msg=Unable to retrieve inventory data to the AeX database.
StackTrace=
at Altiris.Resource.UI.RM.RMInventoryHistoryProvider.GetData(Guid resourceGuid, String strDataTableName, Guid inventoryClass, ArrayList& columns)
at Altiris.Resource.Web.InventoryClassHistoryTab.get_snapshotSortedList()
at Altiris.Resource.Web.InventoryClassHistoryTab.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Inner exception. Type=System.ArgumentOutOfRangeException Msg=Index was out of range. Must be non-negative and less than the size of the collection.

Environment

CMDB 8.x

Cause

InvHist_Ownership_Details table contains records with SnapshotId smaller than MAX SnapshotId in the table InvHistAllRowsDeleted for the same resource. That is the key reason why out of range exception is thrown. To check the list of affected or not affected computers, following SQL query can be executed from the Microsoft SQL Server Management Studio:

-- query start

select distinct od._ResourceGuid as [Computer Guid],
vc
.Name as [Computer Name],
vc
.IsManaged,
COUNT
(iho._ResourceGuid) as [Total hist snapshots],
MAX
(ard.SnapshotId) as [InvHistAllRowsDeleted Max SnapshotID],
MIN
(iho.SnapshotId) as [InvHist_Ownership_Details Min Snapshot ID]
from
inv_ownership_details od
join vcomputer vc on od._ResourceGuid=vc.Guid
join
dbo.InvHist_Ownership_Details iho on od._ResourceGuid= iho._ResourceGuid
join
InvHistAllRowsDeleted ard on od._ResourceGuid=ard.ResourceGuid
group
by od._ResourceGuid , vc.Name,vc.IsManaged, InventoryClassGuid
having
InventoryClassGuid='0cd0318b-ad51-4d38-8ea3-2612d12189de'
and
max(ard.SnapshotId) > min(iho.SnapshotId) -- Replace the ">" symbol with "<" to check the list of not affected resources
order
by COUNT(iho._ResourceGuid) desc

--query end

Resolution

To remove all the problematic records from InvHist_Ownership_Details with SnapshotId smaller than MAX SnapshotId in the table InvHistAllRowsDeleted for each resource, please apply the following steps:

  1. Backup Symantec_CMDB
  2. Execute the following query:

    -- query start

    DELETE InvHist_Ownership_Details from InvHist_Ownership_Details
    inner
    join
    (SELECT DISTINCT ihd.ResourceGuid, MAX(ihd.SnapshotId) as SnapshotId
    FROM
    InvHist_Ownership_Details iho
    LEFT JOIN InvHistAllRowsDeleted ihd ON ihd.ResourceGuid = iho._ResourceGuid AND ihd.InventoryClassGuid='0cd0318b-ad51-4d38-8ea3-2612d12189de'
    GROUP
    BY ihd.ResourceGuid) tmp ON tmp.ResourceGuid = InvHist_Ownership_Details._ResourceGuid
    WHERE
    InvHist_Ownership_Details.SnapshotId < tmp.SnapshotId

    --query end
  3. Check again with the query from the Cause section if any resource is still affected as well as verify from the Resource Manager if the Ownership Details data class can be displayed now.