Is there a way to synchronize two SQL Server 2008 databases(any edition) using Microsoft Sync Framework and SQL Server 2008 Change Tracking mechanism, instead of provisioning the databases with the required schema changes(triggers, sps, aux tables) to track changes?
Is there any code sample?
Yes, this is possible. Use the Sql Express sample sync provider (http://archive.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=1200).
It is not supported by Microsoft and it uses Sync Framework 2.0 techniques instead of the newer 2.1 techniques for collaborative sync.
Enable change tracking on the server, create the anchor and guid table on the client. Create sync adapters per table in the sync agent and you're off. You have to keep in mind that the sql express client provider uses the server provider under the covers, so you need to reverse it's thinking in some places (download becomes upload).
Related
I have two databases in SQL Server 2016 Express, one on the server and the other is local. I want to sync data from the local to the server database every day, one way.
I could not use replication or log shipping because SQL Server edition is Express.
I found the MS Sync framework could help but it is too old.
What is the latest technology for doing that?
Azure SQL Data Sync feature may be a very easy solution for your goal. Take a look at https://learn.microsoft.com/en-us/azure/sql-database/sql-database-sync-data
If you want the data synched not once per day but simultaneously, you could have a look at Microsoft Sync Framework 2.1. https://www.microsoft.com/de-ch/download/details.aspx?id=23217
I've used it over a custom WCF service, but I think you can use it directly with db connections.
I'm currently evaluating options for synchronizing two identical databases that will be deployed on two different SQL Server (1) instances. I've started with the Microsoft Sync Framework and if it does not fit my requirements I'll check SQL Replication.
Anyway, long story short, I'm trying to get a basic scenario to work using the Sync Framework but unfortunately all of the examples and tutorials I've seen online use the SQL Provisioning Provider which adds certain tables, stored procedures and triggers to the database - I want to avoid this, obviously.
I read somewhere that the Sync Framework can use SQL Server's built-in Change Tracking features, but this only works when the client is SQL CE (example). But all what I have read so far seems to be out-dated. I couldn't find anything that is relatively recent about the topic. So I was wondering whether the above is still valid or the Sync Framework added support for the built-in Change Tracking with SQL Server 2012 (or 2014).
In case this scenario is still not supported until this day, could someone refer me to an example (or at least some hints) of how I could develop a custom provider to use Change Tracking on both the client and the server?
(1) SQL Edition is not a constraint. Even SQL Server Enterprise Edition is an option.
support for SQL Change Tracking only works for the older SqlCeClientSyncProvider/DBSyncProvider/SyncAgent, in short you can only use to sync SQL Ce with a SQL Server configured for SQL CT.
the newer sync providers do not support SQL CT.
there used to be a sample SQLExpressClientSyncProvider from MS that has been pulled out from the download site due as it has some issues.
Writing a custom sync provider is not easy, if you can go for SQL Replication, that will be an easier route.
I want to start a rather big project (in the end). My tool of choice is basically ASP.NET MVC/WEB Api.
I would like to develop this in the beginning by using SQLite or SQL Developer edition.
Then when i go live i would plan to go to a shared hosting by using SQL Server 2012/2014 instance.
My target is that if everything is ok to convert to cloud and Azure.
So my plan that i would like to enhance/verify is:
Frontend:
Since my knowledge of AngularJS/Knockout e.t.c is lomited. I will start by using the normal Jquery/web API approach and gradually i will conver tot latest best practices and standards.
Backend:
Program to an Interface. I will have an interface for my DAL
Implement different interface for my different cases (sqlite/sql server/azure e.t.c)
In order to get a fast start to building it i would start with a good domain class design and then head to SQLite in combination of a light ORM (Dapper) in order to have my logic up and running fast.
This post: SQl Azure offline , suggests that i could start developing for sql azure right away, but i don't know if i can afford from the beginning to go to azure.
Sql Azure is basically the same as Sql Server 2014. If you start with the free SQL Server Express edition then you will have very few problems moving to SQL Azure later, especially if you use a tool like the SQL Server Migration Wizard and pehaps setup a free Azure trial account so you can test as you go?
You can just use your local Sql edition as mentioned by #Neil Thompson, If you are using SQL Server Database Project, there is an option to target your deployment to SQL Azure database instead of full version of Sql Server,
I have been using above option without much problem.
Sql Federation in Azure which is I think the only major non-supported feature in on-premise/local Sql edition that you would need Sql Azure for day-to-day development/testing.
I'm using the Sync framework 2.1 with SQL Server 2008 and SQL Server CE with several clients.
I provisioned the client db and synced, then deployed that file with every client application.
Now sync doesn't seem to work correctly on all but one client. Did I need to provision the db for each client independently instead of using a copy?
This question does suggest so, please advise SyncFramework 2.1 updates & deletes do not seem to apply properly
in Sync Fx, each replica has a unique id to differentiate it from the other replicas. by copying a database, you'll end up with several replicas having the same id.
so what your doing will not work. if you want use a provisioned SQL CE database to initialize other clients, generate a snapshot and deploy the snapshot.
see: How To: Provision for Synchronization Using Snapshot Initialization
Does the sync framework allow me to synchronise (download only) the Store Procedures on a sql server 2008 server with the Stored procedures on the SQL Server 2008 client?
i.e. overwrite the SP on the client when the server SP's have been modified or new ones created?
No you cant do that, The Sync Framework is designed to sync data from server to a users pc and back again. While it can synchronize between servers, you are better off using SQL2008 replication engine, or a 3rd party API, such as Redgates SQLcompare, which you can operate programatically.
Microsoft Sync Framework is used to synchronize data not the database schema or the periphery. Generally speaking, this is an application update issue.