While working with MSCRM you may find that on occasions you need to redeploy an organisation’s database. The reason for doing so could be many. For me the chances are I am restoring a corrupt CRM System or maybe I am transferring an organisation between CRM system, but ultimately you are looking to deploy customisations and data. Luckily it is quite easy to restore an organisation! In this blog I will show you how I typically restore an organisation.
So lets paint a scenario. Lets say that we have developed and deployed a CRM system on to a client’s site that is heavily customised and contains unique configuration data. Before importing the client’s actual data we decide that now would be a great time to create a copy of the clients system on a virtual environment. How do we do this? Like I said it’s quite easy!
The very first thing we need to do is backup the organisation’s database that we want to transfer to our virtual environment. We can do this using Microsoft SQL Server Management Studio. To take a backup follow these steps.
- Startup Microsoft SQL Server Management Studio.
- Authenticate yourself to the instance where the MSCRM databases are stored.
- Expand databases, and right click on your organisation’s database.
- Select Tasks > Backup.
- Set the destination of your backup. If you already have a destination set but you are not happy with the location or the name you can remove it and add a new one.
- Hit ok and your database will start to backup.
Deploy Database Backup
Now that we have our database backup we will now deploy it. In our scenario we would actually redeploy in to SQL Server on the virtual machine. I am actually going to remove my original organisation through deployment manager and delete the database. Now restoring the backed up organisation simulates our scenario.
- First create a new database.
- Enter a name for the database. Here you should stick to convention so name the database as <OrganisationName>_MSCRM.
- If you wish you can change the Path of where the database and logs will be stored.
- Press OK. The database will now be created.
- Right click on the newly created database and select Tasks > Restore > Files and Filegroups. If you can’t see the database click on the refresh button.
- Select From Device.
- Hit Add and select your backed up database.
- OK the database select and OK the device.
- Under General make sure Restore is checked.
- On the options tab chose to Overwrite the existing database (WITH REPLACE).
- Select OK. If the database restore doesn’t seem to play ball you can always connect to the master database and run the following SQL Statement. Just sub in your database and database backup name.
RESTORE DATABASE Test1_MSCRM FROM DISK = 'Test1_MSCRM.bak' WITH REPLACE
Informing CRM of the Database
Now that the database as been restored our last steps are to tell CRM about the new database. We do this through Deployment Manager. Deployment Manager will then inform the MSCRM_CONFIG database of the new organisation.
- Open up Deployment Manager.
- Select Organisation on the left of the screen.
- Then select Import Organisation on the right of the screen
- Choose the database instance and database to import.
- Click Next.
- Now enter your display name and unique database name. This really should be the same as the original.
- Leave the report server URL as it is.
- Select automatic mapping. This will attempt to map record owners with AD users in your current environment. If automatic mapping fails you can choose to manually point record owners to AD users. If your security roles dicate that users can only see records they own you should really aim to get every owner mapped to an AD user.
- Select Next and hopefully watch your system checks all come back valid.
- Click Next and click Import.
The Deployment Manager will now add the relevant hooks to make your database part of your system deployment. Once the deployment is finished you will be able to navigate to your new organisation and see that it is the same as the original 🙂