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

VIEW SERVER STATE permission on SQL Server?

Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

NAV 2013 R2 - Cumulative update 12 Released.

Hi all, Please find below the details of  Cumulative Update 12 released for Microsoft Dynamics NAV 2013 R2. Title - Cumulative Update 12 for Microsoft Dynamics NAV 2013 R2 Build No. - 38053 Release Date - October, 2014 Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU Download Link Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.

NAV 2013 Upgrade Part III - Data Upgrading.

Hi all, As per agenda we need to discuss the data upgrade in NAV 2013. The process is similar to what used to be till NAV 2009 R2 but with some changes. Let's start the process. Remember -  1) You can only upgrade a database to NAV 2013 from NAV 2009 SP1 / R2 SQL Only. 2) The Synchronization of users with SQL Server is no more required.