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.
- 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.
- 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.
- Log in to the primary Adaptive Server:
isql -Usa -P -SSAMPLE_PDS
The
isql prompt appears:
>
- Choose the primary database:
- Grant the permission on authors table to public:
1> grant all on authors to public
2> go
- 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.
- 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
- 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.”
- Log in to the replicate Adaptive Server:
isql -Usa -P -SSAMPLE_RDS
The isql prompt appears.
- Choose the replicate database:
- 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:
- Add information to a table using the insert command.
- Delete information from a table using the delete command.
- Create and populate a table using the create table and then the insert
command.
- Depopulate a table using the truncate table command.
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.