Dynamics 365 Business Central on-premise Wave 2: how to create databases and perform technical upgrades

I’ve explained few days ago how to change a license from customer’s one to partner’s one when working with Dynamics 365 Business Central Wave 2 on-premise. This more tricky process occours mainly because now you don’t have the Development Environment available anymore.

Another problem that you could have strictly related to this is the following: how can I create a new Dynamics 365 Business Central Wave 2 database now?

For creating a new database, now Powershell is again your friend. To create a new Dynamics 365 Business Central database, you need to use the NAV-NAVApplicationDatabase cmdlet. The command to execute is normally the following:

New-NAVApplicationDatabase -DatabaseServer YOURSERVER -DatabaseName DATABASE_NAME -DatabaseLocation YOUR_DB_FILES_LOCATION_PATH

You can also set the Collation by using the -Collation switch (default is Latin1_General_100_CS_AS). With -DatabaseLocation you specify the path where data files and log files will be created.

What about the technical upgrade? Previously, with Development Environment you could open the database with a new version of the DEV Enviroment and perform a technical upgrade (aka a database conversion) to the new version. And now?

Now you can do that by using the Invoke-NAVApplicationDatabaseConversion cmdlet:

Invoke-NAVApplicationDatabaseConversion -DatabaseName DATABASE_NAME -DatabaseServer YOURSERVER

This command starts a technical upgrade to a database called DATABASE_NAME on the server called YOURSERVER.

17 Comments

  1. Hi Stefano

    I am using these lines, and i get this error, can I help me?

    PS C:\Windows\system32> New-NAVApplicationDatabase -DatabaseServer . -DatabaseName MyDBforupgrade -DatabaseLocation C:\Varios\Trainingym\BC150\Datos
    New-NAVApplicationDatabase : The database create operation failed due to the following error returned by SQL Server:
    No se puede quitar la base de datos ‘MyDBforupgrade’; está en uso.
    En línea: 1 Carácter: 1
    + New-NAVApplicationDatabase -DatabaseServer . -DatabaseName MyDBforupg …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (0:Int32) [New-NAVApplicationDatabase], NavCommandException
    + FullyQualifiedErrorId : .,Microsoft.Dynamics.Nav.Management.Cmdlets.CreateNavDatabase

    Best regards.

    Like

  2. Hi,

    no, it is not possible because I try to create new data base with the function New-NAVApplicationDatabase , I spoke with Microsoft and they told me that is a problem of them (thar are working to resolve that), I have had to reinstall my windows in inglish and with that, the problem was resolved. The dll that they are using, it must have some reference directly with the user nt authority/nertwork services rather than “servicio de red” that it say in my language.

    thanks for answering!

    Like

  3. Hi Stefano,

    creating a new database works fine but I get an error if I try to convert the database:

    Invoke-NAVApplicationDatabaseConversion : A technical upgrade of database ‘MyDatabase’ on server ‘MyServer’ cannot be run, because the database’s application version ‘130580’ is greater than or equal to the platform version ‘130580’.

    If I skip the conversion and setup/start a new server instance, I get the following error when installing an app

    Install-NAVApp : The MyDatabase database has version 0 which is not supported by this version of Microsoft Dynamics 365 Business Central Server

    Starting the conversion before or after starting the server instance makes no difference. Any idea what’s wrong

    Best regards, Ingo

    Like

    1. It seems that your database don’t requires a conversion. Regarding the second error: what do you have as result if you execute the following?:
      Get-NAVApplication -ServerInstance
      You can set the Application version by using:
      Set-NAVApplication -ServerInstance -ApplicationVersion -Force

      Like

      1. Get-NAVApplication returns an empty ApplicationVersion and ApplicationFamily. I’ve set the application version to 15.0.36649.0 using Set-NAVApplication without any change when installing the apps. ApplicationFamily stays empty in difference to a BC demo database.

        Basically, I’m trying to setup a new BC OnPrem database from scratch. Publishing the system and base app works, even if I first have to publish the apps with -PackageType SymbolsOnly.

        Like

      2. To set ApplicationFamily you can use:
        Set-NAVApplication -ServerInstance BC -ApplicationFamily ‘XX’ -Force
        where XX is the value to set.

        Like

      3. That works, application version and family are now equal to the standard BC 15-0 demo database. But Install-NAVApp still returns the same error

        Like

    2. I made new database with platform 15.0 and now I’m trying to upgrade to newer CU (15.1).
      How to solve the Invoke-NAVApplicationDatabaseConversion error “because the database’s application version ‘130580’ is greater than or equal to the platform version ‘130580’” error?

      ServerInstance is not starting because “The database on the server must be converted..”

      So I’m kinda stuck.

      Where does it get the 130580 version anyway?

      Like

      1. Yes, running Sync-NAVTenant –ServerInstance before uninstalling old BC version did not make any difference.

        Like

  4. After creating the database with New-NAVApplicationDatabase and creating/starting a new server instance, the order of the following steps seems to be important

    Set application version and application family
    Sync nav tenant
    Publish the system app symbols only
    Create a new company
    Publish the system app
    Sync the system app
    Install the system app

    After that I was able to install the base app w/o issues.

    Like

    1. There is a System.app file in the BC setup subfolder .\ModernDev\program files\Microsoft Dynamics NAV\150\AL Development Environment. I’ve published that one with:

      Publish-NAVApp -ServerInstance $ServerInstance -Path $SystemAppFile -PackageType SymbolsOnly -SkipVerification

      Liked by 1 person

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.