Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

On Premise V9 Upgrade - Import Organization Fails with Exception: The constraint 'PK_topicmodelBase' is being referenced by table 'TopicModelExecutionHistoryBase', foreign key constraint 'topicmodel_topicmodelexecutionhistory'.

(0) ShareShare
ReportReport
Posted on by 40

Importing an organization from a version 8.2.1.176 on-premises deployment into a version 9.0.8.9 on-premises deployment fails with the exception in yellow below, but only in STAGE environment. That is, a backup of the same organization database from a few days prior was successfully imported into a single server version 9.0.8.9 on-premises deployment. 

Troubleshooting steps so far:

Read through all v9 upgrade posts on https://community.dynamics.com and https://d365ug.connectedcommunity.org/crmug

Based on that reading, I noticed that there are orphaned fulltext indexes on these tables but without a corresponding fulltext catalog record -  DocumentIndex, BusinessDataLocalizedLabelBase, and MultiSelectAttributeOptionValuesBase. 

Also, the suggestion was made to upgrade the existing version 8 deployment before importing those orgs into a version 9 environment which we would like to avoid if possible, especially since there's no guarantee of that working and it's relatively high risk.

I also opened a ticket with Microsoft but don't expect much after 3 days of silence.

Any help would be greatly appreciated.

Source deployment/organization: Multi-server deployment + SQL Loaded Balanced, no custom plugins or web resources;  Version 1612 (8.2.1.176) (DB 8.2.1.176) on-premises

Target deployment/organization: Multi-server deployment + SQL Loaded Balanced; Version 1612 (9.0.8.9) (DB 9.0.8.9) on-premises

Specific Error:

08:42:23| Info| CrmAction execution time; InstallOtherCRMSolutionsAction; 00:00:09.1892987
08:42:23| Info| Executing Install action: Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction
08:42:23|Verbose| Retrieving database base language code Data Source=MSERVER\AGINST2;Initial Catalog=MFAILUREDB_MSCRM;Integrated Security=True;Enlist=False;Connect Timeout=150;Application Name=MSCRMmmc;Workstation ID=MWORKS.mmc ...
08:42:23| Info| Database base language code: 1033.
08:42:23|Verbose| Begin: Check if CRM Solutions are installed Data Source=MSERVER\AGINST2;Initial Catalog=MFAILUREDB_MSCRM;Integrated Security=True;Enlist=False;Connect Timeout=150;Application Name=MSCRMmmc;Workstation ID=MWORKS.mmc
08:42:23|Verbose| End: Check if CRM Solutions are installed isXrmOrg = False
08:42:23| Info| Applying latest dbUpdates to organization. Id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, UniqueName=MFAILUREDB, langCode=1033
08:42:23| Info| Executing: action Microsoft.Crm.SE.DatabaseActions.dll:RegisterTransition with id 00000000-0000-0000-0000-0000000000ff of type DllMethod to Register that a database transition is occurring.
08:42:23| Info| Register that a database transition is occurring
08:42:23|Verbose| DatabaseAction execution time; Microsoft.Crm.SE.DatabaseActions.dll:RegisterTransition; 00:00:00.0156255
08:42:23| Info| Executing: action SetDefaultSchema.sql with id 00000000-0000-0000-0000-0000000000ff of type SqlScript to Sets current users default schema to dbo..
08:42:23| Info| Sets current users default schema to dbo.
08:42:23| Info| Did not detect single user -- not clearing pool
08:42:23|Verbose| DatabaseAction execution time; SetDefaultSchema.sql; 00:00:00.0156246
08:42:23| Info| Executing: action SetDefaultForExternalPartyOrgSettings.sql with id 5eaada5c-45ef-4162-8d81-6053653f69c4 of type SqlScript to Update ExternalPartyEnabled organization settings to default XML string...
08:42:23| Info| Executing: action Microsoft.Crm.SE.DatabaseActions.dll:DisableCacheSharing with id 00000000-0000-0000-0000-0000000000ff of type DllMethod to Disable shared caching.
08:42:23| Info| Disable shared caching
08:42:23|Verbose| DatabaseAction execution time; Microsoft.Crm.SE.DatabaseActions.dll:DisableCacheSharing; 00:00:00.0156250
08:42:23| Info| Executing: action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:Pass2 with id 656d7036-6ca0-4280-828f-3e7e9b08834b of type DllMethod to Metadata xml upgrade: pass 2.
08:42:23| Info| Executing: action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:RegenerateAllViews with id c013f4df-104a-4f51-8eb5-524b2ff7fea5 of type DllMethod to Upgrading the views in the MSCRM database.
08:42:23| Info| Executing: action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:FlushCaches with id b0f23885-3053-4a98-af66-2a9eb6c26f68 of type DllMethod to Reset metadata cache.
08:42:23| Info| Executing: action PreProcessSdkMessageProcessingStepsForArcSlaPlugins.sql with id 436968d0-8edc-4fde-9c30-8e9c40bf0eb4 of type SqlScript to Updates ARC,SLA related plugin records created by customers with values for SolutionId and customizationLevel attributes as system solutionId and 0 respectively.
08:42:23| Info| Executing: action Bin\Microsoft.Crm.SE.DatabaseActions.dll:Execute with id 24685d9f-0fa2-4543-a56a-cd47538dc133 of type DllMethod to Delete old SDK messages from system..
08:42:23| Info| Executing: action PostProcessSdkMessageProcessingStepsForArcSlaPlugins.sql with id bbd5fd4d-cea7-46f8-b1cb-e0487b183c3a of type SqlScript to Updates ARC,SLA related plugin records created by customers with default values for SolutionId and customizationLevel attributes.
08:42:23| Info| Executing: action Bin\Microsoft.Crm.SE.DatabaseActions.dll:Execute with id c0860c9d-3d58-46a9-9bf9-03ccaeccdb7d of type DllMethod to Delete old Ribbon components from system..
08:42:23| Info| Executing: action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:UpgradeSystemAndMetadataDiffIndexManagementDataWithDelete with id 343934bb-b5c9-4d63-ba3c-21fb63b0eae0 of type DllMethod to Diff indexes with delete for upgrade.
08:42:23| Info| Diff indexes with delete for upgrade
08:42:27| Info| Deleting standard index Name='PK_topicmodelBase'
08:42:27| Info| Action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:UpgradeSystemAndMetadataDiffIndexManagementDataWithDelete with id 343934bb-b5c9-4d63-ba3c-21fb63b0eae0 of type DllMethod to Diff indexes with delete for upgrade failed on attempt 2. Retrying in 30 seconds. Exception: Exception has been thrown by the target of an invocation.
08:43:00| Info| Deleting standard index Name='PK_topicmodelBase'
08:43:00| Info| Action Bin\Microsoft.Crm.Setup.DiffBuilder.dll:UpgradeSystemAndMetadataDiffIndexManagementDataWithDelete with id 343934bb-b5c9-4d63-ba3c-21fb63b0eae0 of type DllMethod to Diff indexes with delete for upgrade failed on attempt 3. Retrying in 30 seconds. Exception: Exception has been thrown by the target of an invocation.
08:43:33| Info| Deleting standard index Name='PK_topicmodelBase'
08:43:33| Error| Applying database updates to organization with name = MFAILUREDB Id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX failed with Exception:
Microsoft.Crm.CrmException: Error in Action: Bin\Microsoft.Crm.Setup.DiffBuilder.dll:UpgradeSystemAndMetadataDiffIndexManagementDataWithDelete on attempt 3. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: The constraint 'PK_topicmodelBase' is being referenced by table 'TopicModelExecutionHistoryBase', foreign key constraint 'topicmodel_topicmodelexecutionhistory'.
Could not drop constraint. See previous errors.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command)
at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass106_0.<InternalExecuteNonQuery>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at Microsoft.Crm.Metadata.IndexAndConstraintManagementService.ExecuteDropIndexOrConstraintInSqlIfExists(DropIndexData dropData, IDbCommand command, ISqlExecutionContext sqlContext)
at Microsoft.Crm.Metadata.IndexAndConstraintManagementService.DropIndexOrConstraintInSqlIfExistsInternal(DropIndexData dropData, ISqlExecutionContext sqlContext)
at Microsoft.Crm.Metadata.IndexAndConstraintManagementService.DropIndexesFromSQLByIndexIds(List`1 indexIds, ISqlExecutionContext sqlContext)
at Microsoft.Crm.Metadata.SqlStandardIndexHandler.DeleteIndexes(IIndexDiffManager indexDiffManager, ISqlExecutionContext sqlContext)
at Microsoft.Crm.Metadata.SqlStandardIndexHandler.ProcessIndexDiffManagerData(IIndexDiffManager indexDiffManager, IIndexMetadataProvider metadataProvider, ISqlExecutionContext sqlContext, Boolean processDeletes)
at Microsoft.Crm.Setup.IndexAndConstraintUpgradeService.UpgradeIndexManagementData(String metadataXmlPath, Boolean processDeletes, Boolean systemIndexesOnly, Boolean useMetadataDiffs)
at Microsoft.Crm.Setup.IndexAndConstraintUpgradeService.UpgradeSystemAndMetadataDiffIndexManagementDataWithDelete(String metadataXmlPath, String targetVersion)
--- End of inner exception stack trace ---

Source config: Full-text search for Quick find = Disabled; Quick Find - Select Entities for Search = Account, Treaty, Amendment, Miscellaneous, LOI, UserDefEntity, Contact, User

  • CRMDevPL Profile Picture
    CRMDevPL 40 on at
    RE: On Premise V9 Upgrade - Import Organization Fails with Exception: The constraint 'PK_topicmodelBase' is being referenced by table 'TopicModelExecutionHistoryBase', foreign key constraint 'topicmodel_topicmodelexecutionhistory'.

    We applied service update 9.08.9 to the server where the target deployment resides, which resolved the import issue from our 8.2 source organization.  However, as you stated, these are the steps we took:  In deployment manager, deleted the failed organization from your target deployment, drop the database for the failed organization, applied the service update to the target deployment server,  restart it, then re-import the 8.2 org into 9.0.8.9.

  • jdalske Profile Picture
    jdalske 536 on at
    RE: On Premise V9 Upgrade - Import Organization Fails with Exception: The constraint 'PK_topicmodelBase' is being referenced by table 'TopicModelExecutionHistoryBase', foreign key constraint 'topicmodel_topicmodelexecutionhistory'.

    Can you clarify this statement " Install the latest Service Update to bring the version or the target deployment to 9.0.8.9, then re-import."  I am having the same issue but I am not sure how to upgrade the database because everything else I read said to delete the failed Org and drop the database.  My deployment is up to date at 9.0.2.  I am bringing it over from 8.2.

    Thank  you in advance.

  • CRMDevPL Profile Picture
    CRMDevPL 40 on at
    RE: On Premise V9 Upgrade - Import Organization Fails with Exception: The constraint 'PK_topicmodelBase' is being referenced by table 'TopicModelExecutionHistoryBase', foreign key constraint 'topicmodel_topicmodelexecutionhistory'.

    The resolution to this issue was to Disable/Delete then drop the database of the Organization that had the error. Install the latest Service Update to bring the version or the target deployment to 9.0.8.9, then re-import.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans