web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 12,993 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
    18 Moderator on at
    RE: Importing .Bacpac database into .Bak using sqlpackage module fails

    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
    12,993 Most Valuable Professional on at
    RE: Importing .Bacpac database into .Bak using sqlpackage module fails

    Hello Nuno,

    Thanks.

    I will generate a new bacpac file and retry.

  • Suggested answer
    Komi Siabi Profile Picture
    12,993 Most Valuable Professional on at
    RE: Importing .Bacpac database into .Bak using sqlpackage module fails

    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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans