SQL Server Replication Guide
SQL Server Replication Guide
2
SQL Server Replication Guide Rev: 2016-10-20
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Sitecore CMS 6.3 - 7.2
Table of Contents
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 2 of 20
SQL Server Replication Guide
Chapter 1
This document provides guidance for using SQL Server replication with Sitecore.
This information in this document is valid for Sitecore CMS 6.3 and later. SQL Server
replication is supported on Sitecore 6.3 and later.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 3 of 20
Sitecore CMS 6.3 - 7.2
Important:
Synchronize the operating system time between Content Management and Content Delivery
environments. The operating system time must be the same for all CM, CD and database instances
on all Web Servers and Database Servers.
1.2.1 Distributor
A distributor is a database server responsible for synchronizing data using SQL Server replication,
managing publications and subscriptions. SQL Server uses a distribution database to manage
replication.
1.2.2 Publication
A publication is a database to synchronize using SQL Server replication. Select a database in one
environment as the publication database. The corresponding database(s) in other environments will
function as subscriptions.
1.2.3 Subscriptions
A subscription is a database to synchronize using SQL Server replication.
Because any environment can initiate data changes in a replicated database, the publication
database functions as a subscription database.
You can use any of the techniques described in the following sections to create subscriber databases
from the publication database.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 4 of 20
SQL Server Replication Guide
Note
Because you only initialize a subscriber once, you do not need to schedule the snapshot agent.
1For instructions to copy a database using SQL Server Integration Services, see
http://msdn.microsoft.com/en-us/library/ms188664.aspx.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 5 of 20
Sitecore CMS 6.3 - 7.2
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 6 of 20
SQL Server Replication Guide
4. In the Distributor window, select the option that allows the database to act as its own
distributor, and then click Next.
5. In the Snapshot Folder window, in the Snapshot folder field, enter the path to the folder
where you want to store snapshots.
To make snapshots easily available for initializing subscriptions, enter the path to a network
share. For more information about initializing subscriptions, see the section Subscriptions.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 7 of 20
Sitecore CMS 6.3 - 7.2
6. Click Next.
7. In the Distribution Database window, in the Distribution database name field, enter a
name for the distribution database.
8. In the Folder for the distribution database file field and in the Folder for the distribution
database log file field, enter appropriate values and then click Next.
9. In the Publishers window, select the database server, and then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 8 of 20
SQL Server Replication Guide
10. In the Wizard Actions window, select the Configure distribution check box, and then click
Next.
11. In the Complete the Wizard window, review the options that you selected and then click
Finish.
3. In SQL Server Management Studio, in the Object Explorer, expand the database, expand
Replication, right-click Local Publications, and then click New Publication.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 9 of 20
Sitecore CMS 6.3 - 7.2
5. In the Publication Database window, select the publication database, and then click Next.
6. In the Publication Type window, in the Publication Type field, select Merge publication, and
then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 10 of 20
SQL Server Replication Guide
7. In the Subscriber Types window, select the version of SQL Server that all your Sitecore
instances are running on, and then click Next.
8. In the Articles window, select all of the tables, and then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 11 of 20
Sitecore CMS 6.3 - 7.2
10. In the Snapshot Agent window, select the Create a snapshot immediately and keep the
snapshot available to initialize subscriptions check box, and then click Next.
For more information about initializing subscriptions from snapshots, see the section Initialize
Subscriptions with a Snapshot Using a Network Share.
11. In the Agent Security window, if you need to configure security, click Security Settings, and
configure the security settings as required. Then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 12 of 20
SQL Server Replication Guide
12. In the Wizard Actions window, select the Create the publication checkbox, and then click
Next.
13. In the Complete the Wizard window, in the Publication name field, enter a name for the
publication, and then click Finish.
Note
You can enter any allowed value for Publication name.
14. To ensure that replication works, you must configure the publication to replicate the
EventQueue table after the other tables.
To replicate the EventQueue table, execute the following SQL script on the Publication
database:
EXEC sp_changemergearticle
@publication = 'msavPublication',
@article = 'EventQueue',
@property='processing_order',
@value=100;
GO
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 13 of 20
Sitecore CMS 6.3 - 7.2
2. In SQL Server Management Studio, expand the database, expand Replication, right-click
Local Subscriptions, and then click New Subscriptions.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 14 of 20
SQL Server Replication Guide
5. In the Database and publication field, select the publication and then click Next.
6. In the Distribution Agent Location window, select the Run each agent as its Subscriber
(pull subscriptions) option to reduce the load on the distributor, and then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 15 of 20
Sitecore CMS 6.3 - 7.2
8. In the Distribution Agent Security window, select an appropriate account for each
subscriber, and then click Next.
9. In the Synchronization Schedule window, in the Agent Schedule field, select Run
continuously, and then click Next.
10. In the Initialize Subscriptions window, in the Subscription properties field in the Initialize
When column, select Immediately, and then click Next.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 16 of 20
SQL Server Replication Guide
11. In the Subscription Type window, in the Subscription properties field in the Subscription
Type column, select Client, and then click Next.
12. In the Wizard Actions window, select the Create the subscription(s) check box, and then
click Next.
13. In the Complete the Wizard window, review the option you selected, and then click Finish.
Warning
Reducing the polling interval can increase server load.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 17 of 20
Sitecore CMS 6.3 - 7.2
3. In the Job Step Properties dialog box, in the Command field, add -PollingInterval
<seconds>, where <seconds> is the number of seconds between polls.
For example, enter -PollingInterval 1 to poll for data changes every second.
2For more information about SQL Server Replication Agent Profiles, see
http://technet.microsoft.com/en-us/library/ms151223.aspx.
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 18 of 20
SQL Server Replication Guide
1.4.3 The Merge Process Was Unable to Deliver the Snapshot to the
Subscriber
You can get the following SQL error when replication for a database is set if the EventQueue table
is not empty:
The merge process was unable to deliver the snapshot to the Subscriber. If
using Web synchronization, the merge process may have been unable to create
or write to the message file. When troubleshooting, restart the
synchronization with verbose history logging and specify an output file to
which to write.
The process could not bulk copy into table '"dbo"."EventQueue"'.
Could not bulk load. The sorted column 'Stamp' is not valid. The ORDER hint
is ignored.
The reason is that the SQL server cannot initialize a subscriber database from the snapshot, which
contains values in a column of the "Timestamp" type (the EventQueue table has such a column).
In this case, do the following (assuming that you set replication to DB1 and DB2, publication is set to
DB1, and subscription is set to DB2):
1. Remove the subscription for the DB2 database (under the Local Subscriptions node in the
SQL Management studio).
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 19 of 20
Sitecore CMS 6.3 - 7.2
2. Remove the publication of the DB1 database (under the Local Publications node in SQL
Management studio).
3. Erase all the rows in the EventQueue table of the DB1 database (perform the TRUNCATE
TABLE EventQueue SQL command).
4. Disable write access to the DB1 database or make sure in another way that it is not modified
and no rows are added to the EventQueue table until you finish setting a new publication.
5. Create a publication of the DB1 database (so that the snapshot is created while the
EventQueue table is empty).
6. Create an empty database (for example NewDB2) to use it as a subscription database
instead of the DB2 one (the DB2 database is no longer needed).
7. Set a subscription for the NewDB2 database (so that the NewDB2 database is initialized from
the snapshot).
Sitecore® is a registered trademark. All other brand and product names are the property of their respective holders. The
contents of this document are the property of Sitecore. Copyright © 2001-2016 Sitecore. All rights reserved.
Page 20 of 20