Importing and Exporting Data in Microsoft Dynamics NAV 2015


In earlier versions of Microsoft Dynamics NAV, you could move or copy all or part of the data in a database by using the Microsoft Dynamics NAV backup functionality. In Microsoft Dynamics NAV 2013 R2, the support for the .fbk files was removed, but in Cumulative Update 8 for Microsoft Dynamics NAV 2013 R2, we introduced Windows PowerShell cmdlets so you can export data from a Microsoft Dynamics NAV database and import it into another Microsoft Dynamics NAV database. You can also export and import data in the Microsoft Dynamics NAV Windows client. This functionality is also included in Microsoft Dynamics NAV 2015.

You can export and import a single company or all companies in a database, and you can export and import other types of data such as global data, application data, and application objects. When you export data from a Microsoft Dynamics NAV database, the data is stored in a file with the extension .navdata, which is a new file format that is proprietary to Microsoft Dynamics NAV data. You cannot edit the .navdata files in other tools.

The data that you export is not deleted from the original database. So that means that you can use the functionality to essentially take a copy of your customer’s live data, leave them to continue working, while you import the data into an offline database back at your office for further debugging or other investigation. You can also use the .navdata files to move data to a new database, such as moving a company to a new database when you want to deprecate a database, for example.

Exporting and Importing Data in the Microsoft Dynamics NAV Windows Client

To export or import data, in the Search box, enter Data File, and then choose the related link.

To export data, you specify the type of data that you want to export, and when you choose the OK button, you specify where you want to save the file.

To import data, you specify the .navdata file to import data from, but you can’t import an application if the .navdata file contains an application. This is because you can’t overwrite the application that is currently open in the Microsoft Dynamics NAV Windows client. So the window has one less type of data that you can choose to import:

If you want to import an application into a Microsoft Dynamics NAV database, you must use the Import-NAVData Windows PowerShell cmdlet.

Windows PowerShell Cmdlets

The following table describes the Windows PowerShell cmdlets.

Name

Description

Export-NAVData

Exports data from a Microsoft Dynamics NAV database. You can export company-specific data, and you can choose to include global data, application data, or application objects.

Import-NAVData

Imports data into a Microsoft Dynamics NAV database from a file. You can import all data in the file, or you can choose to include specific companies, global data, application data, or application objects.

You can only import an application into an empty database.

Get-NAVDataFile

Gets information from a file that has been exported from a Microsoft Dynamics NAV database.

The extracted information includes the types of data that the file contains and any company names.

The cmdlets take different parameter sets depending on how you connect to the database that you want to export data from or import data into. You can access the database through the Microsoft Dynamics NAV Server instance, or you can access the database directly as described in the following table.

Access

Description

Through the Microsoft Dynamics NAV Server instance.

Use parameter sets that include –ServerInstance when the database that you want to access is mounted against a Microsoft Dynamics NAV Server instance.

The user account for the Microsoft Dynamics NAV Server instance must have access to write to the location that is specified by the –FileName parameter.

Through a direct connection to the database.

Use parameter sets that include –DatabaseServer and –DatabaseName when the Microsoft Dynamics NAV Server instance is stopped or not available. For example, if you want to import an updated application into a database, you stop the service so that users cannot access the database.

You must have access to write to the location that is specified by the –FileName parameter.

You can find more information about this functionality in the MSDN Library.

Comments (6)

  1. … MSDN Library

    Which includes the item …

    Dn789595.Warning(en-us,NAV.80).gifWarning

    When you export data to a .navdata file, you must import the data into a database that is compatible with the data in the .navdata file. For example, you cannot import a company into a database that has a different database schema, and you cannot import Microsoft Dynamics NAV 2013 data into a Microsoft Dynamics NAV 2015 database. Also, you must import a company into a database that contains the data and application that the company's data depends on.

    —–

    So exactly what use-case is this actually useful for?

  2. Jens Glathe says:

    @Robert: Nail, head, "bing!" 😉 @Microsoft: Are there further improvements planned that give us some useful functionality back? This is ridiculous as it is. You rip a working feature out, and replace it with a bunch of powershell commands that almost never wrok, by design? And you need 9 months for this? Come on?

  3. PalleA says:

    I am really trying to be positive on this matter…but as the documentation says "This functionality does not replace a sql backup"…It's true 🙁 You really have to be 112,5% sure of from WHAT you are trying to do a backup FROM in order to be able restore the backup TO a new database.

    If it does not get better = working then this option should be removed as soon as possible because doing a backup this way simply is to risky.

  4. js@agidon.dk says:

    Lets just hope this is the very last time MS removes functionality without having already replaced it. Or providing a fair replacement at removal time.

    Cmdlets are welcome though (and great Work on 2015 BTW).

  5. Good to see this is something you are working on and hopefulle you will expand and improve the functionality 🙂

  6. Arun Arya says:

    Hi, in nav 2013 R2 and 2015 the old scenario of backup and restore has completely changed. Now you have to do it through windows power shell.

    One problem is very common in this is that how you will restore fresh cronus backup.

    For this first you export all objects from the running cronus database and import these objects in fresh database which is with only system tables.

    Remember, the instance must be in running state for that database. Once you import these objects with validations, use windows power shell to import the navdata file with allcompanies and includeglobaldata.

    e.g. import-navdata -filename D:cronus.navdata -serverinstance dynamicsnav80 -tenant default -AllCompanies -IncludeGlobalData