Partager via


Converting a Database - Technical Upgrade

Applies to: Microsoft Dynamics NAV 2018. See Microsoft Dynamics NAV 2017 version.

This article describes how to convert a Dynamics NAV database from one of the following versions to Microsoft Dynamics NAV 2018:

  • Microsoft Dynamics NAV 2013
  • Microsoft Dynamics NAV 2013 R2
  • Microsoft Dynamics NAV 2015
  • Microsoft Dynamics NAV 2016
  • Microsoft Dynamics NAV 2017
  • Microsoft Dynamics NAV 2018 (cumulative update)

About database conversion

Converting a database, which is often referred to as a technical upgrade, changes the database so that it works on the latest Microsoft Dynamics NAV 2018 platform. The conversion updates the system tables of the old database to the new schema (data structure), and upgrades of all reports to support Report Viewer 2015. It provides you with the latest platform features and performance enhancements.

Prepare Microsoft Dynamics 365 for Sales integration code for upgrade

If your solution integrates with Microsoft Dynamics 365 for Sales, and you're upgrading to Dynamics NAV cumulative update 41 (Build 47056) or later, you'll have modify some code before you upgrade. For more information, see Modifying Dynamics 365 Sales Code for Technical Upgrade to Dynamics NAV 2018.

Task 1: Preparing the Old Database

To convert the old database to a Microsoft Dynamics NAV 2018 database, the first task is to back up the old database and then prepare to convert it.

Note

Do not perform this task if you are converting the database from one cumulative update of Microsoft Dynamics NAV 2018 to the next cumulative update. In this case, you only have to complete task 2.

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. Uninstall all extensions from the tenant.

    You can do this from Extension Management page in the Dynamics NAV client or by using the Uninstall-NAVApp cmdlet of the Microsoft Dynamics NAV Administration Shell.

    To get a list of the extensions that are installed, run this command:

    Get-NAVAppInfo -ServerInstance <ServerInstanceName> -Tenant <TenantID>
    

    For each extension, run this command to uninstall it:

    Uninstall-NAVApp -ServerInstance <ServerInstanceName> -Name <Name> -Version <N.N.N.N>
    

    Alternately, to remove them all at once, you can run this command:

    Get-NAVAppInfo -ServerInstance <ServerInstanceName> -Tenant default | % { Uninstall-NAVApp -ServerInstance <ServerInstanceName> -Name $_.Name -Version $_.Version }
    

    For more information, see Install or Uninstall Extensions.

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

    For more information, see How to: Open Databases.

  4. In Object Designer, verify that all objects are compiled and no objects are locked.

    For more information about compiling objects, see Compiling Objects.

    If one or more objects are locked, the conversion process cannot update the database version number. As a result, the conversion does not complete. For more information, see Locking and Unlocking Objects.

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

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

  7. Upload the Microsoft Dynamics NAV 2018 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 format.

  8. Run the schema synchronization with validation to synchronize the database schema changes.

    For more information, see How to: Synchronize the Tenant Database with the Application Database.

  9. Stop the Microsoft Dynamics NAV Server instance, and close the development environment.

    You can use the Microsoft Dynamics NAV Server Administration tool or Set-NAVServerInstance cmdlet of the Microsoft Dynamics NAV Administration Shell.

    For information about the Microsoft Dynamics NAV Server Administration tool, see How to: Start, Stop, Restart, or Remove a Dynamics NAV Server Instance.

    To use the Set-NAVServerInstance cmdlet, run the following command:

    Set-NAVServerInstance –ServerInstance <ServerInstanceName> -Stop
    
  10. Clear all records from the dbo.Server Instance and dbo.Debugger Breakpoint tables in the old database in SQL Server.

    Using SQL Server Management Studio, open and clear the dbo.Server Instance and dbo.Debugger Breakpoint tables of the old database. For example, you can run the following SQL query:

    DELETE FROM [<My NAV Database Name>].[dbo].[Server Instance]
    DELETE from [<My NAV Database Name>].[dbo].[Debugger Breakpoint]
    
  11. (Optional) Before you start the following procedure, you can uninstall the old version of Dynamics NAV. When you uninstall Dynamics NAV, the database is still attached to the instance of SQL Server, which you can verify using SQL Server Management Studio.

Task 2: Converting the Old Database

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

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 Development Shell.

To convert the database

  1. If the database is on Azure SQL Database, add your user account to the dbmanager database role on the master database.

    This membership is only required for converting the database, and can be removed afterwards.

  2. Install Microsoft Dynamics NAV 2018.

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

  3. Run the Microsoft Dynamics NAV 2018 development environment as an administrator.

    • If the development environment is already connected to the old database, a dialog box about converting the database appears. Go to the next step.

    • Otherwise, connect to the old database that you prepared in the previous task, and then go to the next step.

      For more information, see How to: Open Databases.

    If you do not run the development environment as an administrator, you will get an error and the conversion will be stopped.

  4. In the dialog box that appears, read the instructions about converting the database 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.

    Dynamics NAV will now convert the database. This includes an upgrade of system tables and reports.

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

  6. If the database references any assemblies (such as client control add-ins) that are not included on the Microsoft Dynamics NAV 2018 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\100\RoleTailored Client\Add-ins folder.

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

  7. Compile all objects without table schema synchronizing (Synchronize Schema set to Later); you will do this later.

    For more information, see Compiling Objects.

  8. Fix compilation errors.

    If any errors occur, they are shown in the Error List window. For help on resolving the errors, see the following:

  9. Connect a Microsoft Dynamics NAV 2018 Server instance to the converted database.

    Use the Microsoft Dynamics NAV Server Administration tool or the Set-NAVServerConfiguration cmdlet to connect a Microsoft Dynamics NAV Server instance to the converted database.

    Important

    The service account that is used by the Microsoft Dynamics NAV Server instance must be a member of the db_owner role in the Dynamics NAV database on SQL Server or Azure SQL Database.

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

  10. Go to the development environment, and set it 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 Database Information.

  11. Recompile published extensions.

    Use the Repair-NAVApp cmdlet of the Microsoft Dynamics NAV 2018 Administration Shell to compile the published extensions to make sure they are work with the new platform.

    For example, you can run the following command to recompile all extensions:

    Get-NAVAppInfo -ServerInstance <ServerInstanceName> | Repair-NAVApp
    
  12. Run the schema synchronization with validation to complete the database conversion.

    For more information, see How to: Synchronize the Tenant Database with the Application Database.

  13. If you converted a Microsoft Dynamics NAV 2016, you will have to modify C/AL code to ensure that the My Settings page works properly in the Microsoft Dynamics NAV Web client. For more information, see Resolving My Settings Page Implementation After a Database Conversion.

  14. 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 database to be accessed from Microsoft Dynamics NAV 2018. To test the converted database, you can connect it to the Microsoft Dynamics NAV 2018 Server instance that is used by Dynamics NAV clients, and then open a client.

Database and Windows collations

Starting from SQL Server 2008, SQL Server collations are fully aligned with the collations in Windows Server. If you upgrade to Microsoft Dynamics NAV 2018 from Microsoft Dynamics NAV 2009, the step to convert the database includes upgrading the database from using SQL collations to using Windows collation. This collation change provides users with the most up-to-date and linguistically accurate cultural sorting conventions. For more information, see Collation and Unicode Support.

See Also

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