Azure Datasync workshop Global Azure Bootcamp Lisbon 2018
286 events... 82 countries...
The oldest school in Lisbon...
Synchronizing data between Azure SQL
Database and SQL SERVER Instances
Marcelo Gonçalves Adade
Obrigado aos nossos Patrocinadores/Parceiros
Este evento não seria possível sem os seguintes patrocinadores nacionais:
Patrocinadores globais do evento:
As seguintes comunidades e parceiros contribuiram para realizar este evento:
SELECT * FROM GABLisboa2018.Speakers
WHERE Name = ‘Marcelo G. Adade';
Database Consultant at Pythian
co-leader PASS Group SQLMANIACS
MCT, MCP and OCP
10+ years of experience as a DBA
DB on both Worlds – onprem and cloud
The PaaS offering
Sync data from cloud to onprem
Data Sync requirements and limitations
Monitoring Data Sync and Best Practices
SELECT * FROM Agenda;
What about grampa’s replication?
Two flavors for replicating TO Azure
Introducing Azure Data Sync
Making it possible to synchronize data both ways
It is yet in PREVIEW!
Replicating on the data level - using INSERT, DELETE and
UPDATE triggers (on a secondary table)
Suitable for Hybrid Data Syncronization, (Globally) Distributed
Not suitable for DR, Read Scale, ETL, Migration from on-prem to
How it works – Azure Data Sync
Tracking changes: recorded in a secondary table;
Synchronizing data: Hub and Spoke model;
Resolve conflicts: either Hub or member wins;
Eventual consistency: trigger-based – transactional consistency is
not guaranteed, no data loss will happen though;
Change tracking may affect performance.
Primary key is needed;
Snapshot isolation must be enabled;
Minimum sync interval is 5 minutes;
Hub database must be an Azure SQL DB;
Member dbs can be on-prem and Azure;
Sync database has metadata and log for the Sync – has to be on
the same region as the Hub.
Identity has to be the Primary key;
PK can’t have a datetime type;
Names cannot contain . or ;
Azure AD is not supported;
Circular reference is not supported;
Filestream, SQL UDT, XMLSchemaCollection, Cursor, Timestamp not
HEY, but it is still free!
Give feedback here: https://feedback.azure.com/forums/217321-sql-database?query=data%20sync
1. Create the Sync group;
2. Add the HUB database;
3. Add the member databases;
4. If one of the member is an on premise db,
install the Agent;
5. Add the onprem db;
6. Adjust the options for the sync
Monitoring Data Sync
• A PowerShell runbook to feed SQL Data Sync log data to Log Analytics.
• A Log Analytics alert for email notifications.
• A Log Analytics View for monitoring.
• Automation account needed
From: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-sync-monitor-oms (Operations manager Suite)
Best practices for Data Sync
Client agent: least privileged rule;
Client agent: install on the computer that doesn’t host the SQL
Register an onprem database with only one agent;
Check database sizing;
Select only the tables you need;
Indexes won’t be added to destination if column is not selected;
XML Indexes are not provisioned
Best practices for Data Sync
Views and Procedures are not provisioned;
CHECK constraints are not provisioned;
For production, provision the schema yourself;
Keep the HUB Database close to most Members;
Check %TEMP% on Agent machine for space;
Is the Agent online?
Check if the XML file from the Agent is on the proper folder;
No circular reference is handled by Data Sync, so avoid it – “The Data
When installing the Agent use the notation <servername>account, not
Many more on: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-troubleshoot-data-sync
"Seriously, why do these people
Because the boxes PCs come
in are too hard for them to
open." Anonymous genius
Let’s add a Northwind database synced up –
from Azure to onprem!
Download the agent:
You need to adjust the Northwind database, changing Nonclustered Primary
Keys to clustered ones (script provided)