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

Error importing BACPAC file

(6) ShareShare
ReportReport
Posted on by 173
I am receiving the error below when importing  a BACPAC file into a new, local OneBox Dev environment.  I downloaded the VM from the Asset Library along with the most recent service update and customized package that we have installed in UAT.  I verified that the build # is the same using Help, About in the D365 client.
 
I exported and downloaded a BACPAC from our current UAT and am trying to import it to a NEW database on the DEV box.  I receive the error below during the Update Database step.  What does the Updating Database step do?  How can I work around this error?  
 
 
Importing to database 'AXDB3' on server 'localhost'.
Creating deployment plan
Initializing deployment
Verifying deployment plan
Analyzing deployment plan
Importing package schema and data into database
Updating database
*** Error importing database:Could not import package.
Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 2714, Level 16, State 5, Line 1 There is already an object named 'DF__CATVENDOR__RECVE__4BEECA1A' in the database.
Error SQL72045: Script execution error.  The executed script:
ALTER TABLE [dbo].[CATVENDORTEXTVALUETRANSLATION]
    ADD CONSTRAINT [DF__CATVENDOR__RECVE__4BEECA1A] DEFAULT ((1)) FOR [RECVERSION];

Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 1750, Level 16, State 1, Line 1 Could not create constraint or index. See previous errors.
Error SQL72045: Script execution error.  The executed script:
ALTER TABLE [dbo].[CATVENDORTEXTVALUETRANSLATION]
    ADD CONSTRAINT [DF__CATVENDOR__RECVE__4BEECA1A] DEFAULT ((1)) FOR [RECVERSION];
 
 
 
Thanks!
 
