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.
CMDB 8.x
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
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: