Sitecore – Database Migration

During all projects, there are different environments that have to be setup and different users working on each environments.

For example, you can have different staging environments and production environments as shown below:

Environment Setup

Usually, developers mostly work on the Staging Environments while Webmasters and Operation teams work on the Production Environments. Due to this, the contents of the Production Environment are more up to date. The reason is because webmasters perform their configurations and web-mastering tasks on the CM Environment so that they are published lived, hence, the contents are not reflected on the Staging Environment.

One way to overcome this issue is to backup the database of the Production Environment and restore it on the Staging Environment. However, there are some additional steps that are required after restoring the database on the Staging Database.

  1. Supposed you have different APIs for Staging and Production. If you are storing APIs in Sitecore CMS, that is, in item fields, you will need to manually update those item fields in order for the production APIs are not being used on the Staging Environment.
  2. When restoring the Databases of Production to Staging, the main concern here is that the different tables in the database contains events and machine names which are specific to the Production Instances.

In order to resolve this concern, there is the need to perform cleanup on the different tables.

Core Database

Database Name Table Name
Core dbo.EventQueue
 Master dbo.EventQueue
Web dbo.EventQueue

Note: If you have additional Databases containing the above tables, you need to clean those also.

Event Queue Table

You need to delete all the records found in the Event Queue table because the event queue contains records based on the Production Environment. For example, events which needs to be triggered on the different servers.

Properties Table

Cleaning the properties table is required because this table contains records about the Last Published and Last Index Rebuild of each machine. Hence, this is storing data of the machine, that is, the server name.

However, we should not remove all the records. Based on the SQL statement provided below, you may use this to remove the specific records.

Delete * From [Properties] where [Key] like 'EQSTamp%'

This will only remove the required records.


Why Cleanup is required?

The cleanup is important because we have experienced issues before whereby the rebuild index and cache clearing were taking time to trigger. This was because our servers were not being in sync. You may read my post on the Sitecore Server Synchronization.

Another method to make your Staging environment up to date with production is the use of a tool call TDS. With this, you can create a differential package which will contain all the items that have been modified or new.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s