LJ
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    236,297 Most Valuable Professional on at
    Error importing BACPAC file
    Moved from Integration, Dataverse, and general topics forum to Finance | Project Operations, Human Resources, AX, GP, SL forum, because it seems to be about F&O and not about D365 in general, Dataverse or so.
     
    How are you importing the DB?
  • Raj Borad Profile Picture
    1,337 on at
    Error importing BACPAC file
    Hi @lispyj,
     
    Error indicates the target DB already has the constraint "DF__CATVENDOR__RECVE__4BEECA1A", so when sync process tries to add it again, it fails. This might happens if the imported BACPAC already matches or partially matches the available model schema.
    Did you run Update Model Database immediately after importing, or did you first drop the default 'AXDB'? Removing duplicate constraints before sync could resolve it.
     
    Thank you,
    Raj D Borad
  • lispyj Profile Picture
    173 on at
    Error importing BACPAC file
    The original AXDB database has been renamed.  I have tried importing as AXDB and as AXDB3.  The same error occurs.  The new database gets created, and does remain after the error.  
     
    To import the database, I am using the command below: (per the instructions at this link: Import a database - Finance & Operations | Dynamics 365 | Microsoft Learn)
     
    SqlPackage.exe /a:import /sf:D:\Exportedbacpac\my.bacpac /tsn:localhost /tdn:AXDB3 /p:CommandTimeout=1200 /targetencryptconnection:false
     
    Thank you for your assistance!
     
    LJ
     
     
  • Suggested answer
    DAnny3211 Profile Picture
    11,376 on at
    Error importing BACPAC file

    Hi there 👋

    Thanks for sharing the details!

    The error you're encountering during the Update Database step of the BACPAC import—specifically:

    "There is already an object named 'DF__CATVENDOR__RECVE__4BECCA1A' in the database."

    —indicates that the import script is trying to add a constraint that already exists in the target database.

    ✅ Here are a few suggestions to resolve this:

    1. Drop the existing database before import
      If you're importing into a reused or partially initialized database, residual objects may conflict with the BACPAC. Try dropping the AXDB3 database completely and creating a fresh one before importing.

    2. Use SQL Server Management Studio (SSMS)

      • Open SSMS and connect to your local SQL Server instance.
      • Delete the existing database (AXDB3) if present.
      • Re-import the BACPAC using the Import Data-tier Application wizard.
    3. Check for duplicate constraints
      If you must import into an existing database, manually check for the constraint DF__CATVENDOR__RECVE__4BECCA1A and drop it before import.

    4. Review the BACPAC schema
      If possible, extract the schema from the BACPAC and inspect the CATVENDORTEXTVALUESTRANSLATION table to ensure no duplicate constraints are defined.

    💡 The Update Database step applies schema changes and constraints after data import—so any conflicts here usually relate to structure, not data.

    Hope this helps!
    ✅ Please mark this reply as helpful if it answered your question.
    Best regards! 👋

  • Verified answer
    lispyj Profile Picture
    173 on at
    Error importing BACPAC file
    Thank you for the suggestions everyone.  I have gotten past the error and the tables are now populating in the Dev database.
     
    To fix this issue, I extracted a copy of the model.xml file from the BACPAC archive.  I searched for the constraint that was causing the error. (DL_CATVEND.....) and removed that element from the file. I modified my import command to: 
    SqlPackage.exe /a:import /sf:D:\Exportedbacpac\my.bacpac /tsn:localhost /tdn:AXDB3 /p:CommandTimeout=1200 /targetencryptconnection:false /modelfilepath:d:\myModelCopyFilePath
     
     
    It is important to note that WE DO NOT UTILIZE THIS FILE IN D365.  IT HAS NO DATA. Once I finish the import, I will sync the database.  
     
    I am hopeful that I have fully fixed the issue.
     
    Thanks again for the suggestions.
  • Suggested answer
    Cyrille Nembot Profile Picture
    149 on at
    Error importing BACPAC file

    The error you're encountering during
    the BACPAC import is related to a constraint naming conflict in your
    database. Let me explain what's happening and how to resolve it.

    Understanding the "Updating Database" Step

    The
    "Updating Database" step in the BACPAC import process is where SQL
    Server applies schema modifications and constraints to make the imported
    database fully functional. This includes:

    • Creating constraints (like defaults, foreign keys)

    • Building indexes

    • Setting up security objects

    • Finalizing the schema structure

    The Specific Error

    The error indicates that there's already a constraint named DF__CATVENDOR__RECVE__4BEECA1A in your target database (AXDB3), but the BACPAC is trying to create another constraint with the same name.

    Root Cause

    This typically happens because:

    1. The BACPAC contains auto-generated constraint names (those starting with DF__) which are not deterministic

    2. Your target environment already has some schema objects (perhaps from a previous failed import attempt)

    3. There might be residual objects in the target database

    Solutions

    Option 1: Clean Import to a Fresh Database

    1. Drop the existing AXDB3 database completely before importing:

      sql
       
    1. USE master;
      ALTER DATABASE AXDB3 SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
      DROP DATABASE AXDB3;
    2. Create a new empty AXDB3 database

    3. Retry the BACPAC import

    Option 2: Use SQLPackage with Schema Only Import

    1. Extract just the schema first:

      text
       
    1. SqlPackage.exe /Action:Export /SourceServerName:localhost /SourceDatabaseName:UAT_DB /TargetFile:schema.dacpac
    2. Then import data separately

    Option 3: Modify the Import Process

    1. Use the SqlPackage.exe utility with the /p:DropConstraintsNotInSource=true parameter

      text
       
    1. SqlPackage.exe /Action:Import /TargetServerName:localhost /TargetDatabaseName:AXDB3 /SourceFile:yourfile.bacpac /p:DropConstraintsNotInSource=true

    Option 4: Edit the BACPAC (Advanced)

    1. Rename the constraint in the BACPAC file before importing

    Prevention for Future Imports

    To avoid this issue:

    1. Always import to a clean database

    2. Consider using deterministic constraint naming in your development process

    3. Document all manual changes to the database schema

  • lispyj Profile Picture
    173 on at
    Error importing BACPAC file
    Thank you so much for the replies.  Cyrill,  what I am trying to understand with the 'Updating Database' step is where are the instructions coming from?  What schema is it comparing to? The target database is new and is created by the import. Am I correct that the SQLPackage import process is strictly a SQL process, and doesn't relate to any files in the AOSService\LocalPackagesDirectory?
     
    I have come to believe that the Model.xml is somehow incorrect in the download.  I didn't want to take the time to recreate the BACPAC, but I wonder if a full synchronization before creating the download would have corrected the issue.  I also think that dropping the index/constraint in the database before creating the BACPAC would also have resolved the issue.  Neither of those provide a reason for the error, though.
     
    LJ

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,167

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 617 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans