Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Failed to import Dynamics CRM organization

(0) ShareShare
ReportReport
Posted on by 5

Hi there,

I got the following errors while trying to import CRM organization from 1 environment to another environment. I know the custom table that it complained does not have primary key violation. I've also tried to remove all key constraints in DB level before reimporting but didn't work. Hope anyone can share some light. Thanks

15:51:29| Error| The following connections need to be closed before setup can continue:
15:51:29| Error| Login: CRM\crmservice, Host: Win2019.mmc, Database: xxxxxx_MSCRM, User: crmservice, Program: MSCRMmmc
15:51:29|Warning| Check SqlConnectionValidator : Warning: Existing SQL Server connections to the Dynamics 365 databases must be closed before setup can continue.
15:51:29|Verbose| Connecting to database Data Source=Win2019;Initial Catalog=xxxxxx_MSCRM;Integrated Security=SSPI.
15:51:30| Error| Check SqlPrimaryKeyConstraintValidator : Failure: Violation of PRIMARY KEY constraint 'PK__#Invalid__59D49277BDDB8448'. Cannot insert duplicate key in object 'dbo.#InvalidPrimaryKeys'. The duplicate key value is (CustomEntityBase, CustomEntityId).
The statement has been terminated.

  • melekgoncu Profile Picture
    melekgoncu 6 on at
    Failed to import Dynamics CRM organization
    Hi,
     
    I cannot import (upgrade) the organizations from 8.2 and I got the same error.
    I didn't find ActualDecimal key in GoalBase table. The primary key was PK_GoalBase therefore when I tried DROP CONSTRAINT[PK_GoalBase(It is a default system key)] gave an error in SQL.
    error: "The constraint 'PK_GoalBase' is being referenced by table 'GoalBase', foreign key constraint 'goal_rolluperror_goal'."
     
    Am I trying to drop the wrong CONSTRAINT? Should I try with the name PK__#ActualC__59D492772A37C6B5 ?
    How can I fix it? Thanks.
     
     
    17:27:26|  Error| Check SqlColumnValidator : Failure: Violation of PRIMARY KEY constraint 'PK__#ActualC__59D492772A37C6B5'. Cannot insert duplicate key in object 'dbo.#ActualColumns'. The duplicate key value is (GoalBase, ActualDecimal).
    17:27:26|Verbose| Connecting to database Data Source=XXXXXXX;Initial Catalog=master;Integrated Security=SSPI.
    17:27:26|  Error| The following connections need to be closed before setup can continue:
    17:27:26|  Error|     Login: Domain\user, Host: XXXXXXX.mmc, Database: XXXXX_MSCRM, User: XXX, Program: MSCRMmmc
     
  • kensi Profile Picture
    kensi 5 on at
    RE: Failed to import Dynamics CRM organization

    That works!! Thanks

  • Verified answer
    Ken Hubbard Profile Picture
    Ken Hubbard on at
    RE: Failed to import Dynamics CRM organization

    Hello Kensi, 

    I believe this exception is that the system is trying to recreate the Primary Key on the table in question, but the primary key that exists is the same and not the expected value so it violates table structure when trying to create the same primary key that exists.  You can try resolve this through the following steps:

    1. In SSMS identify the Primary Key of the table in question through the following query:

    SP_Helpindex [TABLENAME]

    2. Once you identify the name of the Primary Key index you can drop this index through the following SQL query:

    ALTER TABLE [TABLENAME]

    DROP CONSTRAINT [PK_CONSTRAINT]

    After this is complete, run the upgrade again and see if you get past this point. 

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans