Skip to main content

NAV 2013 R2 - How to Restore Selected companies With Multi Tenancy - Powershell (Using Direct Database & Service Tier).

Hi all,

In this post we will list down the steps to restore backup taken in Previous Post using power shell Using Direct Database & Service Instance For a MultiTenant Database.

If you haven't read the Previous post, please refer to Index of Posts.

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

Below is the Details of my Companies in Each Tenant -





From the Task Performed in Earlier Posts Backup From Powershell, i have below files as shown Below -



Let's check the Content of Backup Taken Via Emport-NavData.

Microsoft have provided a Commandlet for the same i.e  Get-NAVDataFile.
This Commandlet takes file Location and Name as parameter and returns the details of Content of the backup File.

Open Powershell and Let's check the two file content using Get-NAVDataFile =
--------------------------------------------------------------
Get-NAVDataFile -FileName "c:\Tenant1_Company_C_Backup.navadata"
---------------------------------------------------------------



--------------------------------------------------------------
Get-NAVDataFile -FileName "C:\Tenant1_CompanyA_B_Backup.navadata"
--------------------------------------------------------------



In Today's post we will restore -

 * Company A to My Tenant 2
 * Company B to My Tenant 3
 * Company C to My Tenant 5

Let's try to Restore the backups.

Steps -

1.Search for Import-NAVData Commandlet in Command Addin.

2. If you see there are multiple options in Import-NAVData as listed below (For Database Options)-

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

1 & 2 can be used even if the server instance is stopped or not available.
3 & 4 can only be used if the server instance is running.

We will be demonstrating 2 & 4 as 1 & 3 are like SQL Restore.

2. UseDatabase_SomeCompanies

I am using the Backup taken From Direct Database Connection as per earlier Post.
File Name - Tenant1_CompanyA_B_Backup.navadata

Below are parameters of the command-lets 2 -

1.  Database Name - The Database name in which you want to Restore. (In Multitenancy this will be the Tenant Database Name)
2.  File Name - The File Path and name where backup is placed (ends with Extension => .navdata).
3.  ApplicationDatabaseName - The Name of Database which Contain Only Application Objects.
4.  ApplicationDatabaseServer - The Name of Database Server Where the Application Database Exist.
5.  Company Name - Name of the Company You want to Restore from Backup.
    * IF Company Name contain multiple Words put it in ''.
6.  Database Server - Server Name where the database is placed.
7.  Include Application - Want application objects or not.
8.  Include Application Data - Want  data that defines the application in the database.
9.  Include Global Data - Want Data common to all companies or not.

As shown below is the parameters set for the restore.



Below is the command generated for the two selected companies restore.
-------------------------------------------------------------------------
Import-NAVData -DatabaseName MyTenant2 -FileName C:\Tenant1_CompanyA_B_Backup.navadata -ApplicationDatabaseName MultiTenant_Application_Database -ApplicationDatabaseServer INDEL-SXD6995NB -CompanyName A -Confirm -DatabaseServer INDEL-SXD6995NB
-------------------------------------------------------------------------
** As i only need data specific to Company A & B, i will not select IncludeApplication, IncludeApplicationData & IncludeGlobalData.

In the Similar way the Command to Restore Company B on Tenant MyTenant 3 below is the command -
-------------------------------------------------------------------------
Import-NAVData -DatabaseName MyTenant3 -FileName C:\Tenant1_CompanyA_B_Backup.navadata -ApplicationDatabaseName MultiTenant_Application_Database -ApplicationDatabaseServer INDEL-SXD6995NB -CompanyName B -Confirm -DatabaseServer INDEL-SXD6995NB
-------------------------------------------------------------------------

Run the command and backup will be restored in the database.



4. UseNST_SomeCompanies

I am using the Backup taken From Direct Database Connection as per earlier Post.
File Name - Two_Comapniesbackup_Service.navdata

Below are parameters of the command-lets 4 -

1.  FileName - The File Path and name where backup is placed (ends with Extension => .navdata).
2.  ServerInstance - Name of Service on Which database is connected in which you want to restore.
3.  CompanyName - Name of the Company You want to Restore from Backup.
    * IF Company Name contain multiple Words put it in ''.
4.  IncludeApplicationData - Want  data that defines the application in the database.
5.  Include Global Data - Want Data common to all companies or not.
6.  Tenant - Name of the Tenant on which you want to restore the Company.

As shown below is the parameters set for the restore.



Below is the command generated for the two selected companies restore.
-------------------------------------------------------------------------
Import-NAVData -FileName c:\Tenant1_Company_C_Backup.navadata -ServerInstance MultiTenantBackup -CompanyName C -Confirm -Tenant MyTenant5
-------------------------------------------------------------------------
** As i only need data specific to Company C, i will not select IncludeApplication, IncludeApplicationData & IncludeGlobalData.

Run the command and backup will be restored in the database.


Hope you find the information useful.

With this post the series related to Backup and Restore selected companies in NAV 2013 R2 have been finished.

Stay tuned for more.

Regards,
Saurav Dhyani
saurav-nav.blogspot.com

Comments

Popular posts from this blog

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 - 

Future - What Next After NAV 2016. Code Name - Madeira...

Hi All, While Browsing web I came across some article which says about next release of Microsoft Dynamics NAV. Let's see the History of Code Names Given to Previous Version  - NAV 2013 - Code Name 'Sicily' NAV 2015 - Code Name 'CRETE' NAV 2016 - Code Name 'CORFU' And as we all know that all these are the Islands.

Download Microsoft Dynamics Business Central on Premises 2020 Wave 2 Release.

 Hi Readers, As Expected Microsoft have released #msdyn365bc 2020 wave 2 is available.  This article provides details of the new release. The 2020 release wave 2 for Business Central delivers a wealth of new features. Read What's new in 2020 Release Wave 2 here .  Dynamics NAV Customers upgrading to Business Central on Prem will be able to run business central on premises, move to cloud or choose a hybrid approach.