Server Log Error - Unable to inventory certificate details for Resource, Data would be truncated

Problem

Numerous errors show up in the server logs saying:

Unable to inventory certificate details for Resource xxx 

( Exception Details: Altiris.NS.Exceptions.AeXException: Unable to update the specified item from the Altiris NS database ---> System.Data.SqlClient.SqlException: String or binary data would be truncated. 
The statement has been terminated. 
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) 
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) 
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() 
   at Altiris.NS.DataAccessLayer.Implementation.Altiris_NS_ResourceManagement_DataAccessLayerResourceManagementDataAccessLayer.spPartitionedResourceSave(String UpdateResourceProcName, Guid Guid, Guid ClassGuid, Guid ProductGuid, Int32 Attributes, String Name, String State, String Description, String ModifiedBy, String CreatedBy, Guid OwnerNSGuid, Nullable`1 ParentFolderGuid, Int32 IsManaged, Int32 IsDeleted, Int32& ItemCreated, String& OldName, Nullable`1& OldProductGuid) 
   at Altiris.NS.ResourceManagement.Resource.SaveResourceData(String userName, String& oldName, Guid& oldProductGuid) 
   at Altiris.NS.ResourceManagement.Resource.SaveResourceToDatabase(Boolean bSavingFromClone, String userName) 
   --- End of inner exception stack trace --- 
   at Altiris.NS.ResourceManagement.Resource.SaveResourceToDatabase(Boolean bSavingFromClone, String userName) 
   at Altiris.NS.ResourceManagement.Resource.SavePartitionedResource(Boolean bSavingFromClone) 
   at Altiris.NS.ItemManagement.Item.Create(Guid productGuid) 
   at Altiris.NS.ResourceManagement.Resource.Create(Guid productGuid) 
   at Arellia.SMP.Resource.ResourceItem2.CreateResourceViaItem(Guid resourceGuid, Guid resourceTypeGuid, String resName, Hashtable htKeys, Guid parentFolderGuid) 
   at Arellia.SMP.Resource.ResourceItem2.CreateResource(Guid proposedResourceGuid, Guid resourceTypeGuid, String resName, Hashtable htKeys, Guid parentFolderGuid) 
   at Arellia.SMP.Resource.ResourceResolver.ResolveResourceTypeKey(ResourceTypeKeyReference key, Guid ResourceType, Boolean MatchDerivedTypes, Boolean IncludePending) 
   at Arellia.SMP.Resource.Resources.DigitalCertificate.GetCertificateGuid(X509Certificate Cert, Boolean& IsExisiting) 
   at Arellia.SMP.FileInventory.InventoryAgents.SignedFileAgent.InventorySignedCms(SignedCms msg, IResourceDataTable2 rdtSigned2) 
   at Arellia.SMP.FileInventory.InventoryAgents.SignedFileAgent.ExtractCertificateDetails(IResourceData2 ResourceData) 
   at Arellia.SMP.FileInventory.Discovery.FileDigitalSignatureResourceDiscoverer.DiscoverResource(Guid ResourceGuid) ) 

The error is caused by a mismatch between Name length (250) and declared parameter @name length (255). SMP Reports that Name will be truncated but fails because of partitioned resource stored procedure issues.

Solution

  1. Log in to the Symantec CMDB database using SQL Enterprise Manager
  2. Run the following SQL Query:
declare @line nvarchar(max)
declare @text nvarchar(max) = ''
declare cur cursor for 
	select text from syscomments join sysobjects on syscomments.id = sysobjects.id 
	where sysobjects.name = 'spRM_Digital_Certificate_Update' and sysobjects.xtype = 'P'
open cur
fetch next from cur into @line
while @@FETCH_STATUS = 0
begin
	set @text = @text + @line
	fetch next from cur into @line
end
close cur
deallocate cur
set @text = REPLACE(@text, '@Name NVARCHAR (255),', '@Name NVARCHAR (250),')
set @text = REPLACE(@text, 'CREATE PROC dbo.[spRM_Digital_Certificate_Update]', 'ALTER PROC dbo.[spRM_Digital_Certificate_Update]')
exec sp_executesql @text