Several weeks before our customer’s go-live of Microsoft Dynamics NAV 2015, users were vigorously testing NAV as we were ironing out the specifics of the customer’s desired configurations. During this process, we wanted to start with a clean testing environment (where we wanted to use the exact configurations of the production environment and there weren’t any posted transactions obfuscating our testing scenarios).
Now, after the customer has gone live and has started using NAV, we wanted them to still have a good testing environment where they can test and practice transactions, but want them to use real life data. So how do you handle this? You simply use a back up and restore process to provide the proper testing environment for the customer.
To back up and restore a database, use the SQL Server Management Studio (SQL) to create the backup file (a .bak file), and Windows PowerShell ISE (PowerShell) to restore the database. This blog will outline the steps to (1) produce the SQL backup and (2) restore the database using PowerShell.
How to Back Up and Restore a Dynamics NAV 2015 Database Using SQL and PowerShell:
Prerequisite:
NAV Server Instance: In these instructions, I do not cover how to configure a NAV Server Instances. However, in order for the following instructions to work, it is necessary to have a separate NAV Server Instance dedicated to the testing database/environment. The testing environment’s NAV Server Instance needs to be configured properly, and you’ll need to know a few of its specific configurations in order to setup the cmdlets explained below. Specifically, you’ll need to know the Database Server and Database Name values. This information can be found within the Microsoft Dynamics NAV 2015 Administration application. The name of the testing database used in the following example is TPC NAV Staging.
High Level Steps – How to Back Up and Restore a Dynamics NAV 2015 Database:
- In SQL, create a backup of the production NAV Database
- In SQL, delete the database you want to replace (if you’re replacing an existing database)
- In PowerShell, restore the backup, using the New-NAVDatabase cmdlet
- In Microsoft Dynamics NAV 2015 Administration, restart the NAV Service
- In PowerShell, rename the NAV Companies, as appropriate, using the Rename-NAVCompany cmdlet
- Optional Step: in NAV, in the new testing database NAV Companies, change the System Indicator options on the Company Information setup page