Step by Step IBReplicator Tutorial

By: Tom Gardner

Abstract: How to set up a source and target database for replication

Step1: Load the IBReplManager.

If no Replication configurations have been created previously you will be confronted with this message dialog. Click Yes.

Step2: Creating a configuration Database.

Now you will see the following screen.

  • Click on the create icon or Configurations|create menu item.
  • Type in a descriptive name
  • Server is the path and name of the configuration database.
  • User name is your user name for Interbase Server
  • Click the save icon or CTRL+S
  • You will now be prompted to enter your password for Interbase server.
  • After you have entered your password and pressed enter your Configuration database will be created.
  • To test that everything worked you can press the test connection Icon and supply your password.
  • Select the configurations menu and click on the default menu item. This will make this configuration database the default configuration database and will be loaded automatically every time when you load the IBReplManager or the IBReplServer.
  • Close the configuration Databases form and from the drop down list box select your new configuration database. Enter password again.

ADVANCED TOPICS:

Current Schema No: Internally, a Schema Number represents each schema created. This number is used when creating triggers on each replicated table. In complex replication environments, where multiple Configuration Databases may be configured, it is important that each Configuration Database uses different schema numbers, so that conflicts do not occur. If you have multiple configuration databases, make sure that the schema numbers are far apart. Ideally, keep the gap between numbers at 100 or 1000.

Step3: Adding a Source and Target Database.

Select the Databases page tab and this is what you will see.

  • Click on the add database icon or Select the Database|Add menu item.
  • Supply Descriptive Name, Server(Path and name of database), user name and password etc for your source database.
  • Select the SQL Dialect. Usually 1 for IB5.x databases, and 3 for IB6 and above.
  • Select a priority for each database. This is used in resolving conflicts, e.g. when trying to insert a row which is already present.
  • Click the save icon when finished.
  • Repeat this for your target database.

Once you have completed adding your Source and Target database you are ready to create your replication schema.

ADVANCED TOPICS:

TIME FIELD: This field is used for Time Stamped conflict resolution. This is only useful if the timestamps in all databases are reliable and meaningful. All tables are assumed to have a timestamp field with the same name.

RAS information: If you wish IBReplicator to dial another machine, then fill in these fields. The RAS name is the name of an ordinary Dial-up Networking entry, with its username and password entries. If you do not wish to drop the line after replicating to this database server, the set the Keep Connection option.

Step4: Creating your Replication Schema

Select the replications page tab and this is what you will see.

  • Double Click the Edit Default Settings icon.
  • Ensure that Conflict Resolution is set to Priority based. This will suffice for most setups.
  • Select the Event Logging tab.
  • Ensure that Log to Window is enabled and enable the following:
    • Connections
    • Errors
    • Key Values
    • Statistics
  • Press OK to save and exit.

  • Double click the New schema icon on the right side.
  • Enter a Schema name and press enter.
  • Leave all other parameters as default.

Below Defined Replication Schemata you will now see your new Schema.

  • Using your mouse extend the treeview until you see source and target database headings.
  • Click on the source database and then double click the add source database icon on the right side.

  • Select your Source database from the Registered database dropdown listbox.
  • Supply your user name and password.
  • Press the test connection button to test the connection.
  • Click the OK button.

  • Click on your Target database in your schema and on the right side.
  • Double click the Add target database and supply all the relevant parameters.

ADVANCED TOPICS

When adding a Source Dtabase, you can select the Settings and Event Logging tabs to overwrite the defaults set up in Edit Default Settings described previously.

Step5: Selecting the tables to be replicated.

Now that you have configured your source and target databases in your Schema you have to add the tables which are going to be replicated.

Under the target database heading in your schema you will see your new target database that you added in step4.

Extend the treeview further until you see Replicated tables and procedures and select it.

On the right side you will now see two icons.

Generate tables, keys and fields:

Double click this icon and you will be presented with an Auto-Generate Tables, Fields and keys screen. This option can only be used if your source and target tables are identical with respect to name and field names and they all have primary keys. Click the generate button and your target tables and source tables will all be matched including their fields.

Replicated Tables:

If the Autogenerate option is not appropriate, or you wish to modify the selected tables, then double click this icon and you will be presented with a Replicated tables and procedures screen. On the left side is a list of all your source tables and on the right is a list of all your target tables. Using your mouse drag the target tables to the appropriate source tables. If your source and target tables have the same name you can just double click the target tables and they will automatically be matched to the appropriate source tables. Click OK when done.

If you used the Replicated tables icon option then you will still have to link up the fields for each table. Extend your treeview until you see Key Columns and Data Columns headings. Select the Key Columns heading and on your right double click the Define Primary key Icon. Link your primary key from your Target database to your primary key of your source database.

For example 

In above you can see that CUSTNO is the Primary Key in both Source and Target tables and have been linked together. Click OK when done.

Now you still have to link up the rest of the data fields for the source and Target database.

Select the Data Columns heading and on the right double click the Define data columns icon. You will now be presented with a Replicated data columns screen. For example:

In above you can see that the target tables data columns are linked to the source tables fields. Click OK when done. Your Schema should now look something like the following 

In above Schema I have only one Table set up for replication namely my Customer table with one primary key and three data fields.

Step6: Creating system objects.

You now need to instruct IBReplManager to create all the necessary tiggers which will be used to replicate the data between the source and the target database.

Click on the Source Database heading in your treeview and on the right double click the create system objects icon. This may take a while depending on how many tables you have set up for replication and the speed of your computer.

What has happened now is that IBReplManager has created all the necessary objects in the source database needed for replication. Click OK when finished.

You can now shutdown IBReplManager and load your IBReplServer to start replicating new changes to your source database.

Additional IBReplmanager features at a glance.

Log to Window/File

When the IBReplServer is replicating data you can have all kinds of information displayed in the IBReplServer window for each replication event, for example connections, errors, keyvalues, statistics and Sql statements. To enable these you have to enable these options in the IBReplmanager as follow 

Load the IBReplmanager and in your schema view select the top most treeview item  Defined Replication Schemata and on the right side double click the Edit default settings icon. You will now be presented with a Schema defaults screen. Select the Event logging page tab.

You may now enable Log to file and/or Log to window options.

Whatever options are enabled for Log to window will be displayed in the IBReplserver display window

Replicate according to predefined time schedules.

The IBReplServer has a timer interval which corresponds to a certain amount of seconds between each replication event, however you can set up replication schedules for the IBReplserver to replicate once every hour, every Friday at 14:00 etc.

Load the IBReplManager and from the Tools Menu select the Scheduler.

Click the Add Schedule icon to add a new Replication Schedule.

Different types of Schedules available 

    • Once Only
    • Hourly
    • Daily
    • Weekdays
    • Weekly
    • Monthly

All of the above Schedule types have a time parameter except for Hourly which you have to specify the minutes.

After you have created your Replication Schedule(s) you need to start the scheduler. On NT/2000 you can install the Scheduler Service, but on Win95/98 you should click on the start icon and the IBReplmanager will immediately start your Replication Schedule(s). For the Replication Schedules to be active you have keep the IBReplmanager running, you can close the Scheduler window and continue with different options in the IBReplManager


Server Response from: SC2