Skip to main content

NAV 2013 R2 - How to Backup Selected companies - Powershell (Using SQL Database).

Hi all,

As discussed in earlier post, we will see how to take navision backup similar to .fbk file and restore it in a new database. In this post we will list down the steps to take backup using power-shell.

If you haven't read the Previous post, please refer here.

UPDATE - IF you face issues of Schema During This Process Please refer the Post Here for Issue Resolution.

Hope till now you have uninstalled the older build of NAV 2013 R2 and installed the latest Build i.e 7.1.3687 as shown below.



For Demo Purpose i have a created 4 companies in a database as shown below, where A & B are copy of Cronus international whereas C is a blank company.





1. Open Powershell ISE as administrator and Load Powershell Commandlet for Microsoft Dynamics NAV by copying and pasting below command in Window.
How to open and Load NAV Commandlets?

-----------------------------------------------------------------------------------
#Prepare PowerShell
Import-Module 'C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1'
-----------------------------------------------------------------------------------

2.Search for Export-NAVData Commandlet in Command Addon. If Command Addon is not visible, enable it from View Menu.



3. If you see there are multiple options in Export-NAVData as listed below -

1. UseDatabase_AllCompanies
2. UseDatabase_SomeCompanies
3. UseNST_AllCompanies
4. UseNST_SomeCompanies

1 & 2 can be used either the server instance is stopped or not available. [Direct Database]
3 & 4 will only be used if the server instance is running. [Navision Service Tier]

Let's see how to use each of them.

1. UseDatabase_AllCompanies

* This is similar to SQL Backup i would say but will lot of options. Let's explore -

Below are parameters of the command-lets 1 -

1.  All Companies - You want to backup all companies or not, NEED TO SET TRUE.
2.  Database Name - The Database name from which you want to backup.
3.  File Name - The File Path and name where you want to store the backup (ends with Extension => .navdata).
4.  ApplicationDatabaseName - Used in Multitenat (Will Discuss Later in separate post)
5.  ApplicationDatabaseServer - Used in Multitenat (Will Discuss Later in separate post)
6.  Database Server - Server Name where the database is placed.
7.  Description - Description to file that you want to give.
8.  Include Application - Want application objects or not.
9.  Include Application Data - Want  data that defines the application in the database.
10. Include Global Data - Want Data conman to all companies or not.

As shown below is the parameters set for the backup.



Below is the command generated for the all comapnies backup.
-------------------------------------------------------------------------
Export-NAVData -AllCompanies -DatabaseName "Demo Database NAV (7-1)" -FileName C:\All_Comapniesbackup.navdata -DatabaseServer Servername -Description "This is a sample backup of all the companies." -IncludeApplication -IncludeApplicationData -IncludeGlobalData
-------------------------------------------------------------------------
Run the command and backup will be placed as shown below.



2. UseDatabase_SomeCompanies

Below are parameters of the commandlets 2 -

1.  Database Name - The Database name from which you want to backup.
2.  File Name - The File Path and name where you want to store the backup (ends with Extension => .navdata).
3.  ApplicationDatabaseName - Used in Multitenat (Will Discuss Later in separate post)
4.  ApplicationDatabaseServer - Used in Multitenat (Will Discuss Later in separate post)
5.  CompanyName - Name of Company you want to backup (if multiple put them as comma separated).
    * Multi Character Name should be in ''.
6.  Database Server - Server Name where the database is placed.
7.  Description - Description to file that you want to give.
8.  Include Application - Want application objects or not.
9.  Include Application Data - Want  data that defines the application in the database.
10. Include Global Data - Want Data conman to all companies or not.

As shown below is the parameters set for the backup.



Below is the command generated for the all comapnies backup.
-------------------------------------------------------------------------
Export-NAVData -DatabaseName "Demo Database NAV (7-1)" -FileName c:\TwoCompany.navdata -CompanyName A,C -DatabaseServer INDEL-SXD6995NB -Description "This is a sample backup of selected companies." -IncludeApplication -IncludeApplicationData -IncludeGlobalData
-------------------------------------------------------------------------
Run the command and backup will be placed as shown below.



In the Next post we will see the backup steps that can be taken with another two option in NAVEXPORT Commandlet i.e Service Related.

Hope you find the information useful.

Stay tuned for more.

Regards,
Saurav Dhyani

Comments

Popular posts from this blog

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

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.