Copy Data From One Partition To Another Using The Data Import Export

Creating new partitions is a great way to create new instances of Dynamics AX without the overhead of creating new databases, and installing new AOS servers, because it piggybacks on the existing infrastructure you have. But it also means that you need to set up all of the data in the partition because it start’s off as a blank system… or do you? Dynamics AX has an inbuilt export and import function that allows you to export out all of the data in one partition and then import it into another.

Duplication has never been so easy.

How To Do It…

The first step in the process is to create an export from your original database partition. To do this click on the Definition Groups menu item within the Data Export/Import folder of the Common group within the System Administration area page.

When the Definition Groups maintenance form is displayed, click on the New button within the menu bar to create a new record.

When the Create Table Definition Group dialog box is displayed, assign your record a Definition Group code and Description.

Then switch to the Include Table Groups tab within the dialog box. This will show you all of the different types of data that you want to export. By default all of the codes and controls are marked to be exported, which would allow you to create a export template for a new company partition.

In this case though we will select all of the table groups so that we can export the entire database and all of the transactions.

When you have selected the table groups that you want to export, just click the OK button to finish the setup.

Now we can create an export file. To do this, click on the Export button within the menu bar of the Definition Groups maintenance form.

When the Export Options dialog box is displayed, click on the folder icon to the right of the File Name field and define a new file and location for the export.

Also, select the File Type of export that you want to perform. This can either be Comma for simple exports, or Binary for when you have a database that you want to retain carriage returns etc. in the data.

Now just wait for the export to complete.

After the export has completed, you should see a .dat, and .def file within you export folder containing all of the information from the company.

Now we can import all of the data into our empty target partition. To do that open up the target partition, and then create a definition group that matches the one that we used within the source database for the export.

Then click on the Import button within the menu bar of the Definition Groups maintenance form, point the File Name to your file that you created during the export, and click on the OK button.

The import will first analyze the data within the export file and check for possible problems.

You may get a couple of dialog boxes that indicate that there are fields or parameters that don’t exist in the target database, buy just throw caution to the wind, and click on the Yes button.

Also the Import will ask you if you want to clean out some of the tables. Don’t select any of them, because Dynamics AX will merge the data in the common tables like UOM etc. for you. Continue by clicking on the OK button.

When the merge confirmation box is displayed, click on the Yes button.

Then just let Dynamics AX do all of the hard work for you.

How It Works…

When it finishes you will see all of your data is now set up in your new partition.

That was a way simpler way to load a demo within R3 than I was originally thinking that I would have to do it J

3 comments
  1. Tomas Viklund said:

    I advise for caution using this method to copy partition data.

    If you have setup account structures, posting profiles and other templates connecte to financial setup, using .dat/def files to copy a partition to another AX instance simply does not work and renders the target environment in a corrupt state. Dat/def can however be used to copy simpler parameter setup.

    There is simply no easy way to transfer all partition data from one instance to another.
    You could use DIXF to transfer specific entities but hardly the entire partition.
    I also evaluated Test data transfer tool but as it does not recalculate recid-values it could not be used as it would cause duplicates on RECID level in target environment (systemsequences table is not partitioned).

    We solved the problem in a VERY unsupported way, by extracting data from all tables containing the PARTITION key in the source system, for these tables identifying all fields containing RECID data (not only RECID column), analyzing systemsequences in the target environment to ensure we have no duplicates on RECID indexes, increasing recid value in ALL source-fields containing RECID data with a static large number (100.000 or more may be needed to avoid duplicates), then inserting all records to target using tsql INSERT INTO, lastly handling the PARTITIONS table and updating target systemsequences.
    You have to bulk-increase all recids befors insert to avoid duplicates in target environment and to ensure consistency is maintained in the copied partition.

    Recommended and supported solution? Definitly NO!
    But only way we could figure out to solve the problem to copy our partition.
    FYI

    • Tomas, you are definitely right – when copying data this way you definitely need to watch for the data inconsistencies. Thanks for the comment.

Leave a comment