Adding a Publication v6.2

Subordinate to a publication database definition, you create publications that contain tables and views of the database identified in the publication database definition.

Step 1: Select the Publication Database node. From the Publication menu, choose Create Publication. Alternatively, click the secondary mouse button on the Publication Database node and choose Create Publication. The Create Publication dialog box appears.

Step 2: Fill in the following fields under the Create Publication tab:

  • Publication Name. Enter a name that is unique amongst all publications.
  • Snapshot-only replication. Check the box if replication is to be done by snapshot only. Tables included in a snapshot-only publication do not require a primary key. Tables included in publications on which synchronization replication is to be used must have primary keys.
  • Publish. Check the boxes next to the tables that are to be included in the publication. If the Snapshot-Only Replication box is checked, then views appear in the Publish list as well. Alternatively or in addition, click the Use Wildcard Selection button to use wildcard pattern matching for selecting publication tables.
  • Select All. Check this box if you want to include all tables and views in the Available Tables list in the publication.
  • Use Wildcard Selection. Click this button to use the wildcard selector to choose tables for the publication. See Selecting Tables with the Wildcard Selector for information on the wildcard selector.

Create Publication dialog box

Figure 5-10: Create Publication dialog box

If you wish to use table filters during replications from this publication, follow the directions in the next step to define the initial set of available table filters, otherwise go on to Step 4.

Step 3 (Optional): Table filters consist of a set of filter rules that control the selection criteria for rows replicated to the subscription tables during a snapshot or a synchronization replication.

Note

See Table Settings and Restrictions for Table Filters for table setup requirements for a log-based replication system as well as general restrictions on the use of table filters.

A filter rule consists of a filter name and a SQL WHERE clause (omitting the WHERE keyword) called the filter clause, which you specify for a table or view that defines the selection criteria for rows that are to be included during a replication.

Multiple filter rules may be defined for each table or view in the publication. If no filter rule is defined for a given table or view, then no filtering can be later enabled on a corresponding subscription table associated with that publication table.

After filter rules have been defined for a publication table or view, you can later choose whether or not to enable those filter rules on any subscription that you associate with that publication in accordance with the following rules.

  • At most one filter rule can be enabled on a given table in a given subscription.
  • The same filter rule may be enabled on the same given table in several, different subscriptions.
  • Different filter rules may be enabled on the same given table but in different subscriptions.

If you want to define table filters on the publication tables or views, click the Table Filters tab. Select the table or view from the Table/View drop-down list for which you wish to add a filter rule. Click the Add Filter button.

In the Filter dialog box, enter a descriptive filter name and the filter clause to select the rows you want to replicate. The filter name and filter clause must meet the following conditions:

  • For any given table or view, each filter rule must be assigned a unique filter name.
  • For any given table or view, the filter clauses must have different syntaxes (that is, the filtering criteria must be different).

In the following example a filter rule is defined on the DEPT table so only rows where the deptno column contains 10, 20, or 30 are included in replications. All other rows are excluded from replication.

Adding a filter rule for the DEPT table

Figure 5-11: Adding a filter rule for the DEPT table

The following shows a rule added to the EMP table by choosing EDB.EMP from the Table/View drop-down list and then entering the selection criteria for only rows with deptno containing 10 in the Filter dialog box.

Adding a filter rule for the EMP table

Figure 5-12: Adding a filter rule for the EMP table

Repeating this process, additional filter rules can be added for the EMP table. The following shows the complete set of available filter rules defined for the DEPT and EMP tables.

Set of all available filter rules

Figure 5-13: Set of all available filter rules

To remove a filter rule, click the primary mouse button on the filter rule you wish to remove so the entry is highlighted and then click the Remove Filter button.

You may also modify the filter name or filter clause of a filter rule listed in the Table Filters tab by double-clicking on the cell of the filter name or filter clause you wish to change. When the cursor appears in the cell, enter the text for the desired change.

When creating a subscription, you may selectively enable these table filters on the corresponding subscription tables. See Adding a Subscription for information on creating a subscription.

Step 4: Click the Create button. If Publication Created Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.

Publication created successfully

Figure 5-14: Publication created successfully

Upon successful publication creation, a Publication node is added to the replication tree.

Replication tree after adding a publication

Figure 5-15: Replication tree after adding a publication