Two-Way Sync - Omega Sync, SQL database comparison and synchronization

Two-Way Sync Tutorial


Purpose of this tutorial is to show you basic use of Data Sync. In the first tutorial we showed how to compare two databases. In the second tutorial we showed how to synchronize work database to match the reference (one-way sync). We will now synchronize the changes using the most advanced mode: Two-Way Sync. We have the ability to synchronize data in both ways - from reference to work, and from work to reference. The level of control is unmatched by any other sync software - we can control each difference - table, record, or even a single value.

After synchronizing data from the One-Way Sync tutorial, databases are equal. To get our differences back exactly as we had them in the last tutorial, we restored the MySQL database from backup.

Let's continue from that point and sync the databases. Here is a breakdown of what we'll do:
  1. Edit our project project and change the mode from One-Way Sync to Two-Way Sync (this will enable us to change both reference and work database)
  2. Compare our databases
  3. Review differences and change the sync direction for some diffs
  4. Synchronize
  5. Recompare to make sure our databases are equal

Edit project

As we already have the comparison project open from the One-Way Sync tutorial, we will simply edit the project and change the project mode from Comparison to One-Way Sync.

Two-Way Synchronization project

Compare

Finishing the project wizard starts the comparison right away.
Comparison result
As expected, we see the same differences as when we compared the databases before. Also, by default all changes occur in the work database. We will make some changes to sync process when reviewing differences a bit later in this tutorial.

Review differences

Let's explore the differences for each table.
Clicking on the Categories table name opens a grid showing the detailed info of the table differences. We have quite innovative user interface here, making it very easy to navigate the table.
Just for fun, we will change the last row sync direction from ref->work to work->ref. So, instead of deleting an extra record in work database, we will insert it to reference.

Categories table

Categories diff
In the Customers table, we will make on small modification to sync. Instead of reversing sync direction for the whole record, let's just modify one value. That means a single value will be copied to reference, while the rest of the record will modify the work database. Possibilities are endless. You can see that the action value changes from update work to update both.

Customers table

Customers diff
Each change we do here is reflected in the Comparison summary.

Summary after our modification of sync directoion

Customers diff

Synchronize

Clicking the Synchronize button in the ribbon will not start the sync process immediately. Instead, we can review the commands and confirm we want to sync.
Synchronization dialog
Before actually synchronizing, we can click on the Show SQL link to examine the SQL we'll run against each database. Better safe than sorry.

Generated SQL commands for reference database

Reference SQL commands

Generated SQL commands for work database

Work SQL commands
OK, let's finally click the Synchronize button so Data Sync can do the magic! A single click, and after a few seconds we see that data was synchronized and we're done.
Synch result

Recompare

So, did Data Sync synchronize the tables properly? A single click on the Recompare button will tell.
And, the result is... Databases are equal! Nice.
Equal databases

That's all for this two-way sync tutorial.

We invite you to explore Data Sync more, and, of course, to purchase it. If you want to test it yourself, just download a free trial.

Buy NowFree Trial


Learn more about Data Sync
Spectral Core Chat

Current version

ReleaseJuly 13, 2010
Omega Sync 2.8 released
To see detailed version history of this application, click here.