Contents IndexIntroduction to data replication SQL Remote features

User's Guide
   Part III. Using SQL Anywhere
     Chapter 27. Introduction to SQL Remote Replication
      SQL Remote concepts

This section introduces concepts and terms used throughout the chapter.

Top of page


Consolidated and remote databases

SQL Remote provides data replication between a consolidated database and a remote database or databases. Remote databases are SQL Anywhere servers or standalone database engines that may be running at the same site as the consolidated database or at different sites. Stated another way, SQL Remote supports hierarchical configurations of databases; it does not support peer-to-peer replication or other non-hierarchical configurations.

The consolidated database contains all the data to be replicated. Remote databases may contain all the data or may contain just some of the data. Replication is two-way: changes made at the consolidated database are replicated to remote databases, while changes made at remote databases are replicated to the consolidated database, and thence to other remote databases.

With a hierarchy constructed in this way, each database contains all or a subset of the data replicated by the node above it in the hierarchy.

Remote databases can contain tables that are not present at the consolidated database, as long as they are not involved in replication.

Top of page


Message-based replication

SQL Remote exchanges data between databases using messages. This allows replication between databases that have no direct connection: an occasional message-based connection such as e-mail is sufficient.

In message-based communications, each message carries its destination address and other control information, so that no direct connection is needed between applications exchanging information. E-mail is one example of message-based communications.

Just as session-based client/server applications rely on network communication protocol stacks, such as TCP/IP or Novell NetWare's IPX, so message-based applications rely on message services such as Microsoft's Messaging API (MAPI), Lotus' Vendor Independent Messaging (VIM), Internet Simple Mail Transfer Protocol (SMTP) or a shared file link. Message services use store-and-forward methods to get each message to its destination: for example, e-mail systems store messages until the recipient opens their mail folder to read their mail, at which time the e-mail system forwards the message.

Unlike some session-based communications, many message-based systems do not guarantee that messages reach their destination, or that messages are received in the same order they were sent. SQL Remote incorporates a protocol to guarantee reception of replication updates in the correct order.

Building a replication system on top of a message system means that SQL Remote does not need to implement a store-and-forward system to get messages to their destination. Just as session-based client/server applications do not implement their own protocol stacks to pass information between client and server, so SQL Remote uses existing message systems to pass the messages. Each computer involved in a setup must have a message system client installed, and they exchange information through the message system.

Top of page


The Message Agent

The SQL Remote technology is contained partly in the SQL Anywhere database engine and partly in the Message Agent. The Message Agent is a client application that sends and receives messages from database to database. The Message Agent is a program called DBREMOTE, and it must be installed at both the consolidated and at the remote sites.

Top of page


Publications and subscriptions

The publication is a database object describing data to be replicated. Remote users of the database who wish to receive a publication do so by subscribing to a publication.

Data is organized into publications

A publication may include data from several tables. Each table's contribution to a publication is called an article. Each article may consist of a whole table, or a subset of the rows and columns in a table.

Periodically, the changes made to each publication in a database are replicated to all subscribers to that publication. These replications are called publication updates.

Each end of the replication needs a publication and a subscription

Remote databases subscribe to publications on the consolidated database so that they can receive data from the consolidated database. To do this, a subscription is created at the consolidated database, identifying the subscriber by name and by the publication they are to receive. SQL Remote always involves messages being sent two ways. The consolidated database sends messages containing publication updates to remote databases, but remote databases also send messages to the consolidated database.

For example, if data in a publication at the remote database is updated, those updates must be sent to the consolidated database. Even if the publication is never updated at the remote database, the remote database sends confirmation messages back to the consolidated database, to keep track of the status of the replication. Messages must be sent both ways, so not only does a remote database subscribe to a publication created at the consolidated database, but the consolidated database must subscribe to an identical publication created at the remote database.

When remote database users modify their own copies of the data, their changes are replicated to the consolidated database. When the replication is made successfully at the consolidated database the changes become part of the consolidated database's publication, and are included in the next round of updates to all remote sites (except the one it came from). In this way, replication from remote site to remote site takes place via the consolidated database.

When a subscription is initially set up, the two databases must be brought to a state where they both have the same set of information, ready to start replication. This process of setting up a remote database to be consistent with the consolidated database is called synchronization. Synchronization can be carried out manually, but the database extraction utility automates the process. You can run the extraction utility from Sybase Central or as a command-line utility.

The appropriate publication and subscription are created automatically at remote databases when you use the SQL Remote database extraction utility to create a remote database.

Top of page


Remote database users

A replication setup includes many copies of the information in a database. While each replicate is a physically separate database on a separate computer, whether it be a sales representative's laptop computer or an office database on a server, all must stay consistent with the consolidated database. The entire replication setup may be considered a single database, with the master copy of all data being kept at the consolidated database.

Each remote site that submits replications to the consolidated database is considered to be a remote user of the consolidated database. In the case that a remote site is a multiuser server, the entire site is considered to be a single remote user of the consolidated database.

Top of page


Contents IndexIntroduction to data replication SQL Remote features