Understanding replication
The Replication System connects several company files on different servers or branches and keeps them identical. A transaction is entered in one file, then travels to the other files on a schedule you set. The program relies on SQL Server merge replication, and the SQL Server Agent service runs the schedule.
You open the tool only from the publisher file. It is meant for the system administrator and anyone who knows the database server. This page explains the ideas; the fields and buttons are in Replication System.
The tool needs the replication feature in the program licence, the SQL Server replication component installed, and SQL Server Agent running. The opening checks are in Open the replication system.
Roles
| Role | What it is | Where you see it |
|---|---|---|
| Publisher | The main file from which replication is managed. It defines the articles that are published. | The file that is open when you open the replication system. |
| Distributor | A database that stores the replication jobs and their history. The program creates it on the publisher's own server under the name AmeenDistribution, and links a Windows account that runs the jobs. | The Settings wizard in Replication wizards. |
| Subscriber | Another company file on another server (or the same company on another server). It receives what the publisher publishes and sends back what changes on its side. | The Create Subscriber wizard. |
| Server | A SQL Server registered in the program under a description. The subscriber wizard picks the subscriber's server from this list. | Add Database Server. |
The usual order: define the distributor once, then a publisher that picks its articles, then a subscriber for each file you want to link. The steps are in Create a publisher and a subscriber.
Source and branch
Every file in the system has a Source code and a Source name. The main source is registered with code 0000 and name Main Database when the distributor is created, and the subscriber wizard asks for a code and name for each new subscriber. What the program shows depends on the source: the record navigator shows a coloured source box, and the program refuses to edit a record that belongs to another source.
Replication types
The Settings wizard asks for the replication type once:
| Type | Meaning |
|---|---|
| Branches and Types | Each subscriber belongs to a branch and sees only the types of that branch. It needs the branches system to be enabled and a branch card to exist. |
| Types | No link to branches. The program gives each new subscriber a host name automatically (A, then B, and so on), and the subscriber chooses the types it receives. |
| All | The wizard does not offer it. It applies to a file that has no saved type; the program then creates one article called Similar Node that covers all tables. |
The status bar of the replication window shows Branches and Types or Types.
Articles
An article is a group of tables that are synchronized together. The publisher chooses the articles it uses, and each subscriber then chooses what it needs.
| Article | Note |
|---|---|
| Main Article | Always required. It holds the synchronization direction. |
| Materials and Groups, Accounts | Always required. |
| Entries | Parent article of Bills and Commercial Papers. |
| Bills | Parent article of POS and Restaurant, Manufacture, Orders and Distribution. |
| Log File, Users Messages, Archiving, Loyalty Cards, Options, Assets, Custom Fields, Shipping | Independent. |
Choosing a child article selects its parent automatically. For Materials and Groups, Accounts, Entries, Bills, Commercial Papers, Distribution and Archiving, the subscriber also gets a list of records to choose from (material groups, accounts, entry types, bill types, commercial paper types, distributors and document types).
How synchronization runs
- The publisher gets a snapshot for each article: an initial copy that runs once.
- Each subscriber gets a synchronization job for each article, on the schedule you set in the subscriber wizard: daily, weekly or monthly, once a day or every number of hours, minutes or seconds.
- When the job runs, it moves changes from the publisher to the subscriber, and from the subscriber to the publisher, according to the Sync Direction of Main Article you chose when creating the publisher: Bidirectional, To Subscriber with edit or To subscriber without edit.
- You can run synchronization at once from the replication system window (Sync and Sync Subscriber), or in the subscriber file with Run subscriber synchronization.
The schedule is stored in SQL Server Agent. Jobs do not run while the service is stopped. You find the jobs, like other scheduled work, in Current tasks.
Conflicts
A conflict happens when the same record is changed at the publisher and the subscriber before synchronization brings them together, or when moving an insert, update or delete fails. Synchronization ends the record with one value and keeps the other for you to review. The Conflicts tab shows the count, the types, and the value of each column under Conflict Winner and Conflict Loser (Replication System). The tab only displays: it has no button to delete conflicts or to restore the losing value.
Job history and summaries
- The Replication Details tab: the run history of the selected article or subscriber (state, start, end, duration, operation counts, last message).
- The Summaries tab: the last run and the next run of every article and every subscriber.
- In a subscriber file, the Replication report shows the last synchronization of each article, and notifications point you to it.
What changes in the files
- Editing and deleting: in windows that have the record navigator, the program refuses to modify or delete a record whose source code does not belong to the current file, with the message "Cannot perform an operation that has a source code not belong to the current database."
- Subscriber file: some cards (user cards among them) check whether the file is a subscriber, and refuse Add, Modify and Delete with "Unable to edit! The current file is a subscriber file in Replication."
- Updating: when you update a publisher file, the program deletes the subscribers and articles after saving their settings, and the Restore Subscribers button brings them back (Update files). A subscriber database is separated from the publisher when it is updated.
- Reindexing: the Quick Archive option is always selected (Reindex files).
- Tools the program refuses in a publisher or subscriber file, with "The tool cannot be used in a file that has the Replication system activated.": Delete Automatic Entries and Cancel Posting Bills (Delete automatic entries), Copy bills and Merge bills by customer.
- The file option Replication system - Lock current file is changed in the program options. When you select it, the program warns that it will close the file after saving, so check the last synchronization first. When the licence includes replication, only an administrator can select it.
- When you carry balances forward, you can move the replication settings to the new file.
- If the file is a publisher and the licence does not include replication, the program shows "Cannot continue! the file is related to Replication system and the current key does not support it." when you open it.
Related
This page applies to alameen ERP 10, version 10.1.79.764.