Partager via


How to Add a Microsoft Dynamics NAV Database

This topic describes how add a new Dynamics NAV database instance to SQL Server from a database backup file (.bak). To add a Dynamics NAV database, you use the New-NAVDatabase cmdlet of the Microsoft Dynamics NAV Administration Shell.

Tip

You can also create a database from the Microsoft Dynamics NAV Development Environment. For more information, see How to: Create Databases.

To add a Dynamics NAV database

  1. On the computer that is running Microsoft Dynamics NAV Server, run Dynamics NAV Administration Shell as an Administrator.

    1. Choose Start, in the Search box, type Dynamics NAV Administration Shell.

    2. Right-click the related link, and then choose Run as Administrator.

  2. At the command prompt, type the following command:

    New-NAVDatabase -FilePath <DatabaseBAKfile> -DatabaseName <MyNavDatabase> -DatabaseInstance <DatabaseInstance> -DatabaseServer <DatabaseServer> -ServiceAccount <ServiceAccount>  
    

    Change the following parameter values.

    Parameter Description
    <DatabaseBAKfile> Specifies the path and file name of the Dynamics NAV database backup file that you want to restore.
    <MyNavDatabase> Specifies the name to give the new database in SQL Server.
    <DatabaseInstance> Specifies the name of the SQL Server database instance to connect to.

    If you there is only one database instance on the SQL server, then you can omit this parameter. The default instance is DynamicsNAV70_Instance1.
    <DatabaseServer> Specifies the name of the computer that is running SQL Server. The name has the domain\computername format.

    If this is the computer that you are working from, then you can omit this parameter.
    <ServiceAccount Specifies the logon account that runs the Microsoft Dynamics NAV Server instance.

    This account is given the appropriate permissions to the database when you run the cmdlet. For more information, see Provisioning the Microsoft Dynamics NAV Server Account. If you do not specify an account, then Network Service is used.

    Note

    The command that is shown includes only a subset of all the parameters of the New-NavDatabase cmdlet. For more information about the syntax and parameters, see New-NAVDatabase topic in the Administration Cmdlets for Dynamics NAV section of the Technical Reference.

  3. Press Enter to run the cmdlet.

    A new Dynamics NAV database that has the specified name is added on SQL Server.

Example

The following example restores a database and preserves the original file names, locations, and logon accounts.

New-NavDatabase -FilePath C:\Backups\NavDemoDatabase.bak –DatabaseName MyNewDatabase -verbose  

See Also

Scaling the Microsoft Dynamics NAV Network Topology
SQL Server Database Components
Deploying and Managing Microsoft Dynamics NAV on Microsoft Azure
How to: Add a Microsoft Dynamics NAV Server Instance
How to: Add a Microsoft Dynamics NAV Web Server Instance
How to: Add a Microsoft Dynamics NAV Company