Have you ever wondered, how do you copy or clone a Dynamics 365 CRM On-Premise Database and Organization Export from Production to Development anyway?
Please check out this absolutely free Microsoft Dynamics 365 CRM on-premises production to development mirroring training / reference guide. This free Dynamics 365 Training guide by Dynamics Edge tells you how to copy on-premise data from Dynamics 365 CRM to a new deployment for backup purposes or for the purposes of creating a dev copy (e.g. development environment). Please note that this information is for reference purposes only and is not warranted or guaranteed, Dynamics Edge is not responsible for anything that happens as a result of you relying on this free information below. Please call or contact Dynamics Edge if you need any help or have any questions prior to starting on any of the below steps.
In order to copy a Dynamics 365 CRM On-Premise from Production to a separate, brand new mirrored on-premise instance for backup, staging or development, you should actually redeploy the underlying organization’s database. You may want to do this so that on-premise you create a development environment for testing. For example, you may want to customize the system without affecting the live environment. This would also be an effective way to take a full backup of Microsoft Dynamics 365 CRM on-premises, also sometimes known as Dynamics 365 for Customer Engagement on-premise version. It is usually straightforward how to copy from Microsoft Dynamics 365 Online Sandbox to Production or vice versa, but it is Microsoft Dynamics 365 on-premises to on-premises duplication, cloning, backup, or copying, that is often overlooked, is somewhat less straightforward, but is also very important to know.
Fully Back up your SQL Server Databases
Prior to starting on any database modification operation, ensure you have a full, working backup of your whole SQL environment and cluster, including databases, configuration, etc, if possible. Most professional enterprises already have fully-working mirrors of their entire production SQL database environment for this purpose. There is always a risk inherent in any database modification operation. In fact, if you do not have a regular backup system in place for your SQL environment, you may even end up losing the data due to normal events such as hardware failure, data corruption, and so on. You may skip this step if you want (but not very safely).
Back up the relevant SQL Server Database
Assuming you have either done the above, or have chosen to skip the above at your risk:
Start by looking for the specific SQL database hosting your D365 CRM organization. Utilize Microsoft SQL Server Management Studio to make a backup of the actual production database that is hosting Dynamics 365 CRM data.
You start out by launching the Microsoft SQL Server Management Studio software.
You then would log in with the right credentials and connect to the actual instance where the "MSCRM" (Dynamics 365 CRM) database elements are located.
Go to databases by expanding it on the left side and after this, you should right click on the specific database hosting the data for your CRM (Dynamics 365) organization.
Now, navigate to Tasks > Backup and then click on Backup Database to start the backup process, which first is preceded by a series of prompts.
You will be prompted now to set the destination path of your backup. Select a path you want. You will also be prompted to set the Database Backup Name – choose a name as well. Press the OK button. This actually starts the SQL server database backup.
Create a new deployment with SQL Server
You should now deploy the database you just copied.
Start by creating a brand new database. Type in a name for the new database. Use something like YourOrganizationName_MSCRM for the name of the database. You may modify the file path of where the logs and database are going to be stored if you want to. Click the OK button. This will create the new database. Now go ahead and right click on this brand new database and the navigate to Tasks > Restore > Files and then go to Filegroups. In the case that you are unable to view the new database, you may try clicking on the refresh button to update the list of databases and then try this step again. Now, click on Add and then select your new database. Click OK on the database select and click OK on the device. Where it says ‘General’ you should probably make sure that the ‘Restore’ option is checked or enabled there. Now you restore the database. Look at the options tab and then choose the option to to overwrite the existing database (WITH REPLACE). You want to do this since you want to restore the database you backed up into the blank brand new database you just created, so it’s a mirror copy of your original org database.
Now you should issue the replace database SQL and click on OK. In case that the actual database restore seems to not be working, you might have success by making a connection to the master database in your cluster and then typing in then executing the following SQL statement to try and restore it through an SQL command. Use your own database name and database backup name for the example below.
RESTORE DATABASE YourOrganizationName_MSCRM
FROM DISK = 'YourOrganizationName_MSCRM.bak'
Tell Dynamics 365 CRM About The New Database
We need to tell Dynamics 365 CRM about the new database. Use Microsoft Dynamics 365 Deployment Manager to do this. It is Dynamics 365 Deployment Manager that tells Dynamics 365 CRM about the underlying MSCRM_CONFIG database related to the brand new organization.
First you should open Microsoft Dynamics 365 Deployment Manager on your system. Now, choose ‘Organization’ towards the left side. Then, you should choose ‘Import Organization’ which is more towards the right. Go ahead and select the database instance, as well as the database to import, and then choose ‘Import Database.’ Now, click on ‘Next.’ At this point, please enter the unique database name and display name, which usually should be the same as the original. You should keep the report server URL the same way it already is. Now, choose automatic mapping. The option tries to map record owners with the relevant Active Directory users that are present within your own current environment. In the case that the automatic mapping does not work, what you can do is to go ahead and manually associate record owners to the proper Active Directory users in your environment. Now, if your actual security roles make users only be able to see records that they own, getting each and every owner mapped to the right Active Directory user in your environment becomes even more important in this case. For the mapping process, you would click on Next when you’ve done mapping, and you should get a valid result when the system verifies the mapping. Now, click on Next and then click on Import. What happens now is that the Microsoft Dynamics 365 Deployment Manager adds all of the relevant system hooks in order to cause your database to become part of your internal system deployment. After your new Microsoft Dynamics 365 CRM deployment has completed, please try navigating to your brand new Dynamics 365 CRM Organization and see if your Microsoft Dynamics 365 On-Premises Organization clone / mirroring has worked successfully!