Converting a Database

If your current solution is based on Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2, you must convert the database to the Microsoft Dynamics NAV 2015 technical requirements as part of the data upgrade process to Microsoft Dynamics NAV 2015 and then upgrade the application and data later. In this topic, the Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2 databases are sometimes referred to as the old database.

Similarly, when you upgrade from one Microsoft Dynamics NAV 2015 cumulative update to the next cumulative update, you can be required to convert the database as described in task 2. This occurs when the cumulative update introduces changes to system tables. This type of database conversion is less complicated than the conversion from Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2 to Microsoft Dynamics NAV 2015.

Warning

You can choose to convert the old database and not upgrade your application. However, we recommend that you upgrade the application objects as well so that your solution includes important application fixes and new functionality that is introduced in Microsoft Dynamics NAV 2015. Upgrading the application will also reduce the amount of merging required to upgrade to the next major version of Microsoft Dynamics NAV, bringing you to the latest version of the product faster.

To convert the old database to a Microsoft Dynamics NAV 2015 database, complete tasks 1 and 2. To convert the database from one cumulative update of Microsoft Dynamics NAV 2015 to the next cumulative update, complete task 2.

Task 1: Preparing the Old Database

The first task is to back up the old database and then prepare to convert it.

To prepare the old database

  1. Make a copy of the old database or create full database backup.

    For more information, see Create a Full Database Backup (SQL Server).

  2. Open the development environment that matches the Microsoft Dynamics NAV version of the old database, and then connect to the old database.

    For more information, see How to: Open Databases.

  3. In Object Designer, verify that no objects are locked.

    If one or more objects are locked, the conversion process cannot update the database version number. As a result, the conversion does not complete.

  4. On the Tools menu, choose Build Server Application Objects, and then choose the Yes button.

    Note

    This step does not compile objects in the old database that have not compiled.

  5. If any errors occur, they are shown in the Error List window. Make sure that you address all compilation errors before you continue.

  6. Upload the Microsoft Dynamics NAV 2015 Partner license to the database

    For more information, see Uploading a License File for a Specific Database.

    Important

    The license that you upload must be a developer license. During the conversion, the development environment will convert the report objects that are stored in the old database to the RDL 2012 format.

  7. If you are converting a Microsoft Dynamics NAV 2013 R2 database, then run the Sync-NavTenant cmdlet from the Microsoft Dynamics NAV 2013 R2 Administration Shell to synchronize the database schema changes.

    For more information, see How to: Run the Sync-NAVTenant Cmdlet.

Task 2: Converting the Old Database

Next, you will convert the old database so that it can be used in Microsoft Dynamics NAV 2015.

Before you start the following procedure, you can choose to uninstall Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2. When you uninstall Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2, the database is still attached to the instance of SQL Server, which you can verify using SQL Server Management Studio.

Tip

If you want to write a script that helps you convert databases, you can use the Invoke-NAVDatabaseConversion function in the Microsoft Dynamics NAV 2015 Development Shell.

To convert the database

  1. Install Microsoft Dynamics NAV 2015.

    Run the Microsoft Dynamics NAV 2015 Setup, and choose to install the Developer option.

  2. Open the Microsoft Dynamics NAV 2015 development environment, and then connect to the database that you prepared in the previous task.

    For more information, see How to: Open Databases.

  3. In the dialog box that appears, read the instructions carefully because this action cannot be reversed. When you are ready, choose the OK button, and then choose the OK button to confirm that you want to convert the database.

    Microsoft Dynamics NAV will now convert the database. This includes an upgrade of system tables, and an upgrade of all reports to support Report Viewer 2012.

  4. When you are notified that the conversion was successful, choose the OK button.

  5. Connect a Microsoft Dynamics NAV 2015 Server instance to the converted database.

    You use the Microsoft Dynamics NAV Server Administration tool to connect a Microsoft Dynamics NAV Server instance to the converted database.

    In addition, you must add the service account that is used by the Microsoft Dynamics NAV Server instance as a member of the db_owner role in the Microsoft Dynamics NAV database on SQL Server.

    For more information, see How to: Connect a Microsoft Dynamics NAV Server to Database and Giving the account necessary database privileges in SQL Server.

  6. Run the development environment as an administrator, and then set the development environment to use the Microsoft Dynamics NAV Server instance that connects to the database.

    For more information, see How to: Change the Microsoft Dynamics NAV Server Instance or ($ S_2349 Database Information $).

  7. Run the schema synchronization to complete the database conversion.

    You can run the schema synchronization from the Microsoft Dynamics NAV Development Environment or Microsoft Dynamics NAV 2015 Administration Shell.

    From the development environment:

    Open development environment as an administrator. On the Tools menu, choose Sync. Schema For All Tables, and then choose With Validation and follow the schema synchronization instructions.

    From the Microsoft Dynamics NAV 2015 Administration Shell:

    Open the Microsoft Dynamics NAV 2015 Administration Shell as an administrator, and then run Sync-NavTenant cmdlet as follows:

    Sync-NavTenant –ServerInstance <ServerInstanceName>
    

    Replace <ServerInstanceName> with the name of the Microsoft Dynamics NAV Server instance that is connected to the database. For more information, see How to: Run the Sync-NAVTenant Cmdlet.

  8. If the database references any assemblies (such as client control add-ins) that are not included on the Microsoft Dynamics NAV 2015 installation media (DVD), then add the assemblies to the Add-ins folder on Microsoft Dynamics NAV Server or Microsoft Dynamics NAV Windows client computers.

    For the Microsoft Dynamics NAV Windows client, the default path is C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\Add-ins folder.

    For Microsoft Dynamics NAV Server, the default path is the C:\Program Files\Microsoft Dynamics NAV\90\Service\Add-ins folder

  9. In the development environment, on the Tools menu, choose Build Server Application Objects, and then, in the dialog box, choose the Yes button.

  10. Fix compilation errors.

    If any errors occur, they are shown in the Error List window. For information about compilation errors when you are converting a Microsoft Dynamics NAV 2013 database, see Compilation Errors When Converting a Microsoft Dynamics NAV 2013 Database.

    You can find all objects which did not compile in the Object Designer window, by setting a field filter on the Compiled field.

  11. Upload the customer license to the converted database.

    For more information, see Uploading a License File for a Specific Database.

You have now completed the conversion of the Microsoft Dynamics NAV 2013 or Microsoft Dynamics NAV 2013 R2 database to be accessed from Microsoft Dynamics NAV 2015. To test the converted database, you can connect it to the Microsoft Dynamics NAV 2015 Server instance that by Microsoft Dynamics NAV clients, and then open a client.

Next, upgrade the application code to Microsoft Dynamics NAV 2015.

See Also

Other Resources

Upgrading the Application Code
Upgrading the Data
Upgrading to Microsoft Dynamics NAV 2015
Automating the Upgrade Process using Sample Windows PowerShell Scripts