| Database-independent synchronization strategy that only updates differences between two databases.
This strategy is best used when there are few differences between the active database and the inactive database (i.e. barely out of sync).
The following algorithm is used:
- Drop the foreign keys on the inactive database (to avoid integrity constraint violations)
- For each database table:
- Drop the unique constraints on the table (to avoid integrity constraint violations)
- Find the primary key(s) of the table
- Query all rows in the inactive database table, sorting by the primary key(s)
- Query all rows on the active database table
- For each row in table:
- If primary key of the rows are the same, determine whether or not row needs to be updated
- Otherwise, determine whether row should be deleted, or a new row is to be inserted
- Re-create the unique constraints on the table (to avoid integrity constraint violations)
- Re-create the foreign keys on the inactive database
- Synchronize sequences
author: Paul Ferraro version: $Revision: 2012 $ since: 1.0 |