Archive

Posts Tagged ‘SQL Azure Data Sync’

SQL Azure Import/Export Service has been released to Production

January 24, 2012 Leave a comment

SQL Azure Import/Export Service has been released to Production as of today!!!

SQL Azure Import/Export Service is available at free of charge for SQL Azure customers.

For more information visit the following blog post

Advertisements

SQL Azure Sync CTP2 – Synchronize SQL Azure with On Premise SQL Server and vice versa– How Sync Framework Tracks changes in databases – Part 3

June 8, 2011 Leave a comment

In the previous posts, we saw How to download, install and configure SQL Azure Sync Agent and then How to define Sync Group, Manually run the sync and How to define Schedules to run the Sync automatically

In this post, we will How SQL Azure Sync provisions the databases and How it identifies the changes in the data and upload or download the changes

Open Management Studio and connect to SQL Azure server which we used for Sync Group

image

And then connect to on premise SQL Server and open Countries database, you can see the Tracking Triggers and Stored Procedures for each tables

image

image

If you look at the list of the tables, For each table we added for Sync, a new table has been added for tracking

Ex. DataSync.city_dss_Tracking

image

This table will be populated based on the Trigger created on the Main Data table

image

Let us insert a new record and see how it works

To verify that there is no city exists with name “Parisppany” we will run the below query on SQL Azure server

image

The above query returns 0 rows

image

Now insert a new record for City table in on premise SQL Server, if you see the Output Messages, you will see 3 messages, its due to Adding record in both Tracking table and Main table

Let us check the Main table

image

Now let us check the Tracking table

image

The tracking table ID column refers to the Primary Key of main data table and it contains timestamp information to identify when the record was created or updated or deleted

When record is deleted “Sync_Row_Is_TombStone” will be set to 1

Other Tracking Tables:

There are 3 other tracking tables created during Sync Provisioning process

1. [DataSync].[scope_config_dss]

2. [DataSync].[scope_info_dss]

3. [DataSync].[schema_info_dss]

[DataSync].[scope_config_dss] table contains the schema of the tables which are syncronized as XML data

image

If you open and view the XML Data, you will see the Tables as Adapters, along with details of Tracking tables, Procedures and Triggers used for tracking

image

I hope this post gives you an idea of How SQL Azure Sync service identifies the changes and updates the data.

Please post your comments !!!

SQL Azure Sync CTP2 – How to Synchronize SQL Azure with On Premise SQL Server and vice versa–Create Sync Groups and Schedules – Part 2

June 7, 2011 1 comment

In the last post, we saw how to download, install the SQL Azure Sync Agent and configure it

In this post, we will see how to Create a Sync Group to include SQL Azure database and SQL Server On premise database, Synchronize them, and create a schedule to run them automatically.

Login to https://datasync.sqlazurelabs.com using your Azure account

image

Click on “New Sync Group” to define a new Sync Group

image

enter the name of the Sync Group and click on Database combo and select “Register New SQL Azure Database…”

image

Once selected this option, SQL Azure Database registration screen will popup

image

Specify the SQL Azure server name, Database name, User name and password and click “Test” to test the connection and then click “Save”

image

Click “Add” to add the database to Member List and click on “Set Hub” to specify it as main server

Again click on Database combo and select the On Premise database and click “Add”

image

Once completed adding the Hub and Sync Members, click “Next” to proceed

image

Select the table you want to Sync from “Available Tables” list and then click on Right Arrow to move to “Selected Tables

Once done selecting the tables, click on “Create Sync Group

image

To synchronize the databases initially, click on “Sync Now” button

image

Once the sync process starts, it will automatically redirect to “Sync Logs” tab, you can filter the logs by Sync Group and Database.

For initial sync, you will see 3 tasks, Provisioning of SQL Azure database for sync, Provisioning of SQL Server for Sync and then Sync the data

Once the tasks are completed, the Task state icon will change from Execution state to Ready State

image

To view the detailed log for each task, click on “View Log”

image

If you see the text marked showed in Yellow, it shows the total number of records downloaded.

Now we have successfully defined a Sync group and synchronized the data from SQL Azure and SQL Server bidirectional,

Let us now setup the Sync Group as a scheduled job

Click on “Sync Groups” and then select the Sync Group and click on “Edit

image

In the Edit screen, you add additional Sync Members, you can change the Sycnhronization direction

image

You can schedule the sync job to run on specific intervals of time

image

After select the schedule, click on “Save”, Now your sync job will automatically run every 15 minutes once or as per your schedule definition

image

Now you might be wondering, How the Sync Service identifies the changes made to data, Let us see that in the next post.

I hope you all find this post useful. Please post your comments !!!

SQL Azure Sync CTP2 – How to Synchronize SQL Azure with On Premise SQL Server and vice versa–Part 1

June 6, 2011 2 comments

SQL Azure Data Sync CTP2 is a SQL Azure Labs beta project which is a cloud-based data synchronization service built on Microsoft Sync Framework.

Using SQL Azure Data Sync you can synchronize data between SQL Azure to SQL Azure or SQL Azure to On Premise SQL Server on specific schedules for the specific tables.

You can sign up for SQL Azure Data Sync CTP2 invite in this website http://connect.microsoft.com/sqlazurectps

In this post, we will see how to Setup a Sync job to synchronize data between SQL Azure and SQL Server bi directionally

Once you received the Invitation Code from Microsoft Connect, you can activate the Sync CTP2 account in SQL Azure Labs (http://connect.microsoft.com/sqlazurectps )

After activating the Invite Code, Please login to https://datasync.sqlazurelabs.com using your Azure account

Sync Dashboard – has options to Manage the Sync Group, Databases (SQL Azure and On Premise SQL Server Databases), Agents

clip_image002

Let us first setup a Agent in Local SQL Server machine, click on “Agents” tab to download the Agent Setup

image

Click on “AgentServiceSetup.msi” link to save the MSI to your computer where you want to run the setup

Before installing the setup, we need to Generate Agent Key, Agent Key is unique to each Agents (Computers), used for its identification, To generate agent key, click on “Generate Agent Key

image

Specify the Name of the Agent, and then click “Generate”

image

The Agent Key will be generated and saved automatically, to view the Agent’ Key click on the Agent Name,

image

The Agent Key will be displayed on the right side, Copy that save it for your reference, we will use this during Agent Installation, if you have multiple agents, you need to generate multiple keys. You cannot use the same key for multiple agent installations.

If you notice the Status column, it will be shown as Warning, the reason is Agent is not communicating to the SQL Azure Sync Server.

Let us now install the agent and configure it to communicate to SQL Azure Sync Server

To install the agent, open the folder where you have saved the AgentSerivceSetup.msi and run the setup

image

image

Click “Next” to proceed

image

Select “I Agree” and then Click “Next” to proceed

image

Specify the Service Account User Name and Password, If you are planning to use Windows Authentication for accessing the databases for Sync Process, please make sure this Service User has permissions to connect to SQL Server and access the databases.

After specify the Service username and password, click “Next” to proceed

image

Select the installation folder, specify whether to install just for you or for every one and then click “Next” to proceed

image

Click “Next” to confirm the installation and proceed

image

Installation will continue

image

Once the installation is completed, click “Close” to complete the setup.

Before stating the Sync Agent Configuration program, please go to Control Panel –> Administrative Tools –> Service to start the “SQL Azure Data Sync Service”

image

Right click on the service and then click “Start”

Go to Start Menu –> All Programs –> Microsoft SQL Azure Data Sync CTP, the following two shortcuts will be available

image

Click on “SQL Azure Data Sync Agent CTP2” to start the Sync Configuration program

image

Click on “Edit Agent Key” to setup the Agent Key

image

Copy the Agent Key we saved earlier and paste it here and click “Ok” to proceed

Once saved click on “Ping Sync Service” to check whether the Agent is able to successfully connect to SQL Azure Sync Server

image

On success connection, you should get this below message

image

Click “Ok” to proceed and then click “Add Member” to add a new database for doing synchronization

image

Select the tab based on the authentication you are planning to do, In this demo we are going to “Windows Authentication”, after select the tab, specify the name of the SQL Server Instance and then specify the database and then click “Test Connection”

image

Once the connection is successful, click on “Save” to save the Sync Member

If you want to change the database or Authentication, click on “Properties” to edit the saved Sync Member.

To delete the Sync Member, use “Delete Member” option

image

Click on “Check Member Schema” option to verify the selected database schema is compatible for SQL Azure sync

image

Now you have successfully download the agent, generated the agent key, installed the agent and configured the Agent and Sync Member ready for Sync.

In the next post we will see how to configure the Sync Group and schedule the sync job and synchronize the data between SQL Azure to SQL Server and vice versa.

I hope you all find this information helpful, Please post your comments and feedback !!!

Synchronize or Replicate Databases in SQL Azure across Servers

May 9, 2011 Leave a comment

SQL Azure Data Sync is an incubation project in SQL Azure Labs, which provides Hub – Member model based to synchronize databases from one SQL Azure server to another. You can replicate data from one Hub server to multiple member servers.

You can sign up for free beta account in http://www.sqlazurelabs.com/

In this post, we will see how to use SQL Azure Data Sync to synchronize Northwind_DB from Server A to Server B

Step 1 : Once signed up and setup your account, click on “SQL Azure Data Sync” tab

image

Step 2: Click “Add New” to create a new Synchronization group

image

Enter Sync Group Name and click Next

Step 3: Click on “Register New Server” to add Hub Server

image

Repeat Step 3 to add Member Server

Step 4: Select the Hub Server and Member Server to participate in Sync Group and then select the database as well

image

Once defined the servers and database, click “Next” to proceed

For one Sync Group job, you can have only one Hub server, but you can define multiple jobs to use the Member server as Hub Server in another job

Step 5: Select the tables you want to Sync and click “Finish”

image

Now you have successfully defined the Sync Group job

image

Now you can manually run the Sync for first time by clicking on “Sync Now” button

To automatically setup the Sync job to run on specific schedules, click on “Schedule Sync” option

image

You can setup the job, to run Daily at specific time or Monthly on specific day and time, or Hourly or Weekly on specified days at specified time, once selected your preferred schedule, click “Ok” to proceed

If you double click on the “Sync Demo Group”, you can view the details and log of the job

image

Click “View Log” to see detailed log

Starting new job. Job ID = 2ccec979-3848-48f5-b0f6-73a90a8ae1d2

Retrieved ScopeName as 625dec91-cd29-465c-98de-e1fe4be221b9

Retrieved Hubendpoint as SERVERA.database.windows.net,Northwind_DB,625dec91-cd29-465c-98de-e1fe4be221b9

Retrieving DbSyncScopeDescription from Hub

Checking to see if Scope 625dec91-cd29-465c-98de-e1fe4be221b9 exists in endpoint SERVERB.database.windows.net,Northwind_DB

    Scope doesnt exist. Provisioning server.

Synchronizing Endpoint SERVERB.database.windows.net,Northwind_DB ==> HUB. Conflict Endpoint wins
    Total Changes Transferred = 0, Total Changes Failed = 0.
    Sync time (in seconds): 5.9.

Synchronizing HUB ==> Endpoint SERVERB.database.windows.net,Northwind_DB. Conflict HUB wins
    Total Changes Transfered = 217, Total Changes Failed = 0.
    Sync time (in seconds): 6.2.

I hope you all find this information useful. Please don’t use this yet for production, since its an incubation project.

%d bloggers like this: