Sitecore Quick Content Migration

Sitecore Quick Content Migration

This post is to describe the method we use to migrate content from Production to non production environments on regular basis and it takes less than 10 minutes to finish.

This method uses copy of production master database to lower environment and update required settings. Follow the steps below to update your content in lower environment in less than 10 minutes.

  • Login to Non production environment SQL Server using SQL Server management Studio as Administration or SA user.
  • Open a new Query window from Master (open Query window from Server, so it will run the query against master database).
  • Copy the Production database from non production instance using the query below.
CREATE DATABASE [NonProdMaster-New] AS COPY OF [ProdServer].[ProdMaster]

The above query will copy the master database from production SQL Server to non production SQL Server.

  • Verify the copying of database is complete by running the below query from the same query window used above
select * from sys.dm_database_copies

Make sure the above query return 0 results.

  • Update the masteruser password to non production master user password using the below query (if you are not sure about master password, you can get it from connectstrings.config in app_settings). Run this query against the [NonProdMaster-New]
ALTER User masteruser WITH PASSWORD = 'MasterPassword', DEFAULT_SCHEMA=[dbo];
  • Rename the current non production master database as backup database using the below Query (not this will break your Sitecore CM until you update the name of the new content database later).
ALTER DATABASE [NonProdMaster] MODIFY NAME = [NonProdMaster_Backup];
  • Rename the New Master database from Production to NonProdMaster
ALTER DATABASE [NonProdMaster-New] MODIFY NAME = [NonProdMaster];
  • Restart Your CM Instance.
  • Verify if your CM Instance is up and running.
  • Update the following Content Manually from your CM instance.
    • If Using EXM – Update Base Url and Preview Base Url on Email Folder item in Content.
    • Update Hostnames from Production to Non Production at /sitecore/system/Settings/Email/System/Hostname Mappings/Hostname Mapping
    • If using FXM and if Applicable update the primary domain
    • Any other custom settings for your non production environment.
  • Publish the Site.
  • Rebuild master and web indexes.
  • Your content is refreshed with the latest content from Production.
  • If you no longer need backup database of non production, you can drop that database using the below script
DROP DATABASE [NonProdDatabase_Backup];
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *