Data Replication with SQL Remote
PART 1. Introduction to SQL Remote
CHAPTER 5. A Tutorial for Adaptive Server Enterprise Users
The following sections are a tutorial describing how to set up a simple SQL Remote replication system using Sybase Central.
You do not need to enter SQL statements if you are using Sybase Central to administer SQL Remote. A tutorial for those who do not have access to Sybase Central, who prefer to use command-line utilities, or who wish to understand the individual commands executed, is presented in A tutorial using isql and ssxtract. The commands described in that section are executed behind the scenes by Sybase Central.
To work through the tutorial, you must have system administrator privileges on an Adaptive Server Enterprise server. The tutorial assumes that your login name is the two-letter word sa and that this login name has a password of sysadmin.
Create a database named hq on your Adaptive Server Enterprise with sufficient space to hold the tables and data required by the tutorial database. A space of 10 Mb is sufficient.
Connect to the Adaptive Server Enterprise from Sybase Central.
Open the Databases folder, and double-click Add database in the right pane.
Enter the name hq on the first page of the Wizard.
Follow the instructions in the Wizard.
For information on how to create databases and assign space to them, see your Adaptive Server Enterprise documentation.
You need to install SQL Remote into the hq database.
Open the hq database container, on the left pane of Sybase Central.
Open the SQL Remote folder, double-click Setup SQL Remote, and follow the instructions. For this tutorial, you should install the stable queue in the hq database.
If your TEMPDB database is too small, you may have to add space to it for this to work.
For a full description of how to install SQL Remote, see Setting Up SQL Remote.
Make a directory for the files created in this tutorial. For example:
mkdir c:\tutorial
You should create a directory for each of the two users of the replication system under your tutorial directory:
mkdir c:\tutorial\hq mkdir c:\tutorial\field
The next step is to add a pair of tables to the consolidated database.
Connect to the hq database from Sybase Central, as a system administrator.
Click the User Tables folder of the hq database.
Double-click Add Table, and use the Table Editor to create a table named SalesRep with the following columns:
Key |
Column |
Data Type |
Size/Prec |
---|---|---|---|
Primary key |
rep_key |
char |
5 |
name |
char |
40 |
You do not need to use the Advanced Properties window. The columns are created by default not allowing NULL.
Double-click Add Table again, and use the Table Editor to create a table named Customer with the following columns:
Key |
Column |
Data Type |
Size/Prec |
---|---|---|---|
Primary key |
cust_key |
char |
10 |
name |
char |
40 |
|
rep_key |
char |
5 |
Again, you do not need to use the Advanced Properties window. The columns are created by default not allowing NULL.
Open the Foreign Keys folder of the Customer table container, and double-click Add Foreign Key. Using the Wizard, add a foreign key to the rep_key column of the SalesRep table. You can use the default settings for this foreign key.
You are now ready for the rest of the tutorial.