Académique Documents
Professionnel Documents
Culture Documents
Applies to: SQL Server 2008 R2 November CTP, SQL Azure, Microsoft Sync Framework 2.0
Purpose
Microsoft Sync Framework was built with the goal of creating an extensible
framework that can synchronize with any kind of data over any protocol. Since
shipping Sync Framework 2.0 in October 2009, the team has focused on expanding
Sync Framework’s functionality to include a free provider that can synchronize with
Microsoft’s cloud-based relational database service built on SQL Server
technologies, named SQL Azure.
While it was possible with some tweaking to use the existing ADO.NET provider for
synchronization with SQL Azure, Microsoft has created a synchronization provider
that performs efficiently, lowers the barrier to entry, and ensures reliability when
synchronizing with SQL Azure.
Microsoft Sync Framework Power Pack for SQL Azure November CTP contains the
new provider, SqlAzureSyncProvider, and tools that automate its use.
SQL Azure Data Sync Tool for SQL Server offers users a wizard that provisions and
configures a local SQL Sever database and SQL Azure database for synchronization
with one another. With this tool, enterprise-to-cloud synchronization can be
achieved in a few mouse clicks.
Components
Microsoft Sync Framework Power Pack for SQL Azure November CTP is comprised of
the following components:
SqlAzureSyncProvider
The power of the Sync Framework engine has been extended by the new
synchronization provider for SQL Azure, written by Microsoft. Named
SqlAzureSyncProvider, this is a new and free provider, which will enable the
Sync Framework engine to understand and synchronize with data that is being
exchanged between SQL Azure and any database that can be synchronized with
Sync Framework, using efficient and reliable algorithms to handle the
complexities of cloud synchronization.
SqlAzureSyncProvider Features
SqlAzureSyncProvider is a new database provider for Sync Framework 2.0 that
makes it easier than ever to create cloud-aware applications. Key features include:
2
SQL Azure uses a throttling mechanism to minimize the impact of runaway
operations on other users by controlling log growth and limiting transaction size.
When synchronization triggers this throttling mechanism,
SqlAzureSyncProvider responds by using a “back-off algorithm” which
automatically reduces batch sizes from the default of 5,000 rows during
synchronization. A helpful side-effect of the use of this algorithm is that changes
are viewable before synchronization is complete, and synchronization progress
can be displayed in real time.
Automated Provisioning
Getting off the ground has largely been automated by the
SqlAzureSyncScopeProvisioning and SqlAzureSyncTableProvisioning
classes. Everything that needs to happen cloud-side and on-premise is taken
care of by detecting the presence of, and (if necessary) creating, all of the
appropriate metadata tables. This is taken a step further by the new
SqlAzureDataSyncClient Visual Studio plug-in and SQL Azure Data Sync Tool
for SQL Server, both of which automate the setup of SQL Azure connectivity,
provisioning, and filtering.
Walkthrough
This section describes the preparation, setup, and use of Microsoft Sync Framework
Power Pack for SQL Azure November CTP.
Preparation
a. Ensure that the Sync Framework 2.0 SDK has been installed.
3
c. Ensure that Visual Studio 2008 Professional SP1 has been installed and
is not running.
d. Ensure that SQL Server 2008 has been installed and is not running.
i. For best results, use the November CTP release of SQL Server
2008 R2 or later. The November CTP ads native support for SQL
Azure to SQL Server Management Studio. The November CTP
release of SQL Server 2008 R2 can be downloaded from:
http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.as
px
i. To check the status of this service, click the “Start” button, then
click “Run.”
ii. In the “Services” window, scroll to the entry for “SQL Server
Agent.” Right-click the entry and then click “Properties.”
iii. In the “SQL Server Agent Properties” window, click the drop-
down menu labeled “Startup type” and select “Automatic,”
then click the “Start” button located under the label “Service
Status.” Finally, at the bottom of the window, click “Apply,”
then “OK.”
Installation
f. Download Microsoft Sync Framework Power Pack for SQL Azure
November CTP, then double-click the MSI file and run the installation
wizard using the default options. This will set up the SQL Azure Sync
plug-in for Visual Studio 2008 Professional SP1 as well as SQL Azure
Data Sync Tool for SQL Server.
4
g. Installation to a custom file path is not supported. If the tool is installed
to a custom path, any SQL Server jobs generated by these tools will
need to be manually updated.
Usage
SQL Azure Data Sync Tool for SQL Server Walkthrough
This walkthrough demonstrates the tool SQL Azure Data Sync Tool for SQL
Server, which utilizes SqlAzureSyncProvider to automate both the
provisioning and synchronization of data between an on-premise SQL Server
and SQL Azure.
5
Figure 3.1.2: Enter the names of the local SQL Server instance and local
database.
5. In the select box, highlight tables in the database associated with the
entered SQL.Azure.com account to add them to the synchronization
scope. Then, set the conflict resolution policy. Click “Next” to continue.
a. When “Process” is clicked, the schema for any tables that were
added to the synchronization scope will be created in the SQL Azure
6
database based on the schema in the local database, but the tables
will be empty until the synchronization job is run for the first time.
b. This tool assumes that the selected local database has not been set
up for synchronization with SQL Azure. If a database with the same
name is detected under the selected SQL Azure account, the tool
will prompt the user to drop the database from SQL Azure and rerun
the tool.
c. The conflict resolution policy determines which version of the data
managed by the synchronization relationship will be propagated in
the case of the data being updated in both Azure and SQL Server
since the last synchronization.
6. In the select box, use the “Move Up” and “Move Down” buttons to list
the selected tables in the order in which they should be synchronized
during a job. Click “Next” to proceed.
7
Figure 3.1.6: Name the synchronization scope and select the size of the
SQL Azure database.
8. Open SQL Server Management Studio and look under SQL Server Agent to
find a job named after the synchronization scope has been created. This
job can be run at any time to execute synchronization between the local
and cloud copies of the selected data.
Figure 3.1.7: The job, which will use Microsoft Sync Framework and
SqlAzureSyncProvider during synchronization, is added to the available
list in SQL Server Agent and is now ready to be executed.
8
a. In order for the job to run successfully, the credentials used by the
SQL Server Agent service must match the credentials of the
account running the job.
9
Figure 3.2.1: Right-click > Add > New Item
4. A “SQL Azure Data Sync” wizard will appear with the “SQL Azure
Connection” form selected. Enter a valid server name, database name,
username, and password associated with a SQL.Azure.com account. Click
“Next” to proceed.
10
Figure 3.2.3: Enter valid SQL Azure credentials.
11
a. The “Filter Columns” button is not functional at this time.
6. The data that is to be synchronized has been selected, and the
configuration is ready to be saved as a synchronization scope. Give the
scope a name by typing it next to the “Sync Scope Name” field. Click
“Next” to continue.
12
Figure 3.2.6: Specify the location of the local data store.
a. The tables will be empty until synchronization is run for the first
time.
b. Selecting an existing SDF file will result in the original file being
deleted and replaced.
8. References are added to the Sync Framework, Data, XML and SQL Azure
Data Sync assemblies. A generated class named after the scope that was
defined in step 4 is also added to the project. This class contains a method
named Synchronize which has been pre-configured for use with the
selected scope.
Figure 3.2.7: The project in Visual Studio after running the wizard.
13
9. Write code anywhere in the program that calls the Synchronize method.
For example, if a new C# project was created in Step 1, the
Main()method could be updated as follows:
10.Press F5 to build the project and launch the program in debug mode.
Feedback
This release was provided in order to gather feedback from our customers. Now
that you have previewed what the Sync Framework team is doing with SQL
Azure integration, please let us know what you think of our direction, and tell us
about your experiences.
• Email syncfdbk@microsoft.com.
Conclusion
The code, features and functionality being used and described here are
provided for demo purposes only, are still currently in development, and
are subject to change. For terms of use information, visit
http://www.microsoft.com/info/cpyright.mspx.
14
For more information:
15