web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Importing .Bacpac database into .Bak using sqlpackage module fails

(1) ShareShare
ReportReport
Posted on by 13,093 Most Valuable Professional

Good day everyone,

I am importing .bacpac db file into my dev environment to debug some integration issue after updating to 10.0.30.

I am using the SqlPackage wich, had always work for me in the past. I got stocked with the error below:

*** An unexpected failure occurred: Data plan execution failed with message One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (Violation of PRIMARY KEY constraint 'PK__CLASSIDT__D9C1FA0108BEBA49'. Cannot insert duplicate key in obje
ct 'dbo.CLASSIDTABLE'. The duplicate key value is (AADAuthenticationMonitoringAndDiagnostics).
The statement has been terminated.))).

What I have done so far?

I queried CLASSIDTABLE and deleted the record with "AADAuthenticationMonitoringAndDiagnostics".

After that, I retried the import and now got the following error.

*** Error importing database:Data cannot be imported into target because it contains one or more user objects. Import should be performed against a new, empty database.
Error SQL0: Data cannot be imported into target because it contains one or more user objects. Import should be performed against a new, empty database.

Is there a way, I can skip the skip the object importing part and move straight to the updating the table?

Thank you.

I have the same question (0)
  • nunomaia Profile Picture
    25 Moderator on at

    The bacpac file is not transactional, does not guarantee transactional consistency. If you have multiple transactions updating index
    when creating bacpac is being exported sometimes you can get corrupted data. The only way that I know is generating a new bacpac 

  • Komi Siabi Profile Picture
    13,093 Most Valuable Professional on at

    Hello Nuno,

    Thanks.

    I will generate a new bacpac file and retry.

  • Suggested answer
    Komi Siabi Profile Picture
    13,093 Most Valuable Professional on at

    Hello Nuno,

    I got it fixed.

    I create a new database with name different from AxDB.

    Imported the bacpac succesfully then renamed it to AxDB.

    All was fine.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans