当我们在生产服务器上尝试从汇总11升级到汇总13时,我们会在尝试升级数据库时收到与元数据缓存相关的错误,如下所示。以前有人见过这样的错误吗?有什么想法可以开始解决问题吗?
21:59:08 |错误| Microsoft.Crm.Tools.Admin.OrganizationDatabaseHotFixer期间发生异常:操作Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction失败。
的InnerException:
System.Reflection.TargetInvocationException:调用目标抛出了异常。 ---> System.ArgumentException:已添加具有相同键的项。
在System.Collections.Generic.Dictionary 2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Crm.Metadata.PreloadedOptionSetMetadataDataProvider.LoadNormalOptions(IPreloadedMetadataInitializationContext context, Boolean initializeEnumOptionProvider)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.InitializeOptionSets(IPreloadedMetadataInitializationContext context, LoadMasks masks, IOrganizationContext organizationContext)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.Initialize(IOrganizationContext organizationContext, MetadataContainer container, LoadMasks masks)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.CreateMetadataCacheDataProvider(MetadataContainer container, IOrganizationContext context, LoadMasks masks, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.BuildMetadataCacheFromMetadataContainer(MetadataContainer container, LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, IOrganizationContext context)
at Microsoft.Crm.Metadata.MetadataCache.LoadCache(IOrganizationContext context, Boolean fileOnlyIfExists)
at Microsoft.Crm.Metadata.MetadataCache.GetInstance(IOrganizationContext context)
at Microsoft.Crm.BusinessEntities.ExecutionContext.ProcessDependencies(FlushCacheOption option, CreateNewCollectorOption createOption)
at Microsoft.Crm.BusinessEntities.ExecutionContext.OnEndRequest()
at Microsoft.Crm.Setup.MetadataPatchService.ProcessMetadataDiffFile(String targetRevision)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
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)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase, Boolean isInstall)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.InstallUpdate(String configurationFilePath, Boolean upgradeDatabase)
at Microsoft.Crm.Setup.Common.Update.DBUpdateDatabaseInstaller.ApplyDBUpdates(Guid orgId)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdatesInternal(Guid orgId, String orgUniqueName, String releaseFilePath, Boolean ignoreErrors)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdates(Guid orgId, String orgUniqueName, OrganizationOperationType operationType)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.Do(IDictionary parameters)
at Microsoft.Crm.Setup.Common.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
InnerException:
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary
2.Insert(TKey键,TValue值,布尔加法)
在Microsoft.Crm.Metadata.PreloadedOptionSetMetadataDataProvider.LoadNormalOptions(IPreloadedMetadataInitializationContext context,Boolean initializeEnumOptionProvider)
在Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.InitializeOptionSets(IPreloadedMetadataInitializationContext context,LoadMasks mask,IOrganizationContext organizationContext)
在Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.Initialize(IOrganizationContext organizationContext,MetadataContainer容器,LoadMasks掩码)
在Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.CreateMetadataCacheDataProvider(MetadataContainer容器,IOrganizationContext上下文,LoadMasks掩码,CounterList计数器)
在Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.BuildMetadataCacheFromMetadataContainer(MetadataContainer容器,LoadMasks掩码,IOrganizationContext上下文,CounterList计数器)
在Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks掩码,CrmDbConnection连接,CrmTransaction事务,IOrganizationContext上下文,CounterList计数器)
在Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks掩码,IOrganizationContext上下文,CounterList计数器)
在Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod方法,CacheType类型,IOrganizationContext上下文)
在Microsoft.Crm.Metadata.MetadataCache.LoadCache(IOrganizationContext context,Boolean fileOnlyIfExists)
在Microsoft.Crm.Metadata.MetadataCache.GetInstance(IOrganizationContext context)
在Microsoft.Crm.BusinessEntities.ExecutionContext.ProcessDependencies(FlushCacheOption选项,CreateNewCollectorOption createOption)
在Microsoft.Crm.BusinessEntities.ExecutionContext.OnEndRequest()
在Microsoft.Crm.Setup.MetadataPatchService.ProcessMetadataDiffFile(String targetRevision)
答案 0 :(得分:3)
经过大量的谷歌搜索后,我找到了以下Microsoft KB来处理问题。我仍然不知道问题的根本原因,但KB文章中的脚本做了诀窍: