User's Manual
How statements are replicated
SQL Remote replication is based on the transaction log, enabling it to
replicate only changes to data, rather than all data, in each update. When we
say that SQL Remote replicates data, we really mean that
SQL Remote
replicates SQL statements that modify data
.
Only committed
transactions are
replicated
SQL Remote replicates only statements in committed transactions, to ensure
proper transaction atomicity throughout the replication setup and maintain a
consistency among the databases involved in the replication, albeit with
some time lag while the data is replicated.
Primary keys When an UPDATE or a DELETE is replicated, SQL Remote uses the
primary key columns to uniquely identify the row being updated or deleted.
All tables being replicated must have a declared primary key or uniqueness
constraint. A unique index is not sufficient. The columns of the primary key
are used in the WHERE clause of replicated updates and deletes. If a table
has no primary key, the WHERE clause refers to all columns in the table.
An UPDATE is not
always an UPDATE
When a simple INSERT statement is entered at one database, it is sent to
other databases in the SQL Remote setup as an INSERT statement.
However, not all statements are replicated exactly as they are entered by the
client application. This section describes how SQL Remote replicates SQL
statements. It is important to understand this material if you are to design a
robust SQL Remote installation.
The Message Agent is the component that carries out the replication of
statements.
Replication of inserts and deletes
INSERT and DELETE statements are the simplest replication case.
SQL Remote takes each INSERT or DELETE operation from the transaction
log, and sends it to all sites that subscribe to the row being inserted or
deleted.
If only a subset of the columns in the table is subscribed to, the INSERT
statements sent to subscribers contains only those columns.
The Message Agent ensures that statements are not replicated to the user that
initially entered them.
Replication of updates
UPDATE statements are not replicated exactly as the client application
enters them. This section describes two ways in which the replicated
78