Tuesday, October 30, 2018

MSDYN365BC - Data Upgrade To Microsoft Dynamics 365 Business Central on premises.

Hi Readers,

We have already talked about the number of steps for upgrading to Business Central on Premises from different NAV versions.

After that article, I received multiple requests for an article which list down steps for Data Migration. In this article, we will discuss steps of data migration to MSDYN365BC (on-prem) from NAV 2017.

For this article, I am considering a Cronus Demo Database without any customization. For an actual upgrade project, we will have to complete object merge using compare and Merge process.

After the Merge Process, the next step is data migration. Let's discuss those steps.

Direct Upgrade to Microsoft Dynamics 365 Business Central (on-prem) is from following versions -
1. NAV 2015.
2. NAV 2016.
3. NAV 2017.
4. NAV 2018.

Step 1 -  Full SQL Database backup of Old Database.
Create a full backup of the old database in the SQL Server. Alternatively, you can make a copy of the old database and perform the upgrade tasks on the copy.

Step 2 -  Uninstall all extensions in the old database. (Applies for NAV 2016 or Higher)

To get a list of the extensions that are installed, run this command:
Get-NAVAppInfo -ServerInstance <ServerInstanceName> -Tenant default

For each extension, run this command to uninstall it:
Uninstall-NAVApp -ServerInstance <ServerInstanceName> -Name <Name> -Version <N.N.N.N>


Remove them all at once, you can run this command:

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

Replace <ServerInstanceName> with the name of the Dynamics NAV Server instance that the database connects to.

Step 3 -  Upload the Business Central partner license to the old database

Step 4 - Delete all objects except tables from the old database.
In the development environment version that matches the database, open the old database, open Object Designer, select all objects except tables, and then choose Delete.
  • Select All from object designer and mark all. (Edit - Toggle Mark).
  • Select Tables from Object designer and remove mark (Edit - Toggle Mark).
  • Select All and Marked only. (View - Marked only).

Step 5 - Clear server instance and debugger breakpoint records from the old database.
DELETE FROM [<My NAV Database Name>].[dbo].[Server Instance]
DELETE from [<My NAV Database Name>].[dbo].[Debugger Breakpoint]

Step 6 - Convert the old database to the Business Central format.
Setup user permission as db_owner in SQL Server as shown below.

Run Business central development Environment (#MSDYN365BC) as administrator. Open Database with Business Central Executable. Do not run schema synchronization at this time. Choose to run it later. 

Step 7 - Import the upgraded application objects.
Using Dynamics NAV Development Environment for Business Central, import the application objects that you want in the database. (Result of Object Merge).

Select Ok to open the import worksheet.
Select Replace All.
Select Schema Synchronization to Later.

Using Dynamics NAV Development Environment for Business Central, import appropriate Upgrade Codeunit. (From Product DVD)

Select Ok to open the import worksheet.
Select Replace All.
Select Schema Synchronization to Later.

Step 8 - Connect a Business Central Server instance to the converted database.
Map to a NAV Service Tier or use Set-NAVServerConfiguration cmdlet in the Business Central Administration Shell to connect a Business Central Server instance to the converted database.

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

When upgrading a large database, you should increase the SQL Command Timeout setting for the Business Central Server instance, to avoid timeouts during schema synchronization. The default setting is 30 minutes.

Step 9 - Compile all objects
Use the Dynamics NAV Development Environment or finsql.exe to compile all objects. 
This includes the imported application objects, data tables, and system tables. 
Choose to run schema synchronization later. 

Step 10 - Delete Objects, no longer Required.
If you get errors on the following table objects, use the Object Designer to delete the objects because they are no longer used. (Applies for NAV 2015 & NAV 2016 Only)

Table Filter - 470|824|825|827|828|829|1510

When you delete a table object, in the Delete confirmation dialog box that appears, set the Synchronize Schema option to Force.

Step 11 - Increase the application version of the database (Applies if Upgrading from NAV 2018)

If you are upgrading from Microsoft Dynamics NAV 2018, you must increase the application version that is assigned to the database.

Use the Set-NAVApplication cmdlet of the Business Central Administration Shell to increase the application version number of the database from its current version.

To see the current version, use the following command:
Get-NAVApplication -ServerInstance <ServerInstanceName> 

To change the version, use the following command:
Set-NAVApplication -ServerInstance <ServerInstanceName> -ApplicationVersion <N.N.N.N> -Force

For example, if the old version was 11.0.24279.0, then you could change the version to 13.0.24279.0.

Step 12 - Run the schema synchronization on the imported objects
Run - Sync-NAVTenant -ServerInstance <ServerInstanceName>

Step 13 - Run the data upgrade process
A data upgrade runs the upgrade toolkit objects, such as upgrade codeunits and upgrades tables, to migrate business data from the old table structure to the new table structure. 
You can start the data upgrade from the Dynamics NAV Development Environment or Business Central Administration Shell.

Step 14 - Import upgraded permission sets and permissions

Import the permission sets and permissions XML files that you exported from the old database as follows:
1. Delete all permission sets in the database except the SUPER permission set.
2. In Object Designer, run page 9802 Permission Sets, and then delete the permission sets except for SUPER.
3. Run XMLport 9171 and XMLport 9172 to import the permission sets and permission XML files.

Step 15 - Configure pages and reports included in the MenuSuite to be searchable in the Web client.
The MenuSuite is no longer used to control whether a page or report can be found in the search feature of the Web client. This is now determined by specific properties on the page and report objects. 
(I will publish a separate article for this step and how to process it).

Step 16 - Delete the upgrade objects
At this point, you have upgraded the database to Business Central. Now, you can delete the upgrade codeunits and upgrade table objects that you imported in task 9. This task is recommended but not required. 
When you delete tables, on the Delete dialog box, set the Synchronize Schema option to Force.

Filter Objects with Version Tag - @*UPG* 
Delete all objects in the filter with the Sync Schema Force.

With these steps, data migration is over. Next step is to install new extensions and Enable loading application symbol references at server startup. These symbols will be used to connect to AL Environment.

Hope you like this article and it helps you in upgrading data to Business Central.

Saurav Dhyani