Verifying Data Replication

Use Transact-SQL® commands to verify that replication is occuring.

Transact-SQL is used in Adaptive Server databases for querying, adding new data, modifying existing data, and deleting existing data. Transact-SQL is described in the Adaptive Server Enterprise Transact-SQL Users Guide.

  1. Log in to the primary database and use Transact-SQL commands to add, alter, or delete information in one or more of the primary database tables.
  2. Log in to the replicate database and confirm that your changes have been replicated.

Example

This example shows how to perform a simple update in the primary database, and then view the replicated changes in the replicate database.
  1. Log in to the primary Adaptive Server:
    isql -Usa -P -SSAMPLE_PDS
    The isql prompt appears:
    >
  2. Choose the primary database:
    1> use pubs2
    2> go
  3. Grant the permission on authors table to public:
    1> grant all on authors to public
    2> go
  4. Verify that Chastity Locksley is listed in the au_lname and au_fname columns of the authors table. To view all author names in the authors table, enter:
    1> select au_fname, au_lname
    2> from authors
    3> go

    Adaptive Server prints out the contents of the au_fname and au_lname columns.

  5. Change the name of Chastity Locksley to Chastity Hilton in the authors table. Enter:
    1> update authors
    2> set au_lname = “Hilton”
    3> where au_lname = “Locksley”
    4> go
  6. Verify that the change has taken place at the primary database. For example, enter:
    1> select au_fname, au_lname
    2> from authors
    3> where au_fname = “Chastity”
    4> go

    The primary Adaptive Server prints out “Chastity Hilton.”

  7. Log in to the replicate Adaptive Server:
    isql -Usa -P -SSAMPLE_RDS

    The isql prompt appears.

  8. Choose the replicate database:
    1> use pubs2
    2> go
  9. Verify that the change has replicated to the replicate database:
    1> select au_fname, au_lname
    2> from authors
    3> where au_fname = “Chastity”
    4> go

    The replicate Adaptive Server prints out “Chastity Hilton,” which indicates that the replication system is working.

Next
You can create your own Transact-SQL statements to update the primary database and then view the updates at the replicate database. For example, using the database replication definition and database subscription created during configuration, you can perform these actions and watch the changes appear at the replicate database:

You can create your own database replication definitions that filter out specified tables, transactions, or data definition language (DDL) commands.

See Replication Server Administration Guide Volume 1 > Manage Replicated Objects Using Multisite Availability for more information about creating database replication definitions and subscriptions, and customizing your replication environment.