CRM Organization Importing getting fail with Below error.Please help to resolve issue..
ystem.Exception: Error.ActionFailed Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction ---> Microsoft.Crm.CrmException: Error in Action: Bin\Microsoft.Crm.Setup.DiffBuilder.dll:Pass2 on attempt 3. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Crm.CrmException: Failed to process metadata description - Name: PrivilegeObjectTypeCode, ID: dda1ef28-e43d-4c8b-8934-19cdade41542 ---> System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Crm.Metadata.MetadataContainer.AddPrivilegeObjectTypeCode(IPrivilegeObjectTypeCodeDescription privilegeOtc)
at Microsoft.Crm.Metadata.MetadataContainer.AddDescription(IMetadataDescription description, String name)
--- End of inner exception stack trace ---
at Microsoft.Crm.Metadata.MetadataContainer.AddDescription(IMetadataDescription description, String name)
at Microsoft.Crm.Metadata.NonSharableMetadataCacheLoader.LoadDescriptions(IMetadataContainer metadataContainer, Dictionary`2 descriptionsCollection)
at Microsoft.Crm.Metadata.NonSharableMetadataCacheLoader.LoadContainerData(IMetadataContainer metadataContainer, Dictionary`2 descriptionsCollection, List`1 privilegesCollection, List`1 deletedDataCollection)
at Microsoft.Crm.Metadata.NonSharableMetadataCacheLoader.LoadContainerData(LoadMasks masks, ISqlDataAccess crmSqlDataAccesser, IMetadataContainer metadataContainer, List`1 fillProperties, CounterList counter)
at Microsoft.Crm.Metadata.NonSharableMetadataCacheLoader.BuildMetadataContainerFromDatabaseInternal(LoadMasks masks, ISqlDataAccess crmSqlDataAccesser, CounterList counter, Boolean isInStagedContext, BuildTableFillPropertiesTemplate buildTableFillProperties)
at Microsoft.Crm.Metadata.NonSharableMetadataCacheLoader.BuildMetadataContainerFromDatabase(LoadMasks masks, ISqlDataAccess crmSqlDataAccesser, CounterList counter, Boolean isInStagedContext)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.<>c__DisplayClass38_0.<LoadMetadataContainerFromDatabase>b__0(ISqlDataAccess crmSqlDataAccesser)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadMetadataContainerFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, CounterList counter, BuildMetadataContainerFromDatabaseTemplate buildMetadataContainerFromDatabase, Nullable`1 optionalVersionNumberToFilterResults)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadMetadataContainerFromDatabase(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, CounterList counter, Nullable`1 optionalVersionNumberToFilterResults, Boolean isInStagedContext)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, CounterList counter, Boolean isInStagedContext)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, CounterList counter, Boolean isInStagedContext)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, LoadMasks masks, IOrganizationContext context)
at Microsoft.Crm.Setup.MetadataCacheLoadHelper.LoadCacheFromDatabase(CacheType existingMetadataCacheType, LoadMasks masks, String connectionString, Guid organizationId)
at Microsoft.Crm.Setup.DiffBuilder.Pass2Internal(String metadataLocation, String languageCode, Boolean recalculateDependencies, String targetVersion)
at Microsoft.Crm.Setup.DiffBuilder.Pass2(String metadataLocation, String languageCode, String targetVersion)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.Crm.Setup.Database.DllMethodAction.Execute(Guid organizationId, Nullable`1 operationType)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.<>c__DisplayClass85_1.<ExecuteReleases>b__0()
at Microsoft.Crm.Setup.Database.DatabaseInstaller.<>c__DisplayClass85_1.<ExecuteReleases>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.installInternal(Boolean isInstall, Int32 languageCode)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.<>c__DisplayClass92_0.<Install>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.<>c__DisplayClass94_0.<InstallUpdate>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Setup.Common.Update.DBUpdateDatabaseInstaller.ApplyDBUpdates(Guid orgId, Nullable`1 operationType, Int32 langCode, String releaseFilePath)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdatesInternal(Guid orgId, String orgUniqueName, String releaseFilePath, OrganizationOperationType operationType, Boolean isXrm, Int32 langCode)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdates(Guid orgId, String orgUniqueName, OrganizationOperationType operationType, Boolean isXrm, Int32 langCode)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.Do(IDictionary parameters)
at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteActionHelper(CrmAction action, IDictionary parameters, Boolean undo)
--- End of inner exception stack trace ---
at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteActionHelper(CrmAction action, IDictionary parameters, Boolean undo)
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Setup.Shared.Installer.<>c__DisplayClass83_0.<DoAction>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Setup.Shared.Installer.<>c__DisplayClass67_0.<Install>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.Tools.Admin.OrganizationOperation.Install(IDictionary stateSaver)
at Microsoft.Crm.Tools.Admin.OrganizationOperation.Execute()
at Microsoft.Crm.Tools.Admin.OrganizationDBUpdateInstaller.Execute()
at Microsoft.Crm.Tools.Admin.ImportOrganizationInstaller.Import(Guid organizationId, String organizationUniqueName, String organizationFriendlyName, String sqlServerName, String databaseName, Uri reportServerUrl, ICollection`1 users, MultipleTenancy multipleTenancy, Boolean patchOnImport, OrgDbUpdateMode orgDbUpdateMode)
*This post is locked for comments
Executing the SQL solved the issue for our environment as well! Thanks for posting!
Dear All,
Issue has been resolved
As advised bu MS we had to run Some Sql Quires to solve the issue.
Thanks for Support from All
Select * From [dbo].[PrivilegeObjectTypeCodes]
Delete FROM [dbo].[PrivilegeObjectTypeCodes] where PrivilegeObjectTypeCode = 'dda1ef28-e43d-4c8b-8934-19cdade41542'
ALTER TABLE dbo.ReportBase DROP CONSTRAINT [cndx_PrimaryKey_Report]
IF OBJECT_ID('tempdb..#DropForeignKeysStatement') IS NOT NULL DROP TABLE #DropForeignKeysStatement
SELECT DropStatement = 'ALTER TABLE [dbo].[' + st.name + '] DROP CONSTRAINT [' + sfk.name + ']'
INTO #DropForeignKeysStatement
FROM sys.foreign_keys sfk
INNER JOIN sys.tables st ON sfk.parent_object_id = st.object_id
AND sfk.schema_id = st.schema_id
WHERE sfk.schema_id = schema_id('dbo')
SELECT DropStatement FROM #DropForeignKeysStatement
DECLARE dropStatementCursor CURSOR FOR
(SELECT DropStatement FROM #DropForeignKeysStatement);
OPEN dropStatementCursor;
DECLARE @currentStatement NVARCHAR(max);
FETCH NEXT FROM dropStatementCursor INTO @currentStatement;
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_executesql @currentStatement;
FETCH NEXT FROM dropStatementCursor INTO @currentStatement;
END
CLOSE dropStatementCursor;
DEALLOCATE dropStatementCursor;
IF OBJECT_ID('tempdb..#DropForeignKeysStatement') IS NOT NULL DROP TABLE #DropForeignKeysStatement
We managed to import from 8.2.2.112. Make sure to refresh the database from the backup (The V9 deployment manager is not cleaning up after a failure) and also that all servers has enough resources (RAM especially).
Yes I have tried all combinations . Like 8.2.2.0112 to 9.0.3.7 ,8.2.3 to 9.0.3.7 ,8.2.4 to 9.0.3.7 8.2.5 to 9.0.3.7
Have you tried installing the cumulative updates from below link..which is mentioned in the above blog post.. for fixing similar issue
support.microsoft.com/.../microsoft-dynamics-365-onpremise-cumulative-updates
Hi,
I already followed this thread and tried everything possible Still not yet solved..
Hi Sujith,
Refer to the below blog post which will provide you more information related to this error and fix for the same...
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6