日本語版マニュアル
2.3.1.9 Master Node
2.3.2.4 Publication
2.3.2.7 Subscription
2.4.5.1 Single Host
4.1.1 Refresh
10.3.2.6 Oracle Errors
EDB Postgres™ Replication Server
with Multi-Master Support

User’s Guide
This document describes the installation, configuration, architecture, and operation of the EDB xDB Replication Server. EDB xDB (cross database) Replication Server (referred to hereafter as xDB Replication Server) is an asynchronous replication system available for PostgreSQL® and for EDB Postgres™ Advanced Server. The latter will be referred to simply as Advanced Server.
Note: Oracle Real Application Clusters (RAC) and Oracle Exadata are not supported by xDB Replication Server. These Oracle products have not been evaluated nor certified with xDB Replication Server. See Section 10.1 for the certified and supported database server products that may be used with xDB Replication Server.
Note: See Section 10.1.3 for detailed information on supported source and target database server configurations.
•
Partitioned tables created using the declarative partitioning feature of PostgreSQL and Advanced Server version 10 and later can now be replicated in a log-based single-master or multi-master replication system. For more information, see Section 7.10.
In the following descriptions a term refers to any word or group of words that are language keywords, user-supplied values, literals, etc. A term’s exact meaning depends upon the context in which it is used.
•
Italic font introduces a new term, typically, in the sentence that defines it for the first time.
•
Fixed-width (mono-spaced) font is used for terms that must be given literally such as SQL commands, specific table and column names used in the examples, programming language keywords, etc. For example, SELECT * FROM emp;
•
Italic fixed-width font is used for terms for which the user must substitute values in actual usage. For example, DELETE FROM table_name;
•
Square brackets [ ] denote that one or none of the enclosed terms may be substituted. For example, [ a | b ] means choose one of “a” or “b” or neither of the two.
•
Braces {} denote that exactly one of the enclosed alternatives must be specified. For example, { a | b } means exactly one of “a” or “b” must be specified.
•
Ellipses ... denote that the preceding term may be repeated. For example, [ a | b ] ... means that you may have the sequence, “b a a b a”.
•
Much of the information in this document applies interchangeably to the PostgreSQL and EDB Postgres Advanced Server database systems. The term Advanced Server is used to refer to EDB Postgres Advanced Server. The term Postgres is used to generically refer to both PostgreSQL and Advanced Server. When a distinction needs to be made between these two database systems, the specific names, PostgreSQL or Advanced Server are used.
•
The installation directory path of the PostgreSQL or Advanced Server products is referred to as POSTGRES_INSTALL_HOME. For PostgreSQL Linux installations, this defaults to /opt/PostgreSQL/x.x for version 10 and earlier. For later versions, use the PostgreSQL community packages. For PostgreSQL Windows installations, this defaults to C:\Program Files\PostgreSQL\x.x. For Advanced Server Linux installations accomplished using the interactive installer for version 10 and earlier, this defaults to /opt/PostgresPlus/x.xAS or /opt/edb/asx.x. For Advanced Server Linux installations accomplished using an RPM package, this defaults to /usr/ppas-x.x or /usr/edb/asx.x. For Advanced Server Windows installations, this defaults to C:\Program Files\PostgresPlus\x.xAS or C:\Program Files\edb\asx.x. The product version number is represented by x.x or by xx for version 10 and later.
xDB Replication Server is a software product that enables the implementation of a replication system. A replication system is software and hardware whose purpose is to make a copy of data from one location to another and to ensure the copied data is the same as the original over time.
•
Single-Master Replication (SMR). Changes (inserts, updates, and deletions) to table rows are allowed to occur in a designated master database. These changes are replicated to tables in one or more slave databases. The replicated tables in the slave databases are not permitted to accept any changes except from its designated master database. (This is also known as master-to-slave replication.)
•
Multi-Master Replication (MMR). Two or more databases are designated in which tables with the same table definitions and initial row sets are created. Changes (inserts, updates, and deletions) to table rows are allowed to occur in any database. Changes to table rows in any given database are replicated to their counterpart tables in every other database.
•
Replication from Oracle to PostgreSQL
•
Replication in either direction between Oracle and Advanced Server
•
Replication in either direction between SQL Server and PostgreSQL
•
Replication in either direction between SQL Server and Advanced Server
Note: A given database cannot simultaneously participate in both a single-master replication system and a multi-master replication system.
xDB Replication Server uses an architecture called publish and subscribe. The data to be made available for copying by a replication system is defined as a publication. To get a copy of that data, you must “subscribe” to that publication. The manner in which you subscribe is slightly different for single-master and multi-master replication systems.
In xDB Replication Server a publication is defined as a named set of tables and views within a database. The database that contains the publication is called the publication database of that publication.
In a single-master replication system, to get a copy of an xDB Replication Server publication, you must create a subscription. An xDB Replication Server subscription is a named association of a publication to a database to which the publication is to be copied. This database is called the subscription database.
In a single-master replication system, replication is said to occur when xDB Replication Server initiates and completes either of the following processes: 1) applies changes that have been made to rows in the publication since the last replication occurred, to rows in tables of the subscription database (called synchronization); or 2) copies rows of the publication to empty tables of the subscription database (called a snapshot). See Section 2.2.6 for further discussion on snapshots and synchronization.
The subscription tables are the tables in the subscription database created from corresponding tables or views in the publication.
Note: In a single-master replication system xDB Replication Server creates a table in the subscription database for each view contained in the publication.
In a multi-master replication system, the concept and definition of replication is nearly identical to a single-master replication system with the following modifications: 1) synchronization can occur between any pair of databases (referred to as master nodes) participating in the replication system; and 2) a snapshot can occur from the publication database designated as the master definition node to any of the other master nodes.
pp_xdb_repsvr_ug_overview_1
pp_xdb_repsvr_ug_overview_2
pp_xdb_repsvr_ug_overview_3
pp_xdb_repsvr_ug_overview_4
pp_xdb_repsvr_ug_overview_4_mmr
xDB Replication Server performs master-to-slave replication when a single-master replication system is implemented. The publication is the master and the subscription is the slave. In a master-to-slave relationship, changes are propagated in one direction only, from the master to the slave.
pp_xdb_repsvr_ug_overview_5
Generally, changes must not be made to the definitions of the publication tables or the subscription tables. If such changes are made to the publication tables, they are not propagated to the subscription and vice versa unless the DDL change replication feature is used as described in Section 7.8. If changes are made to the table definitions without using the DDL change replication feature, there is a risk that future replication attempts may fail.
Changes must not be made to the rows of the subscription tables. If such changes are made, they are not propagated back to the publication. If changes are made to the subscription table rows, it is fairly likely that the rows will no longer match their publication counterparts. There is also a risk that future replication attempts may fail.
A master node is a database participating in a multi-master replication system.
The database (master node) in which the publication is initially defined is specially designated as the master definition node (MDN). There can be only one master definition node at any given time, however, it is possible to change which master node is the master definition node. When it is important to make a distinction between the master definition node and all other master nodes that are not the master definition node, the latter are referred to as non-MDN nodes.
Generally, changes must not be made to the table definitions in any of the master nodes including the master definition node. If such changes are made, they are not propagated to other nodes in the multi-master replication system unless they are made using the DDL change replication feature described in Section 7.8. If changes are made to tables without using the DDL change replication feature, there is a risk that future replication attempts may fail.
pp_xdb_repsvr_ug_overview_5_mmr
xDB Replication Server performs replications asynchronously. The systems hosting the databases do not always have to be running continuously in order for successful replication to occur. If one system goes offline, replication resumes when it comes back online if there is still pending data to replicate.
In either method, the source tables refer to the tables from which the replication data is originating (the publication in a single-master replication system, or the master node whose changes are being replicated to another master node in a multi-master replication system).
The target tables are the tables that are receiving the replication data from the source tables (the subscription tables in a single-master replication system, or the master node receiving changes from another master node in a multi-master replication system).
In snapshot replication, all existing rows in the target tables are deleted using the database system’s TRUNCATE command. The tables are then completely reloaded from the source tables of the publication.
In synchronization replication, only the changes (inserts, updates, and deletions) to the rows in the source tables since the last replication are applied to the target tables.
Note: Deletion of all rows in a source table executed by the SQL TRUNCATE command results in replication to the target tables only if the log-based method of synchronization replication is used. If the trigger-based method of synchronization replication is used, execution of the TRUNCATE command on a source table does not replicate the effect to the target tables. You must perform a snapshot from the source table to the target tables if the trigger-based method is used. (The difference between the trigger-based method and the log-based method is discussed as follows.)
In the trigger-based method changes to rows in the source tables result in the firing of row-based triggers. These triggers record the changes in shadow tables. The changes recorded in the shadow tables are then periodically extracted from the shadow tables, converted to an in-memory data structure, and applied to the target tables by means of SQL statements executed using JDBC. See Section 2.2.9 for information on the trigger-based method.
In the log-based method changes to rows in the source tables are extracted from the Write-Ahead Log segments (WAL files) using asynchronous streaming replication implemented by the logical decoding feature available in Postgres database servers. The extracted changes are converted to an in-memory data structure and applied to the target tables by means of SQL statements executed using JDBC. See Section 2.2.10 for information on the log-based method.
When a publication is created in a single-master replication system, the publication can be defined as a snapshot-only publication. Replication from a snapshot-only publication can only be done using the snapshot replication method. Synchronization replication is not permitted on a snapshot-only publication.
See Section 2.4.4 for a discussion of the advantages of using a snapshot-only publication.
For Oracle and SQL Server only: Oracle and SQL Server target tables are loaded using JDBC batches of INSERT statements.
For Postgres only: In general, Postgres target tables are loaded using the JDBC COPY command since using truncation and COPY is generally faster than if you were to execute an SQL DELETE statement against the entire table and then add the rows using JDBC batches of INSERT statements. If the COPY command fails, the publication server retries the snapshot using JDBC batches of INSERT statements.
If the target table (regardless of database type) contains a large object data type such as BYTEA, BLOB, or CLOB then rows are loaded one at a time per batch using an INSERT statement. This is to avoid a heap space error resulting from potentially large rows. Loading time can be decreased by allowing multiple inserts per batch, which is done by adjusting the configuration option lobBatchSize described in Section 5.8.1.
Note: Advanced Server supports a number of aliases for data types. Such aliases that translate to BYTEA are treated as large object data types. See the Database Compatibility for Oracle Developers Reference Guide for a listing of Advanced Server data types. (See the Database Compatibility for Oracle Developer’s Guide for Advanced Server version 9.5 or earlier versions.)
Under certain circumstances, the corresponding Postgres target table created for certain types of Oracle partitioned tables is a set of inherited tables. In these cases, the SQL DELETE statement is used on the inherited child tables instead of truncation. See Section 10.4.1.4 for additional information on replicating Oracle partitioned tables.
A server configuration option is available that forces the snapshot replication process to use the Oracle database link utility instead of JDBC COPY to populate the Postgres target tables from an Oracle publication. Oracle database link provides an additional performance improvement over JDBC COPY. See Section 5.8.1 for information on using the Oracle database link option.
See Section 5.8.1 for information on various configuration options to optimize snapshot replication.
The publication server also creates a shadow table for each source table on which triggers have been created. A shadow table is a table used by xDB Replication Server to record the changes (inserts, updates, and deletions) made to a given source table. A shadow table records three types of record images: For each row inserted into the source table, the shadow table records the image of the inserted row. For each existing row that is updated in the source table, the shadow table records the after image of the updated row. For each row deleted from the source table, the shadow table records the primary key value of the deleted row.
Note: In a multi-master replication system, the before image of an updated row is also stored in the shadow table in order to perform update conflict detection. See Section 6.6 for information on conflict detection in a multi-master replication system.
Though changes made to the source tables since the last replication occurred are applied to the target tables using SQL INSERT, UPDATE, and DELETE statements, the actual SQL statements run against the target tables are not the same SQL statements that were run against the source tables.
When synchronization replication occurs, the publication server executes JDBC batches of SQL statements (also referred to as transaction sets) against the target tables. The batches contain an INSERT statement for each shadow table row recording an insert operation, an UPDATE statement for each shadow table row recording an update operation, and a DELETE statement for each shadow table row recording a delete operation. Each batch is executed in one transaction.
Note: A single SQL statement executed against a source table may result in many rows recorded in a shadow table, and therefore, many SQL statements executed against the target table. For example, if a single UPDATE statement affects 10 rows in the source table, 10 rows will be inserted into the shadow table – one for each row in the source table that was updated. When the publication server applies the changes to the target table, 10 UPDATE statements will be executed.
Note: For greater efficiency, when changes to the source tables consist of SQL statements that each affect a large number of rows, the publication server may employ the use of prepared SQL statements. See Section 5.8.2 for directions on how to control the usage of prepared SQL statements as well as information on various other configuration options to optimize synchronization replication.
In PostgreSQL 9.4 a feature has been introduced called logical decoding (also called logical replication or changeset extraction). This feature provides the capability to extract data manipulation language (DML) changes from the Write-Ahead Log segments (WAL files) in a readable format.
For information on logical decoding see the PostgreSQL Core Documentation located at:
•
In a single-master replication system, whether the master database uses the trigger-based method or the log-based method has no additional impact on the rules for choosing the subscription database as described in Section 10.1. For example, even if the log-based method is chosen for the master database, the subscription database may be running on Postgres version 9.4 as well as any supported, earlier version of Postgres, as well as Oracle or SQL Server as described in Section 10.1.
•
wal_level. Set to logical.
•
max_wal_senders. Specifies the maximum number of concurrent connections (that is, the maximum number of simultaneously running WAL sender processes). Set at minimum, to the total number of master databases of single-master replication systems and master nodes of multi-master replication systems on this database server that will use the log-based method.
•
max_replication_slots. Specifies the maximum number of replication slots. If the database server supports both single-master replication systems and multi-master replication systems, then max_replication_slots must be set at minimum to the sum of the requirements for both replication systems. For support of SMR systems, the minimum requirement is the total number of master databases of the single-master replication systems that will use the log-based method. For support of MMR systems, the minimum requirement is the total number of master nodes in the multi-master replication system multiplied by the number of master nodes residing on this database server. For information, see Section 2.2.10.4.
•
track_commit_timestamp. Set to on. This configuration parameter applies only to Postgres database servers of version 9.5. See Section 6.6.1 for additional information.
Also see Section 5.1.2 for setting these parameters for a single-master replication system. See Section 6.1.2 for a multi-master replication system.
In addition, the pg_hba.conf configuration file of the Postgres database server must contain an entry permitting REPLICATION access for each database using the log-based method running on the database server. The access must be permitted to the publication database user specified when creating the publication database definition using the xDB Replication Console (see Section 5.2.2 for a single-master replication system or Section 6.2.2 for a multi-master replication system) or the xDB Replication Server Command Line Interface (CLI) (see Section 8.3.6).
See Section 5.1.6.3 for setting REPLICATION access for a single-master replication system. See Section 6.1.5 for a multi-master replication system.
A logical replication slot represents a changeset stream and applies to a single database. The xDB Replication Server assigns a unique identifier, called the slot name, to each logical replication slot it creates in the form xdb_dboid_pubid where dboid is the publication database object identifier (OID) and pubid is the publication ID assigned by the xDB Replication Server. All slot names are unique within a Postgres database cluster.
The maximum number of replication slots permitted for a database server is controlled by the max_replication_slots configuration parameter in the postgresql.conf file. Therefore this configuration parameter must be set to a large enough value to account for all publication databases defined with the log-based method of single-master replication systems running on the database server as well as all master nodes of a multi-master replication system defined with the log-based method running on the database server. Additional replication slots are required to support the usage of replication origin (see Section 2.2.10.4).See Section 5.1.2 for additional information on configuration parameters for single-master replication systems. See Section 6.1.2 for multi-master replication systems.
The changeset stream is accessible to the xDB publication server by the WAL sender process (walsender) using the streaming replication protocol.
The xDB publication server connects using the walsender interface through which changes are streamed on a continual basis. The continuous streaming eliminates the need for explicitly polling for changes.
1.
A streaming replication connection to the database server is opened using libpq to establish a walsender communication channel.
4.
On the next scheduled interval, the in-memory cached data changes are applied to each of the target databases in JDBC batches of SQL statements (referred to as transaction sets) in the same manner as described in Section 2.2.9 for the trigger-based method. If one or more target database servers are not accessible, the data changes are saved in a local file on the host running the publication server. Section 2.2.10.5 for information on in-memory caching and data persistence.
Note: A single SQL statement executed against a source table may result in many rows modified and returned in the changeset stream, and therefore, many SQL statements executed against the target table. For example, if a single UPDATE statement affects 10 rows in the source table, 10 rows will be returned in the changeset stream – one for each row in the source table that was updated. When the publication server applies the changes to the target table, 10 UPDATE statements will be executed.
Starting with Postgres version 9.5, a feature called replication origin has been introduced to the logical decoding framework. Replication origin allows an application to identify, label, and mark certain aspects of a logical decoding session.
For information on replication origin see the PostgreSQL Core Documentation located at:
As previously described, the log-based method uses the WAL files to obtain the changes applied to the publication tables. After the changes are retrieved through the walsender interface, the publication server applies the set of changes to the other master nodes using transaction sets consisting of JDBC batches of SQL statements. When these changes are applied to the tables in the other target master nodes, the same changes are also recorded in the WAL files of each database server hosting the target master nodes.
•
The max_replication_slots configuration parameter must be set at a certain minimal level to ensure that the publication server can create the additional replication slots for replication origin.
The following table shows the required, minimum settings for max_replication_slots as well as max_wal_senders.
If the max_replication_slots parameter is not set to a high enough value, synchronization replication still succeeds, but without the replication origin performance advantage.
The replication origin name is assigned in the format xdb_srcdbname_pubname_remotedbid where srcdbname is the source database name, pubname is the publication name, and remotedbid is the publication database ID of a remote database.
The xDB Replication Server architecture utilizes Java object serialization to persist the in-memory state of the data. Object serialization is the conversion of object data and other relevant information to a sequence of bytes that can then be stored in a file.
The cache size corresponds to the heap size configured for the publication server by the -Xmxnnnm setting of the JAVA_HEAP_SIZE parameter in the xDB Startup Configuration file. See Section 2.3.1.4 for information on the xDB Startup Configuration file.
The time to complete the entire replication event, referred to as the latency time, is basically the sum of the replication times where each master node acts as the source (that is, the sum of the times for steps 1, 2, and 3).
For the log-based method, this latency time has been reduced by the implementation of parallel replication whereby each replication set from a given master node acting as the source, executes and runs simultaneously with all other replication sets where the other master nodes act as the source.
Note that parallel replication applies only to the log-based method and not for the trigger-based method.
Note: In addition to parallel replication, optimization of replicating from a given master node to all other master nodes (that is, within the context of a single replication set) has been implemented with the use of multiple threads. This is referred to as parallel synchronization. Parallel synchronization applies to both the trigger-based and log-based methods. See Section 5.8.2.2 for information on parallel synchronization.
Table filters specify the selection criteria for rows in publication tables or views that are to be included during replications to subscriptions from the publication database in a single-master replication system or between master nodes in a multi-master replication system. Rows that do not satisfy the selection criteria are excluded from replications to subscriptions or master nodes on which these table filters have been enabled.
Note (For MMR only): When using table filters in a multi-master replication system, the master definition node, which provides the source of the table content for a snapshot, should contain a superset of all the data contained in the other master nodes of the multi-master replication system. This ensures that the target of a snapshot receives all of the data that satisfies any filtering criteria enabled on the other master nodes.
Note: In the following discussion, a result set refers to the set of rows in a table satisfying the selection criteria of an UPDATE or DELETE statement executed on that table.
When an INSERT statement is executed on a source table followed by a synchronization replication, the row is inserted into the target table of the synchronization if the row satisfies the filtering criteria. Otherwise the row is excluded from insertion into the target table.
When an UPDATE statement is executed on a source table followed by a synchronization replication, the UPDATE result set of the source table determines the action on the target table of the synchronization as follows.
When a DELETE statement is executed on a source table followed by a synchronization replication, the DELETE result set of the source table determines the action on the target table of the synchronization as follows.
Thus, regardless of whether the transaction on the source table is an INSERT, UPDATE, or DELETE statement, the goal of a table filter is to ensure that all rows in the target table satisfy the filter rule.
Note: This REPLICA IDENTITY FULL setting is not required for tables in single-master, snapshot-only publications, See Section 2.2.7 for information on snapshot-only publications.
This setting is done with the ALTER TABLE command as shown by the following:
ALTER TABLE schema.table_name REPLICA IDENTITY FULL
For additional information see the ALTER TABLE SQL command in the PostgreSQL Core Documentation located at:
For example, for a publication table named edb.dept, use the following ALTER TABLE command:
The REPLICA IDENTITY setting can be displayed by the PSQL utility using the \d+ command:
The REPLICA IDENTITY FULL setting is required on tables in the following databases of a log-based replication system:
•
In a single-master replication system, table filters are defined in the master database. Thus, the publication tables in the master database requiring filter definitions must be altered to a REPLICA IDENTITY FULL setting, but only if the publication is not a snapshot-only publication. See Section 2.2.7 for information on snapshot-only publications.
•
In a multi-master replication system, non-MDN nodes should not have their tables’ REPLICA IDENTITY option set to FULL unless transactions are expected to be targeted on those non-MDN nodes, and the transactions are to be filtered when they are replicated to the other master nodes.
The REPLICA IDENTITY FULL setting on a source table ensures that certain types of transactions on the source table result in the proper updates to the target tables on which filters have been enabled.
Note: In addition to table filtering requirements, the REPLICA IDENTITY FULL setting may be required on publication tables for other reasons in xDB Replication Server. See Section 6.6.1 for additional requirements.
Table filters are not supported on binary data type columns. A binary data type is the Postgres data type BYTEA. In addition, table filters are not supported on Advanced Server columns with data types BINARY, VARBINARY, BLOB, LONG RAW, and RAW as these are alias names for the BYTEA data type.
•
Section 5.2.3 for information on defining the initial set of table filters that are to be available for selective enablement on subscriptions
•
Section 5.3.3 for information on enabling available table filters on a newly created subscription
•
Section 7.6.4 for information on adding, removing, or modifying rules comprising the set of available table filters
•
Section 5.5.4 for information on changing which table filters have been enabled on an existing subscription
•
Section 6.2.3 for information on defining the initial set of table filters that are to be available for selective enablement on master nodes
•
Section 6.3 for information on enabling available table filters on a newly created master node
•
Section 7.6.4 for information on adding, removing, or modifying rules comprising the set of available table filters
•
Section 6.9 for information on changing which table filters have been enabled on an existing master node
This section describes the components and architecture of xDB Replication Server. Section 2.3.1 describes the executable programs, files, and databases that comprise xDB Replication Server. Section 2.3.2 defines the logical components of a replication system and how they correspond to the programs and databases. Section 2.3.3 illustrates some examples of replication systems.
•
Publication server. The program that configures the publication database and master nodes for replication and performs replication.
•
Subscription server. The program that configures the subscription database for replication and initiates replication. The subscription server is used only in single-master replication systems.
•
xDB Replication Configuration file. Text file containing connection and authentication information used by the publication server and subscription server upon startup to connect to a publication database designated as the controller database. Also used to authenticate registration of the publication server and subscription server from the user interface when creating a replication system.
•
xDB Startup Configuration file. Text file containing installation and configuration information used for the Java Runtime Environment when the publication server and subscription server are started.
Note: See Section 2.3.1.11 for information on the control schema.
Note: The subscription server is required only for single-master replication systems. The subscription server does not need to be running, nor even installed if only multi-master replication systems are in use.
•
Parameters admin_user and admin_password are determined during the xDB Replication Server installation process. See Chapter 3 for how the content of these parameters are determined.
•
Parameters database, user, password, port, host, and type are set with the connection and authentication information of the first publication database definition you create with the xDB Replication Console or xDB Replication Server CLI. This database is designated as the controller database. See Section 2.3.1.12 for information on the controller database. See Section 5.2.2 for creating a publication database definition for a single-master replication system. See Section 6.2.2 for creating the publication database definition for a multi-master replication system.
Note: The passwords for the admin user name and the controller database user name are encrypted. Should you change either of these passwords, you must modify the corresponding password parameters in the xDB Replication Configuration file to contain the encrypted form of the new password. See Section 10.4.2 for directions on how to generate the encrypted form of a password.
See Section 3.5 for the file system location of the xDB Replication Configuration file.
In -Xmsnnnm nnn specifies the minimum Java heap size in megabytes. In -Xmxnnnm nnn specifies the maximum Java heap size in megabytes
The JAVA_EXECUTABLE_PATH parameter specifies the location of the Java runtime program as identified by the xDB Replication Server installer during the installation process. The setting of this parameter may be subsequently changed to a different JRE installation if so desired.
The JAVA_MINIMUM_VERSION parameter specifies the earliest version of the Java Runtime Environment that can be used with xDB Replication Server. This setting must not be changed.
The JAVA_BITNESS_REQUIRED parameter must not be altered. If the installed value is modified, or if it does not match the bitness of the Java virtual machine as identified by JAVA_EXECUTABLE_PATH, a number of errors may occur, which include failure of the publication and subscription servers to start and registration failure of the xDB Replication Server product.
See Section 5.1.1 for information on setting the JAVA_HEAP_SIZE parameter.
See Section 5.1.6.1 for information on the PUBPORT and SUBPORT parameters.
See Section 3.5 for the file system location of the xDB Startup Configuration file.
See Chapter 4 for information on the user interface of the xDB Replication Console.
Chapter 8 provides directions for using xDB Replication Server CLI.
Note: The subscription database applies only to single-master replication systems.
2.3.1.9 Master Node
The control schema is a conceptual term referring to the collection of metadata database objects that define the logical and physical structure of, and enable the operation and maintenance of xDB Replication Server single-master and multi-master replication systems.
These metadata database objects, referred to as control schema objects consist of tables, sequences, functions, procedures, triggers, packages, etc.
Note: For log-based single-master and multi-master replication systems, changes are extracted from the database server WAL files instead of being stored in control schema objects. See Section 2.2.10 for information on the log-based method.
•
The slave (subscription) database of single-master replication systems contains one, single table as its metadata database object. The term, subscription metadata object, is specifically used to refer to this database object in the subscription database. The general terms, control schema and control schema objects refer to the database objects in the publication databases.
Note: If the controller database is an Oracle or a SQL Server publication database, then a second Oracle or SQL Server publication database cannot be added to create a second single-master replication system. In order for xDB Replication Server to run more than one single-master replication systems consisting of Oracle or SQL Server publication databases, a Postgres publication database must be designated as the controller database.
Each of these steps creates a logical component that is represented by a node in the replication tree of the xDB Replication Console. See Chapter 4 for a description of the xDB Replication Console. A brief description of these components is given in the following sections.
Section 5.2.1 gives directions for registering a publication server for a single-master replication system. See Section 6.2.1 for a multi-master replication system.
Subordinate to a registered publication server, two nodes representing the replication system type appear. One is identified by the label SMR for single-master replication and the other has the label MMR for multi-master replication.
Note: Currently, there can only be one multi-master replication system per publication server.
Section 5.2.2 discusses creating a publication database definition for a single-master replication system. See sections 6.2.2 and 6.3 for a multi-master replication system.
2.3.2.4 Publication
Section 5.2.3 discusses creating a publication for a single-master replication system. See Section 6.2.3 for a multi-master replication system.
Note: The subscription server applies only to single-master replication systems. You do not register a subscription server when creating a multi-master replication system.
Section 5.3.1 gives directions for registering a subscription server.
Note: The subscription database definition applies only to single-master replication systems. You do not create a subscription database definition when creating a multi-master replication system.
Section 5.3.2 discusses creating a subscription database definition.
2.3.2.7 Subscription
Note: The subscription applies only to single-master replication systems. You do not create a subscription when creating a multi-master replication system.
Section 5.3.3 discusses creating a subscription.
•
A publication database definition is created subordinate to the SMR type node under the publication server. The Oracle database user name pubuser is specified in the definition along with the database network location and database identifier. When you create a user named pubuser in Oracle, a schema named pubuser is automatically created by Oracle at the same time. The publication server creates the control schema objects in the pubuser control schema for the replication system’s metadata when you create the publication database definition.
•
A publication named pub is created subordinate to the publication database definition. The publication consists of table A in schema S1 and tables B and C in schema S2.
•
A subscription database definition is created subordinate to the subscription server. The Postgres database user name subuser is specified in the definition along with the database network location and database identifier.
•
A subscription named sub is created subordinate to the subscription database definition. When the subscription is created, the subscription server creates schemas named S1 and S2 in the subscription database. The table definitions for tables A, B, and C are also created at this time. When replication occurs, the publication server populates these tables with rows from the publication.
See Chapter 4 for an introduction to the xDB Replication Console.
•
A publication database definition is created subordinate to the SMR type node under the publication server. The SQL Server login pubuser is specified in the definition along with the database network location and database identifier. The schema pubuser was created during the publication database preparation step as described in Section 5.1.4.2. The pubuser schema along with the control schema consisting of three physical schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler are populated with the control schema objects for the replication system’s metadata when you create the publication database definition.
•
A publication named pub is created subordinate to the publication database definition. The publication consists of table A in schema S1 and tables B and C in schema S2.
•
A subscription database definition is created subordinate to the subscription server. The Postgres database user name subuser is specified in the definition along with the database network location and database identifier.
•
A subscription named sub is created subordinate to the subscription database definition. When the subscription is created, the subscription server creates schemas named S1 and S2 in the subscription database. The table definitions for tables A, B, and C are also created at this time. When replication occurs, the publication server populates these tables with rows from the publication.
See Chapter 4 for an introduction to the xDB Replication Console.
•
A publication database definition is created subordinate to the SMR type node under the publication server. The Postgres database user name pubuser is specified in the definition along with the database network location and database identifier. The publication server creates the control schema consisting of three physical schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler and populates them with the control schema objects for the replication system’s metadata when you create the publication database definition.
•
A publication named pub is created subordinate to the publication database definition. The publication consists of table A in schema S1 and tables B and C in schema S2.
•
A subscription database definition is created subordinate to the subscription server. The Oracle database user name subuser is specified in the definition along with the database network location and database identifier.
•
A subscription named sub is created subordinate to the subscription database definition. When you create a user named subuser in Oracle, a schema named subuser is automatically created by Oracle at the same time. The table definitions for tables A, B, and C are created in schema subuser when you create subscription sub. When replication occurs, the publication server populates these tables with rows from the publication.
See Chapter 4 for an introduction to the xDB Replication Console.
•
A publication database definition is created subordinate to the SMR type node under the publication server. The Postgres database user name pubuser is specified in the definition along with the database network location and database identifier. The publication server creates the control schema consisting of three physical schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler and populates them with the control schema objects for the replication system’s metadata when you create the publication database definition.
•
A publication named pub is created subordinate to the publication database definition. The publication consists of table A in schema S1 and tables B and C in schema S2.
•
A subscription database definition is created subordinate to the subscription server. The SQL Server login subuser is specified in the definition along with the database network location and database identifier.
•
A subscription named sub is created subordinate to the subscription database definition. When the subscription is created, the subscription server creates schemas named S1 and S2 in the subscription database. The table definitions for tables A, B, and C are also created at this time. When replication occurs, the publication server populates these tables with rows from the publication.
See Chapter 4 for an introduction to the xDB Replication Console.
•
A publication database definition is created subordinate to the MMR type node under the publication server. This first publication database definition identifies the master definition node. The Postgres database user name mmruser_a is specified in the definition along with the database network location and database identifier. The publication server creates the control schema consisting of three physical schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler and populates them with the control schema objects for the replication system’s metadata when you create the publication database definition.
•
A publication named pub is created subordinate to the publication database definition. The publication consists of table A in schema S1 and tables B and C in schema S2.
•
When you add the second master node, you can choose to have the publication server create schemas S1 and S2 and the table definitions for A, B, and C for you, or you could have manually created the schemas and table definitions beforehand. The publication server creates the control schema consisting of three physical schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler under which it creates the control schema objects to store the master node’s metadata. When defining the master node, you can choose to have the publication server populate these tables with rows from the publication at this time, or you can defer table loading to a later point in time.
See Chapter 4 for an introduction to the xDB Replication Console.
Step 1: Determine if xDB Replication Server is the right solution for your requirements and you have chosen the best solution for your particular needs. xDB Replication Server can be used to implement single-master or multi-master replication systems. For single-master replication systems, the distinguishing characteristic of xDB Replication Server is its ability to replicate from an Oracle database to a PostgreSQL or Advanced Server database, from a SQL Server database to a PostgreSQL or Advanced Server database, from an Advanced Server database to an Oracle database, or from a PostgreSQL or Advanced Server database to a SQL Server database.
Step 2: Plan the general strategy of how you will use xDB Replication Server. Will the single-master or multi-master model best suit your needs? (See Section 2.1 for use case examples of single-master and multi-master replication systems.) Will you be replicating from Oracle to Postgres, from SQL Server to Postgres, from Advanced Server to Oracle, or from Postgres to SQL Server? Will you be replicating between PostgreSQL and/or Advanced Server databases? How often will you need to replicate the data? Will replication be done on an ad hoc basis or does it need to occur regularly according to a schedule?
Step 3: Plan the logistics of your replication system. How many tables do you expect to replicate and what are their sizes in total number of bytes and number of rows? What percentage of rows do you expect to have been changed on each table between each replication? Are your database servers required to run on dedicated machines?
Step 4: Design your replication system. Determine whether your replication system will be distributed or will run on a single host. Determine the publications and subscriptions you will need and their tables and views. Make sure your publication tables meet the requirements for an xDB Replication Server publication. See sections 2.4.2 and 2.4.3 for details.
Step 5: Implement and test your replication system in a test environment. Try out your replication system on a subset of your publication data to ensure the replication process works as expected. Make sure the resulting replicated tables can be used as expected in your application. Establish preliminary metrics on how long the replication process will be expected to take in your full production environment.
Step 6: Implement and test your replication system in your production environment.
•
Make sure table definitions are well established before creating publications. Unless the DDL change replication feature is used as described in Section 7.8, if a table definition is changed, any publication containing the table along with its associated subscription must be deleted and recreated, otherwise replication may fail. The same applies for the table definitions in a master definition node and its associated master nodes. Replication failures can be seen in the replication history.
•
•
Note: Foreign key constraints are not replicated by the publication or subscription server in a single-master replication system. However, in a multi-master replication system, foreign key constraints are replicated from the master definition node to other master nodes.
Note: Sequences (database objects created by the CREATE SEQUENCE statement) are not replicated from the publication database to the subscription databases in a single-master replication system. Sequences are also not replicated from the master definition node to other master nodes in a multi-master replication system.
•
•
•
•
•
•
•
•
•
•
•
Note: See Section 10.4.6 for a method to replicate tables containing the SQL_VARIANT data type under certain conditions.
•
•
•
•
•
•
•
•
•
Postgres tables that include any geometric data types such as POINT, POLYGON, etc., cannot be replicated to an Oracle subscription database.
•
•
•
•
•
•
•
•
•
Any ARRAY data type (that is, defined as data_type[])
Postgres data types called range types were first supported in PostgreSQL version 9.2 and Advanced Server version 9.2. Built-in range types refer to the following built-in data types: int4range, int8range, numrange, tsrange, tstzrange, and daterange.
Custom range types constructed with the CREATE TYPE AS RANGE command are not supported in xDB Replication Server.
Note: In a multi-master replication system, on demand snapshots can only be made from the master definition node to another master node.
See Section 5.4 for directions on performing an on demand replication for a single-master replication system. See Section 6.5 for a multi-master replication system.
2.4.5.1 Single Host
•
For PostgreSQL. Install xDB Replication Server using Stack Builder after you have installed PostgreSQL.
•
For Advanced Server. Install xDB Replication Server using StackBuilder Plus after you have installed Advanced Server.
Section 3.1 describes the installation of xDB Replication Server through the graphical user interface of Stack Builder or StackBuilder Plus.
Note: If you have an older version of xDB Replication Server and existing replication systems, review Section 10.2 before installing xDB Replication Server.
If you later decide you wish to remove xDB Replication Server from your system see Section 3.6 for directions on uninstalling xDB Replication Server if you initially installed it with the graphical user interface or by invoking the installer program from the command line. See Section 3.7 for directions on uninstalling xDB Replication Server that was installed from the RPM package.
Stack Builder and StackBuilder Plus are programs used to download and install add-on products and updates to PostgreSQL and Advanced Server. Stack Builder is used for PostgreSQL. StackBuilder Plus is used for Advanced Server.
Step 1: You must have Java Runtime Environment (JRE) version 1.7 or later installed on the hosts where you intend to install any xDB Replication Server component (xDB Replication Console, publication server, or subscription server). Any Java product such as Oracle Java or OpenJDK may be used.
For Windows only: Be sure the system environment variable, JAVA_HOME, is set to the JRE installation directory of the JRE version and bitness (32-bit or 64-bit) you wish to use with the xDB Replication Server. The xDB Replication Server installer for a Windows platform contains both the 32-bit and 64-bit versions. The JAVA_HOME setting determines whether the 32-bit or the 64-bit version of xDB Replication Server is installed. (If JAVA_HOME is not set, then the first JRE version encountered in the Path system environment variable determines the xDB Replication Server version to be installed.)
Note: For Advanced Server versions prior to 9.3, a Java runtime is supplied and installed as part of the Advanced Server installation process, however, you must still have pre-installed a separate Java runtime system on your host. The xDB Replication Server installation process does not utilize the Java runtime supplied with Advanced Server.
Note: After installation of xDB Replication Server has completed, the path to your Java runtime program is stored in the xDB Startup Configuration file used by xDB Replication Server. Verify that the path to your Java runtime program set in the xDB Startup Configuration file is correct. See Section 3.5 for the location of this file.
Step 2: From the host’s application menu, open the Postgres menu and choose Stack Builder or StackBuilder Plus.
Step 3 (For Linux only): Depending upon your Linux host, a dialog box or a prompt appears requesting the root account’s password. Enter the root password and click the OK button.
Step 4: The StackBuilder Plus welcome screen appears. Select your Postgres installation from the drop-down list and click the Next button.
Step 5 (For Advanced Server): Expand the EnterpriseDB Tools node and check the box for Replication Server. Click the Next button.
Note: Though the following images show Replication Server v6.0, use the same process for Replication Server v6.2.
Step 5 (For PostgreSQL): Expand the Registration-Required and Trial Products node, and then expand the EnterpriseDB Tools node. Check the box for Replication Server under the EnterpriseDB Tools list and click the Next button.
Step 6 (For Advanced Server only): In the Account Registration screen, either enter your email address and password for your EnterpriseDB user account if you have one, or click the link in which case you will be directed to the registration page of the EnterpriseDB website where you can create an account. Click the Next button.
Note (For PostgreSQL only): Proceed to Step 7. If you are using PostgreSQL, account registration occurs later in the process.
Step 7: Verify that Replication Server appears in the list of selected packages. Click the Next button.
Step 8: When downloading of the Replication Server package completes, the following screen appears that starts the installation of xDB Replication Server. Click the Next button.
Note: You can check the Skip Installation box if you wish to install xDB Replication Server some other time.
Step 9: Select the installation language and click the OK button.
Step 10: In the Setup xDB Replication Server screen, click the Next button.
Step 11: Read the license agreement. If you accept the agreement, select the accept radio button and click the Next button.
Step 12: Browse to a directory where you want the xDB Replication Server components installed, or allow it to install the components in the default location shown. Click the Next button.
Step 13: If you do not want a particular xDB Replication Server component installed on this particular host, uncheck the box next to the component name. Click the Next button.
Step 14: In the Account Registration screen select the radio button that applies to you. Click the Next button.
Step 15: Enter information for the xDB administrator.
•
Admin User. The xDB administrator user name to authenticate certain usage of the xDB Replication Server such as registering a publication server or a subscription server running on this host. Any alphanumeric string may be entered for the admin user name. The default admin user name is admin.
•
Admin Password. Password of your choice for the xDB administrator given in the Admin User field.
The admin user and the admin password (in encrypted form) are saved to the xDB Replication Configuration file named /etc/edb-repl.conf (XDB_HOME\etc\edb-repl.conf on Windows hosts). Click the Next button.
Step 16 (Only if publication server is a selected component): Enter an available port on which the publication server will run. Default port number is 9051. Click the Next button.
Step 17 (Only if subscription server is a selected component): Enter an available port on which the subscription server will run. Default port number is 9052. Click the Next button.
Step 18: For the operating system account under which the publication server or subscription server is to run, enter postgres (enterprisedb if you are using Advanced Server installed in Oracle compatible configuration mode).
Step 19: On the Ready to Install screen, click the Next button.
Step 20: When installation has completed the following screen appears. Click the Finish button.
Step 21: On the StackBuilder Plus Installation Complete screen, click the Finish button.
•
Text. Include the --mode text parameter when invoking the installer to perform an installation from the command line during which you are prompted for user input.
•
Unattended. Include the --mode unattended parameter when invoking the installer to perform an installation without user input. In this case, required parameters must be specified on the command line when invoking the installer or the --optionfile parameter must be used to specify a file containing the parameter settings.
•
Extract Only. Invoke the installer with the --extract-only parameter to only extract the files when you do not hold the root privileges required to perform a complete installation.
Note: For additional detailed information on how to install EnterpriseDB products from the command line, see the EDB Postgres Advanced Server Installation Guide located at:
Note: You must have Java Runtime Environment (JRE) version 1.7 or later installed on the hosts where you intend to install any xDB Replication Server component (xDB Replication Console, publication server, or subscription server). Any Java product such as Oracle Java or OpenJDK may be used.
Note: For Advanced Server versions prior to 9.3, a Java runtime is supplied and installed as part of the Advanced Server installation process, however, you must still have pre-installed a separate Java runtime system on your host. The xDB Replication Server installation process does not utilize the Java runtime supplied with Advanced Server.
Specify yes or 1 to extract the xDB Replication Server components and files without performing installation. Specify no or 0 to perform the installation of xDB Replication Server as well. The default is no or 0.
Specify the extent to which a user interface should be displayed during unattended installation. Specify none if no progress bars are to be displayed. Specify minimal if progress bars are to be displayed. Specify minimalWithDialogs if progress bars are to be displayed with dialog boxes if errors occur. The default is minimal.
--optionfile filename
Specify the installation mode. Specify qt to use the Qt graphical toolkit. Specify gtk to use the Gtk graphical toolkit (for Linux only). Specify xwindow to use the X Windows graphical toolkit (for Linux only). Specify text for installation in a command line console (for Linux only). Specify unattended to perform installation without requesting user input. The default is qt.
--debugtrace debug_logfile
--existing-user edb_user_account
--existing-password edb_user_password
Specify the installation language. Specify en for English. Specify zh_CN for Chinese Simplified. Specify zh_TW for Traditional Chinese. Specify ja for Japanese. Specify ko for Korean. The default is en.
--prefix installation_directory
The directory where the xDB Replication Server components are to be installed. The default is /opt/PostgreSQL/EnterpriseDB-xDBReplicationServer for Linux systems. The default is C:\Program Files\PostgreSQL\EnterpriseDB-xDBReplicationServer for Windows systems.
Specify the xDB Replication Server components to be installed. Specify repconsole for the xDB Replication Console and the xDB Replication Server Command Line Interface. Specify pubserver for the xDB publication server. Specify subserver for the xDB subscription server. At least one component must be included in this comma-separated list. The default is repconsole,pubserver,subserver.
--admin_user admin_user
--admin_password admin_password
--serviceaccount account_name
--servicepassword account_password
For information about using the EDB Yum Repository see Chapter 3 of the EDB Postgres Advanced Server Installation Guide available from the EnterpriseDB website located at:
Note: Although the following primarily describes the installation of xDB Replication Server version 6.2, access to the RPM packages for prior xDB Replication Server versions are also described in order to differentiate the installation of these different versions.
Each xDB Replication Server component is available as an individual RPM package. Thus, you can install all xDB Replication Server components with a single yum install command, or you may choose to install selected, individual components by installing only those particular RPM packages.
The Advanced Server server libs package must be available for access by Yum when installing any xDB RPM package component. The edb-asxx-server-libs package is a component of the Advanced Server repository package for version 9.6 or later. The ppasxx-server-libs package is a component of the Advanced Server repository package for version 9.5 or earlier. Step 3 shows how to enable access to the Advanced Server repository so Yum can access its server libs package.
Note: You might have to enable the [extras] repository definition in the CentOS-Base.repo file (located in /etc/yum.repos.d).
yum install package_name
package_name is any of the packages listed under the Package Name column of the preceding table.
Note: Though all xDB components are dependent upon and thus require installation of the server libs package, by using Yum, the dependency on the server libs is recognized when any xDB component is installed. Yum automatically installs the server libs package from the enabled Advanced Server repository along with your selected xDB RPM package.
Step 1: You must have Java Runtime Environment (JRE) version 1.7 or later installed on the hosts where you intend to install any xDB Replication Server component (xDB Replication Console, publication server, or subscription server). Any Java product such as Oracle Java or OpenJDK may be used.
Note: For Advanced Server versions prior to 9.3, a Java runtime is supplied and installed as part of the Advanced Server installation process, however, you must still have pre-installed a separate Java runtime system on your host. The xDB Replication Server installation process does not utilize the Java runtime supplied with Advanced Server.
Step 2: From the EDB Yum Repository, click on the edb-repo link to download the repository RPM for all EnterpriseDB RPMs.
As the root account, run the following command to install this repository configuration package:
Step 3: In the directory /etc/yum.repos.d, the repository configuration file edb.repo is created, which a text file is containing a list of EnterpriseDB repositories, each denoted by an entry starting with the text [repository_name].
•
Change the setting of the enabled parameter to enabled=1.
Step 4: Install the xDB Replication Server RPM package.
yum install ppas-xdb
The xDB Replication Server is installed in directory location /usr/ppas-xdb-x.x where x.x is the xDB Replication Server version number as shown by the following:
Note: Neither the publication server nor the subscription server are running immediately following installation. If after reviewing the remaining steps, you wish to start the publication server, see Section 5.2.1. For starting the subscription server see Section 5.3.1.
Step 5 (For xDB Replication Server 6.2 or 6.1): In the xDB Replication Configuration file /etc/edb-repl.conf, you can either use the default password (edb) as the admin user password, or you can substitute a password of your choice. If you want to use your own password, see Section 10.4.2 on how to generate the encrypted form of the password. Place the encrypted password in the admin_password parameter of the xDB Replication Configuration file. The default admin user name is set to admin and can be changed as well. See Section 2.3.1.3 for information on the xDB Replication Configuration file.
Step 5 (For xDB Replication Server 5.1): In the xDB Replication Configuration file /etc/edb-repl.conf, verify that parameters host, port, database, user, and password are set to allow access to a Postgres database that you wish to use as the xDB Control database. If you wish to use a database other than the one identified by the current default settings, create the desired database and change the parameters to permit connection and authentication to this database to be used as the xDB Control database.
Step 6: The JAVA_EXECUTABLE_PATH parameter in the xDB Startup Configuration file should be set so that the Java runtime program can be accessed upon startup of the publication server and subscription server. If the publication server or subscription server startup fails due to inaccessibility to the Java program, be sure to set the path to your Java runtime program in the xDB Startup Configuration file. See Section 2.3.1.4 for information on the xDB Startup Configuration file. See Section 3.5 for the location of this file.
If you have an existing xDB RPM installation, you can use yum to upgrade your repository configuration file and update to a more recent product version. To update the edb.repo file, assume superuser privileges and enter:
yum will update the edb.repo file to enable access to the current EDB repository, configured to connect with the credentials specified in your edb.repo file. Then, you can use yum to upgrade any installed packages:
yum upgrade ppas-xdb
Each command creates a repository configuration file in the /etc/zypp/repos.d directory. The files are named:
After creating the repository configuration files, use the zypper refresh command to refresh the metadata on your SLES host to include the EnterpriseDB repositories:
When prompted for a User Name and Password, provide your connection credentials for the EnterpriseDB repository. If you need credentials, visit the following website:
zypper addrepo "http://download.opensuse.org/repositories/Java:/Factory/SLE_12_SP2/Java:Factory.repo"
zypper addrepo "http://download.opensuse.org/repositories/server:/Kolab:/3.3/SLE_12/server:Kolab:3.3.repo"
Note: Before starting the publication server and subscription server, the /etc/hosts file must contain an entry for the host name that associates it to the host IP address as shown by the following example where 192.168.187.133 is the IP address and linux-dm8s is the host name:
Note: On some Linux systems, you may have to restart the server before you can see the xDB Replication Console choice in the application menu. If the xDB Replication Console choice is still unavailable in the application menu, it can be started by invoking the script XDB_HOME/bin/runRepConsole.sh.
Note: For xDB Replication Server installed from an xDB RPM package, the xDB Replication Console is started by invoking the script XDB_HOME/bin/runRepConsole.sh.
edb-repl.conf (Linux)
edb-repl.conf (Windows)
XDB_HOME\etc
XDB_HOME/etc
XDB_HOME/etc
XDB_HOME/etc/sysconfig
pubserver.log (Linux)
pubserver.log (Windows)
POSTGRES_HOME\.enterprisedb\xdb\x.x
subserver.log (Linux)
subserver.log (Windows)
POSTGRES_HOME\.enterprisedb\xdb\x.x
USER_HOME/.enterprisedb/xdb/x.x
Note: XDB_HOME is the directory where xDB Replication Server is installed.
Note: POSTGRES_HOME is the home directory of the postgres operating system account (enterprisedb for Advanced Server installed in Oracle compatible configuration mode).
Note: The publication and subscription services startup log files (edb-xdbpubserver.log and edb-xdbsubserver.log) are not generated for Windows and Mac OS X operating systems.
Note: USER_HOME is the home directory of the operating system account in use.
Note: The xDB Replication Server version number is represented by x.x or by xx (for example 6.2 or 62).
If you installed xDB Replication Server using the xDB Replication Server installer program invoked from Stack Builder or StackBuilder Plus as described in Section 3.1 or you invoked the xDB Replication Server installer program from the command line as described in Section 3.2, uninstall xDB Replication Server by invoking the uninstall-xdbreplicationserver script as described in this section.
For Linux only: The following steps are for uninstalling xDB Replication Server from a Linux host.
Step 1: As the root account, run the XDB_HOME/uninstall-xdbreplicationserver script from the directory where you installed xDB Replication Server.
Step 2: Click the Yes button to confirm uninstallation of xDB Replication Server.
Step 3: The Uninstallation Completed dialog box appears when the process has completed. Click the OK button.
For Windows only: The following steps are for uninstalling xDB Replication Server from a Windows host.
Step 1: From the Windows Control Panel, select Uninstall a Program.
Step 2: Select the xDB Replication Server product in the list of programs to uninstall or change. Click the Uninstall/Change button.
Step 3: Click the Yes button to confirm uninstallation of xDB Replication Server.
Step 4: The Uninstallation Completed dialog box appears when the process has completed. Click the OK button.
If you installed xDB Replication Server from the RPM package, you can uninstall any xDB component by invoking the yum remove package_name command as the root account where package_name is any xDB Replication Server component RPM package as listed in the table in Section 3.3.
•
Menu Bar. Menus for the replication system components
•
Tool Bar. Icons for quick access to dialog boxes
•
Replication Tree. Replication system components represented as nodes in an inverted tree
•
Information Window. Tabbed window with information about a highlighted node in the replication tree
Note: The publication server must be running in order to use tools relevant to publications. Similarly, the subscription server must be running in order to use tools relevant to subscriptions.
4.1.1 Refresh
If you choose to save the login information, the server’s network location (IP address and port number), admin user name, and password are stored in a server login file in a hidden location under the home directory of the operating system account with which you have opened the xDB Replication Console. See Section 3.5 for the location of this file.
The following shows the Register Publication Server dialog box where the option to save login information is presented as a check box. In this example 192.168.2.22 entered in the Host field, 9051 entered in the Port field, admin entered in the User Name field, and an encrypted form of the password entered in the Password field are saved in the server login file for this publication server if the admin user name and password validation are successful.
The values for User Name and Password that you enter are validated against the admin user name and password in the xDB Replication Configuration file residing on host 192.168.2.22, in this case. The admin user name and password must successfully authenticate before registration of the publication server and saving of the publication server’s login information in the server login file occur. See Section 2.3.1.3 for information on the xDB Replication Configuration file.
See Section 5.2.1 for more information on the purpose of these fields and the process of registering a publication server.
The following shows the Register Subscription Server dialog box. In this example 192.168.2.22 entered in the Host field, 9052 entered in the Port field, admin entered in the User Name field, and an encrypted form of the password entered in the Password field are saved in the server login file for this subscription server if the admin user name and password validation are successful.
See Section 5.3.1 for more information on the purpose of these fields and the process of registering a subscription server.
Note: Each operating system account on a given host has its own server login file. Thus, the servers that are saved and appear in the xDB Replication Console when opened is independently determined for each operating system account.
Note: The publication database and subscription database cannot be deleted, but unauthorized replications could be forced to occur.
On a 32-bit system, the initial heap size is set to 128 megabytes (-Xms128m) and the maximum limit is set to 512 megabytes (-Xmx512m). On a 64-bit system the initial heap size is 256 megabytes (-Xms256m) and the maximum limit is 1536 megabytes (-Xmx1536m).
The default values can be modified by changing the JAVA_HEAP_SIZE parameter setting in the xDB Startup Configuration file. Be sure to restart the publication server and the subscription server (see sections 5.2.1 and 5.3.1) after making such changes.
•
Minimum RAM Size. For a 32-bit system, use 4 gigabytes; for a 64-bit system use 8 gigabytes.
•
Recommended RAM Size. For a 32-bit system, use 8 gigabytes; for a 64-bit system use 16 gigabytes.
•
wal_level. Set to logical.
•
max_wal_senders. Specifies the maximum number of concurrent connections (that is, the maximum number of simultaneously running WAL sender processes). Set at minimum, to the number of SMR publication databases on this database server that will use the log-based method. In addition, if MMR master nodes are to run on this database server, also add the number of MMR master nodes that will use the log-based method.
•
max_replication_slots. Specifies the maximum number of replication slots. Set at minimum, to the number of SMR publication databases on this database server that will use the log-based method. In addition, if MMR master nodes are to run on this database server with the log-based method, see Section 2.2.10.4 for information on the additional number of replication slots required.
See Section 2.2.10 for information on the log-based method of synchronization replication.
In addition, the pg_hba.conf file requires an entry for each publication database user of publication databases that are to use the log-based method. Such database users must be included as a replication database user in the pg_hba.conf file. See Section 5.1.6.3 for additional information.
Note: The directions in this section apply only if Oracle will be used as the publication or subscription database.
An Oracle JDBC driver jar file such as, ojdbc5.jar, must be accessible to the Java virtual machine (JVM) on the host running the publication server and the subscription server. If the publication server and subscription server are running on separate hosts, the Oracle JDBC driver must be accessible to the JVM on each host. Oracle JDBC driver version ojdbc5 or later must be used.
Step 1: Download the Oracle JDBC driver, for example, ojdbc5.jar, from the Oracle download site to the host that will be running the publication server.
Step 2: Copy file ojdbc5.jar to the directory XDB_HOME/lib/jdbc.
Note: You may also copy the ojdbc5.jar file to the jre/lib/ext subdirectory of the location where you installed your Java runtime environment.
Step 3: If the subscription server is running on a different host than the publication server, repeat steps 1 and 2 for the subscription server host.
Note: The directions in this section apply only if SQL Server will be used as the publication or subscription database.
The jTDS JDBC driver jar file jtds-1.3.1.jar must be accessible to the Java virtual machine (JVM) on the host running the publication server and the subscription server. If the publication server and subscription server are running on separate hosts, the jTDS JDBC driver must be accessible to the JVM on each host.
When you install xDB Replication Server, the jtds-1.3.1.jar file is placed in the directory XDB_HOME/lib/jdbc so there is no manual configuration needed for this requirement.
Step 1: Be sure SQL Server Authentication mode is enabled on your SQL Server database engine. SQL Server Authentication mode allows the use of SQL Server logins such as the built-in system administrator login, sa.
Using the default settings for SQL Server installation, only Windows Authentication mode is enabled, which utilizes the accounts of the Windows operating system for authentication.
In order to permit SQL Server Authentication mode, you must change the authentication mode to Mixed Mode Authentication, which permits both Windows Authentication and SQL Server Authentication.
This can be done using SQL Server Management Studio. Refer to the appropriate SQL Server documentation for using SQL Server Management Studio.
Step 2: Be sure SQL Server is accepting TCP/IP connections. In the SQL Server Configuration Manager, under SQL Server Network Configuration, be sure the TCP/IP protocol for the SQL Server instance is set to Enabled. The typical, default SQL Server instance names are MSSQLSERVER or SQLEXPRESS.
Step 3 (Required only for a SQL Server publication database): Be sure SQL Server Agent is enabled and running. SQL Server Agent is a Windows service that controls job scheduling and execution with SQL Server.
SQL Server Agent can be started by using SQL Server Configuration Manager. Refer to the appropriate SQL Server documentation for using SQL Server Configuration Manager.
•
Three tables named dept, emp, and jobhist are members of schema edb.
•
One view named salesemp is a member of schema edb. This view is a SELECT statement over the emp table.
•
The Oracle system identifier (SID) of the publication database is xe. The SQL Server publication database name is edb. The Postgres publication database name is edb. (The cases of Oracle as the publication database, SQL Server as the publication database, and Postgres as the publication database are presented with examples in this section.)
Note (For Oracle 12c): The Oracle 12c multitenant architecture introduces the concept of the container database (CDB), which can contain multiple pluggable databases (PDBs). A pluggable database can be used as a publication database or a subscription database in a single-master replication system.
Step 1: Create a database user name for the publication database user. The publication database user name must have a password, and it must have the ability to create a database session. The publication database user becomes the owner of the control schema objects that will be created in the publication database to track, control, and record the replication process and history.
Note (For Oracle 12c Pluggable Database): The publication database user can be an Oracle local user or a common user. The local user exists within and has access to only a single, user-created pluggable database (PDB), which is to be used as the publication database. Common user names typically begin with C## or c## and can access multiple pluggable databases.
Note (For Oracle 12c Pluggable Database): Creation and granting of privileges for a local user must be done while connected to the pluggable database to be used as the publication database. Creation of a common user must be done within the Oracle 12c root container CDB$ROOT. Granting of privileges to the common user must be done while connected to the pluggable database to be used as the publication database.
Note (For Oracle 12c Non-Container Database): Creation and granting of privileges to the publication database user are performed in the same manner as for Oracle versions prior to 12c.
Step 2: Grant the privileges needed to create the control schema objects.
Step 3: Grant the privileges required to create triggers on the publication tables. The CREATE ANY TRIGGER privilege must be granted to the publication database user.
Step 4: Grant the privileges required to lock publication tables when creating triggers. The LOCK ANY TABLE privilege must be granted to the publication database user.
Step 5 (For Oracle 12c only): Grant the privileges required to access tablespaces. The GRANT UNLIMITED TABLESPACE privilege must be granted to the publication database user. This requirement applies to both a pluggable database and a non-container database.
Step 6: The publication database user must be able to read the tables and views that are to be included in publications.
Step 7 (Optional): Create one or more “group” roles containing the required privileges to access the tables and views of the publications that will be needed by application users.
When an application connects to a particular database, the application assumes the identity and privileges of a database user that has been defined in that database. The database users in any given database are independent of database users in other databases with respect to their properties such as their role memberships and privileges. In fact, the same database user name can be defined in more than one database, each with its own distinct properties.
In each database, a database user can be mapped to a SQL Server login. When an application connects to a database using a SQL Server login to which a database user has been mapped, the application assumes the identity and privileges of that database user.
•
A database user must exist in the msdb database that is mapped to the SQL Server login used by the publication server. This database user must have certain privileges to execute jobs in the dbo schema of the msdb database. (The msdb database is used by SQL Server Agent to schedule alerts and jobs. SQL Server Agent runs as a Windows service.)
•
The control schema used to contain certain control schema objects created by the publication server is pubuser. Other control schema objects are always created in _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler.
•
The database user mapped to SQL Server login pubuser in database msdb is pubuser_msdb.
Note: The sqlcmd utility program is used to execute the SQL statements in these examples. The USE command establishes the database to which the subsequent statements are to apply. The GO command executes the preceding SQL statements as a batch. Placement of the GO command within a stream of SQL statements sometimes has significance depending upon the particular SQL statements.
Step 1: Create a SQL Server login for the xDB Replication Server publication database user. The login must have a password.
Step 2: Create the database user and its required privileges for job scheduling in database msdb:
Step 3: Create the database user for the control schema object creation and ownership. The control schema objects are created in the publication database to track, control, and record the replication process and history. This example assumes some of the control schema objects are to be created in the schema named pubuser.
Note: The schema name you specify in the WITH DEFAULT_SCHEMA clause must be the schema you choose in Step 5. This schema does not have to exist before using it in the CREATE USER FOR LOGIN WITH DEFAULT_SCHEMA statement.
Note: The remaining steps assume that the commands are given in the publication database (that is, the USE edb command has been previously given to establish the publication database edb as the current database.)
Step 4: Grant the database level privileges needed by the publication database user to create the control schema objects.
Step 5: Choose the control schema where some of the control schema objects are to reside.
Step 6: Grant the privileges required to create triggers on the publication tables. The publication database user must have the ALTER privilege on the publication tables.
Step 7: The publication database user must be able to read the tables and views that are to be included in publications.
Step 8 (Optional): Create one or more “group” roles containing the required privileges to access the tables and views of the publications that will be needed by application users.
Note: Creation of these roles can only be done after the SQL Server publication database definition has been created using the xDB Replication Console or xDB Replication Server CLI. (For example, see Section 5.2.2 for the xDB Replication Console usage.)
The following example shows the creation of the role appgroup and the granting of privileges on the publication tables to the role. The example assumes that in Step 5, schema pubuser was chosen as the control schema to store some of the control schema objects.
Note (Granting privileges to individual users): As previously described, each application database user that is to modify the data in any of the publication tables must be granted certain privileges on the publication tables and the control schema objects. Using a group role for this purpose as described earlier in this step helps simplify this process.
Note: Instead of using the preceding statements, which grant privileges at the schema level, a more granular level of privileges can be issued at the database object level using the following statements:
For SQL Server 2008: Grant the following privileges:
For SQL Server 2012, 2014: Grant the following privileges:
•
The database user has superuser privileges. Superuser privileges are required because the database configuration parameter session_replication_role is altered by the database user to replica for snapshot operations involving replication of the control schema from one publication database to another.
Step 1: Create a database superuser for the publication database user. The publication database user name must have a password, and it must have the ability to create a database session. The publication database user becomes the owner of the control schema objects that will be created in the publication database to track, control, and record the replication process and history.
Step 2 (Optional): Create one or more “group” roles containing the required privileges to access the tables and views of the publications that will be needed by application users.
Note: The process described in this step is applicable to Postgres publications in both single-master and multi-master replication systems.
The following example shows the creation of the role appgroup and the granting of privileges on the publication tables to the role.
In addition, for the log-based method of synchronization replication, if the TRUNCATE command is to be permitted on the publication tables, grant the following additional privileges:
Also for the log-based method of synchronization replication for usage of the TRUNCATE command, grant the following privileges after creation of the publication database definition. (See Section 5.2.2 for information on creating the publication database definition for a single-master replication system. For a multi-master replication system, see Section 6.2.2.)
Note (Granting privileges to roles after publication creation): Roles for containing publication table privileges should be created before you create the publication. (See Section 5.2.3 for information on creating a publication for a single-master replication system. For a multi-master replication system, see Section 6.2.3.)
•
USAGE privilege on schema _edb_replicator_pub.
•
USAGE privilege on sequence rrep_tx_seq.
•
INSERT privileges on the shadow tables corresponding to publication tables in which the role will be inserting, updating, or deleting rows. Shadow tables follow the naming convention rrst_schema_table. Note that shadow tables exist only if the trigger-based method of synchronization is to be used.
•
USAGE privilege on schema _edb_replicator_pub.
•
INSERT privilege on table _edb_replicator_pub.rrep_wal_events_queue.
In addition, if the TRUNCATE command is to be permitted on the publication tables, grant the following additional privileges:
See Section 5.1.5.1 for preparation of a Postgres subscription database. See Section 5.1.5.2 for preparation of an Oracle subscription database. See Section 5.1.5.3 for preparation of a SQL Server subscription database.
The subscription database user must also have the ability to run the TRUNCATE command on the subscription tables. This requires the following:
•
Use the Postgres user name postgres created upon installation of PostgreSQL (enterprisedb for Advanced Server installed in Oracle compatible configuration mode) for the subscription database user name. If you choose this option, skip Step 1 and proceed to Step 2.
Step 1: Create a superuser as the subscription database user.
Step 2: Create or choose the subscription database.
For a SQL Server publication database: If the schema containing the publication tables and views in SQL Server is named dbo, then the subscription server creates a schema named dbo_sql in the Postgres subscription database for the subscription tables. (Schema dbo is a special reserved schema in Postgres.)
Step 1 (Optional): If you do not have an existing database that you want to use as your subscription database, create a new database. This step can be fairly complicated. Refer to the appropriate Oracle documentation for performing this task.
Step 2: Create a database user name for the subscription database user. The subscription database user name must have a password, and it must have the ability to create a database session. The subscription database user becomes the owner of the replicated database objects.
Note (For Oracle 12c Pluggable Database): The subscription database user can be an Oracle local user or a common user. The local user exists within and has access to only a single, user-created pluggable database (PDB), which is to be used as the subscription database. Common user names typically begin with C## or c## and can access multiple pluggable databases.
Note (For Oracle 12c Pluggable Database): Creation and granting of privileges for a local user must be done while connected to the pluggable database to be used as the subscription database. Creation of a common user must be done within the Oracle 12c root container CDB$ROOT. Granting of privileges to the common user must be done while connected to the pluggable database to be used as the subscription database.
Note (For Oracle 12c Non-Container Database): Creation and granting of privileges to the subscription database user are performed in the same manner as for Oracle versions prior to 12c.
Step 3: Grant the privileges needed to create the replicated database objects.
Step 4 (For Oracle 12c only): Grant the privileges required to access tablespaces. The GRANT UNLIMITED TABLESPACE privilege must be granted to the subscription database user. This requirement applies to both a pluggable database and a non-container database.
Step 1: Create or choose the subscription database.
Note: If the schema containing the publication tables and views is named public, then the subscription server creates a schema named public_sql in the SQL Server subscription database for the subscription tables.
Step 2: Create a SQL Server login for the subscription database user. The login must have a password.
Step 3: In the subscription database, a database user must exist that is to be the creator and owner of the subscription tables. This database user must be mapped to the SQL Server login created in Step 2.
Step 4: Grant the database level privileges needed by the subscription database user to create the schema and tables for the subscription.
The publication server uses the port number you specified on the Publication Server Details screen in Step 16 of Section 3.1 as well the port offset by a value of 2 greater than this specified port number. So for a default publication server installation, access is required for port numbers 9051 and 9053.
The subscription server uses the port number you specified on the Subscription Server Details screen in Step 17 of Section 3.1 as well as the port offset by a value of 2 greater than this specified port number. So for a default subscription server installation, access is required for port numbers 9052 and 9054.
If you want to use different port numbers, modify the PUBPORT and SUBPORT entries in the xDB Startup Configuration file and restart the publication server and subscription server.
Note: If you change the port numbers for the publication server or subscription server for which there are existing replication systems, there are additional updates you must perform upon these existing replication systems. See Section 7.6.1.2 for changes that must be made for the publication server metadata in the control schema if the port number used by the subscription server has been changed. See Section 5.5.3 for changes that must be made for the subscription metadata in the control schema if the port number used by the publication server has been changed.
For Linux only: Use the /sbin/ifconfig command.
For Windows only: Open a Command Prompt window and use the ipconfig command.
For Linux only: You may need to modify the /etc/hosts file so that a host’s network IP address is associated with the host’s name.
Note: For an alternative to modifying the /etc/hosts file see Section 10.4.1.7.
This is also verified by using the hostname -i command, which returns the IP address associated with the host name:
If the loopback address 127.x.x.x is returned such as in the preceding example, edit the /etc/hosts file so that the network IP address is associated with the host name instead.
The following example shows the modified /etc/hosts file so that the host name localhost is now associated with the network IP address 192.168.2.22 instead of the loopback address 127.0.0.1:
On some Linux systems, you may need to restart the network service after you have modified the /etc/hosts file. This may be done a number of different ways depending upon the Linux system you are using as shown by the following variations:
The hostname -i command now returns the network IP address of the host:
A Postgres database server uses the host-based authentication file, pg_hba.conf, to control access to the databases in the database server.
You need to modify the pg_hba.conf file in the following locations:
The modifications needed to the pg_hba.conf file for each of the aforementioned cases are discussed in the following sections.
host pub_dbname pub_dbuser pub_ipaddr/32 md5
host pub_dbname pub_dbuser sub_ipaddr/32 md5
The value you substitute for pub_dbname is the name of the Postgres publication database you intend to use. The value you substitute for pub_dbuser is the publication database user name you created in Step 1 of Section 5.1.4.3.
For a Postgres publication database named edb, the resulting pg_hba.conf file appears as follows:
Note: The preceding example assumes the publication server and the subscription server are running on the same host, hence the single entry for database edb. If the publication server and subscription server are running on separate hosts, then the pg_hba.conf file on the publication database server would look like the following:
In addition, the preceding examples assume publication database edb is using the trigger-based method of synchronization replication. If the log-based method is used, the pg_hba.conf file must contain an additional entry with the DATABASE field set to replication for pub_dbname, pub_dbuser, and pub_ipaddr to allow replication connections from the publication server on the host on which it is running.
See sections 2.2.10 and 5.1.2 for additional information on synchronization replication with the log-based method.
host sub_dbname sub_dbuser pub_ipaddr/32 md5
host sub_dbname sub_dbuser sub_ipaddr/32 md5
The values you substitute for sub_dbuser and sub_dbname are the subscription database user name and the subscription database name you created in steps 1 and 2 of Section 5.1.5.1.
For a Postgres subscription database named subdb, the resulting pg_hba.conf file appears as follows:
Note: The preceding example assumes that the publication server and the subscription server are running on the same host hence, only one entry is needed for database subdb. If the publication server and subscription server are running on separate hosts, then the pg_hba.conf file on the subscription database server looks like the following:
Step 1: Start the publication server if it is not already running.
Note: If you are using Oracle publication or subscription databases, and the publication server has not been restarted since copying the Oracle JDBC driver to the lib/jdbc subdirectory of your xDB Replication Server installation, you must restart the publication server.
For Linux only: You can verify the publication server is running by using the systemctl command for CentOS 7 or RHEL 7, and the service command for previous Linux versions.
Similarly, use the stop option to stop the publication server.
For Windows only: Open Control Panel, System and Security, Administrative Tools, and then Services. The publication server runs as a service named Publication Service for xDB Replication Server.
Step 2: Register the publication server. Open the xDB Replication Console from the system’s application menu. For xDB Replication Server installed from an xDB RPM package, the xDB Replication Console is started by invoking the script XDB_HOME/bin/runRepConsole.sh.
Step 3: Select the top level Replication Servers node. From the File menu, choose Publication Server, and then choose Register Server. Alternatively, click the secondary mouse button on the Replication Servers node and choose Register Publication Server. The Register Publication Server dialog box appears.
•
Host. Network IP address of the host running the publication server. This is the network IP address used for pub_ipaddr in the pg_hba.conf file in Section 5.1.6.3. (Do not use localhost for this field.)
•
Port. Port number the publication server is using. This is the port number you specified on the Publication Server Details screen in Step 16 of Section 3.1.
•
User Name. Admin user name that is used to authenticate your usage of this publication server. This is the user name you specified on the xDB Admin User Details screen in Step 15 of Section 3.1.
•
Password. Password of the admin user given in the User Name field.
•
Save login information. Check this box if you do not want to re-register the publication server each time you open the xDB Replication Console. See Section 4.2 for additional information on the advantages and disadvantages of saving server login information.
Note: The user name and password combination you enter is authenticated against the admin user name and password in the xDB Replication Configuration file residing on the host with the IP address you enter in the Host field.
Step 1: Make sure the database server in which the publication database resides is running and accepting client connections.
Step 2: Select the SMR type node under the Publication Server node. From the Publication menu, choose Publication Database, and then choose Add Database. Alternatively, click the secondary mouse button on the SMR type node and choose Add Database. The Publication Service – Add Database dialog box appears.
Step 3: Fill in the following fields:
•
Database Type. Select Oracle, SQL Server, PostgreSQL, or Postgres Plus Advanced Server for the type of publication database. For an Advanced Server Oracle compatible installation, select the Postgres Plus Advanced Server option. For PostgreSQL or an Advanced Server PostgreSQL compatible installation, select the PostgreSQL option.
•
Host. IP address of the host on which the publication database server is running.
•
Port. Port on which the publication database server is listening for connections.
•
User. The publication database user name created in Step 1 of Section 5.1.4.
•
Password. Password of the database user.
•
Service ID (For Oracle). Enter the Oracle System Identifier (SID) of the Oracle instance running the publication database if the SID radio button is selected. Enter the net service name of a connect descriptor as defined in the TNSNAMES.ORA file if the Service Name radio button is selected. Note (For Oracle 12c Pluggable Database): Use the service name.
•
Database (For Postgres or SQL Server). Enter the Postgres or SQL Server database name.
•
URL Options (For SSL connectivity). Enter the URL options to establish SSL connectivity to the publication database. See Section 7.11 for information on using SSL connections.
•
Changeset Logging (For Postgres). Select Table Triggers to use the trigger-based method of synchronization replication. Select WAL Stream to use the log-based method of synchronization replication. See Section 2.2.9 for information on the trigger-based method. See Section 2.2.10 for information on the log-based method.
Note: If the controller database is an Oracle or a SQL Server publication database, then a second Oracle or SQL Server publication database cannot be added to create a second single-master replication system. In order for xDB Replication Server to run more than one single-master replication systems consisting of Oracle or SQL Server publication databases, a Postgres publication database must be designated as the controller database. See Section 2.3.1.12 for information on the controller database.
Step 4: Click the Test button. If Test Result: Success appears, click the OK button, then click the Save button.
For Oracle only: Multiple Oracle databases can be added as publication databases by completing the Add Database dialog box for each database. It is also permissible to add the same Oracle database as two or more distinct publication database definitions if you use different publication database user names for each publication database definition.
For Postgres or SQL Server: Multiple Postgres or SQL Server databases can be added as publication databases by completing the Add Database dialog box for each database. However, unlike Oracle, a given Postgres or SQL Server database can only be added once as a 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 Section 7.1 for information on the wildcard selector.
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 Section 2.2.12.3 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.
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.
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.
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.
Step 4: Click the Create button. If Publication Created Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.
•
The tables named according to the convention RRST_schema_table from the SELECT statement on user_tables are found only for synchronization publications. In this example, these tables are RRST_EDB_DEPT and RRST_EDB_EMP.
•
The triggers named according to the convention RRPD_schema_table, RRPI_schema_table, and RRPU_schema_table from the SELECT statement on user_triggers are found only for synchronization publications. In this example, these triggers are RRPU_EDB_DEPT, RRPI_EDB_DEPT, RRPD_EDB_DEPT, RRPI_EDB_EMP, RRPU_EDB_EMP, and RRPD_EDB_EMP.
Note: The RREP_SYNCID_ARRAY collection type is found only in an Oracle publication database.
Most of the control schema objects are created in schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler. Additional control schema objects are created in the schema you chose in Step 5 of Section 5.1.4.2. The following examples assume the schema of your choosing is pubuser. The publication tables are dept and emp located in the edb schema.
Note (For SQL Server 2012, 2014): The following database objects from the preceding list are no longer created as part of the control schema when the publication database is SQL Server 2012 or 2014:
Finally, some jobs are created in the msdb database after the subscription is created as shown by the following:
The control schema objects are created in three schemas named _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler.
The control schema objects contained in _edb_replicator_pub are shown by the following:
The control schema objects contained in _edb_replicator_sub are shown by the following:
The control schema objects contained in _edb_scheduler are shown by the following:
These triggers are used to support synchronization replication of the TRUNCATE command when the log-based method is used.
Step 1: Start the subscription server if it is not already running. Repeat the same process as in Step 1 of Section 5.2.1.
Note: If you are using Oracle publication or subscription databases, and the subscription server has not been restarted since copying the Oracle JDBC driver to the lib/jdbc subdirectory of your xDB Replication Server installation, you must restart the subscription server.
For Linux only: Use the systemctl command for CentOS 7 or RHEL 7, and the service command for previous Linux versions to start, stop, or restart edb-xdbsubserver for the subscription server. See Section 5.2.1 for information on how these commands are used.
For Windows only: Open Control Panel, System and Security, Administrative Tools, and then Services. Use the Start or Restart link for the service named Subscription Service for xDB Replication Server.
Step 2: Register the subscription server. Open the xDB Replication Console from the system’s application menu. For xDB Replication Server installed from an xDB RPM package, the xDB Replication Console is started by invoking the script XDB_HOME/bin/runRepConsole.sh.
Step 3: Select the top level Replication Servers node. From the File menu, choose Subscription Server, and then choose Register Server. Alternatively, click the secondary mouse button on the Replication Servers node and choose Register Subscription Server. The Register Subscription Server dialog box appears.
•
Host. Network IP address of the host running the subscription server. This is the network IP address used for sub_ipaddr in the pg_hba.conf file in Section 5.1.6.3. (Do not use localhost for this field.)
•
Port. Port number the subscription server is using. This is the port number you specified on the Subscription Server Details screen in Step 17 of Section 3.1.
•
User Name. Admin user name that is used to authenticate your usage of this subscription server. This is the user name you specified on the xDB Admin User Details screen in Step 15 of Section 3.1.
•
Password. Password of the admin user given in the User Name field.
•
Save login information. Check this box if you do not want to re-register the subscription server each time you open the xDB Replication Console. See Section 4.2 for additional information on the advantages and disadvantages of saving server login information.
Note: The user name and password combination you enter is authenticated against the admin user name and password in the xDB Replication Configuration file residing on the host with the IP address you enter in the Host field.
•
For Oracle only. There must be no existing tables or views owned by the Oracle subscription database user that has the same name as a table or view in a publication that will be replicated to this database. For example, if the Oracle subscription database user name is subuser, and if a Postgres publication contains a table with the name dept, then the Oracle subscription database must not have an existing table or view with the schema-qualified name subuser.dept at the time you create the subscription.
•
For Postgres only. There must be no existing tables or views with the same schema-qualified name as a table or view in a publication that will be replicated to this database. For example, if the publication contains a table with the schema-qualified name edb.dept, then the Postgres subscription database must not have an existing table or view with the schema-qualified name edb.dept at the time you create the subscription. Note: If the SQL Server publication schema name is dbo, the subscription tables are created under a schema named dbo_sql in Postgres.
•
For SQL Server only. There must be no existing tables or views with the same schema-qualified name as a table or view in a publication that will be replicated to this database. For example, if the publication contains a table with the schema-qualified name edb.dept, then the SQL Server subscription database must not have an existing table or view with the schema-qualified name edb.dept at the time you create the subscription. Note: If the Postgres publication schema name is public, the subscription tables are created under a schema named public_sql in SQL Server.
Note: A database that has been added as a publication database can also be used as a subscription database.
Step 1: Make sure the database server in which the subscription database resides is running and accepting client connections.
Step 2: Select the Subscription Server node. From the Subscription menu, choose Subscription Database, and then choose Add Database. Alternatively, click the secondary mouse button on the Subscription Server node and choose Add Database. The Subscription Service – Add Database dialog box appears.
Step 3: Fill in the following fields:
•
Database Type. Select Oracle, SQL Server, PostgreSQL, or Postgres Plus Advanced Server for the type of subscription database. For an Advanced Server Oracle compatible installation, select the Postgres Plus Advanced Server option. For PostgreSQL or an Advanced Server PostgreSQL compatible installation, select the PostgreSQL option.
•
Host. IP address of the host on which the subscription database server is running.
•
Port. Port on which the subscription database server is listening for connections.
•
User. The subscription database user name chosen in Section 5.1.5.1 for a Postgres subscription database or the database user name created in Step 2 of Section 5.1.5.2 for an Oracle subscription database or the database user name created in Step 2 of Section 5.1.5.3 for a SQL Server subscription database.
•
Password. Password of the database user.
•
Service ID (For Oracle). Enter the Oracle System Identifier (SID) of the Oracle instance running the subscription database if the SID radio button is selected. Enter the net service name of a connect descriptor as defined in the TNSNAMES.ORA file if the Service Name radio button is selected. Note (For Oracle 12c Pluggable Database): Use the service name.
•
Database (For Postgres or SQL Server). Enter the Postgres or SQL Server database name.
•
URL Options (For SSL connectivity). Enter the URL options to establish SSL connectivity to the subscription database. See Section 7.11 for information on using SSL connections.
Step 4: Click the Test button. If Test Result: Success appears, click the OK button, then click the Save button.
Step 1: Select the Subscription Database node. From the Subscription menu, choose Create Subscription. Alternatively, click the secondary mouse button on the Subscription Database node and choose Create Subscription. The Create Subscription dialog box appears.
Step 2: Fill in the following fields:
•
Subscription Name. Enter a name for the subscription that is unique amongst all subscription names.
•
Host. Network IP address of the publication server that is the parent node of the publication to be subscribed to. This is the same value entered in the Host field in Step 3 of Section 5.2.1.
•
Port. Port used by the publication server. This is the same value entered in the Port field in Step 3 of Section 5.2.1.
•
User Name. Admin user name of the publication server. This is the same value entered in the User Name field in Step 3 of Section 5.2.1.
•
Password. Password of the admin user. This is the same value entered in the Password field in Step 3 of Section 5.2.1.
•
Publication Name. Click the Load button to get a list of available publications. Select the publication to which to subscribe.
Step 3 (Optional): If you defined a set of available table filters for the publication, you have the option of enabling these filters on this subscription. See Section 5.2.3 for instructions on defining table filters. If you do not wish to filter the rows that are replicated to this subscription, go to Step 4.
In the following example the filter named dept_10_20_30 is enabled on the dept table and the filter named dept_30 is enabled on the emp table of this subscription.
Step 4: Click the Create button. If Subscription Created Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.
After you have added a subscription database definition you will find a single table named rrep_txset_health has been created as the subscription metadata object.
For Oracle only: The RREP_TXSET_HEALTH table is created in the subscription database user’s schema as shown in the following output:
For SQL Server only: The rrep_txset_health table is created in the schema named _edb_replicator_sub.
For Postgres only: The rrep_txset_health table is created in the schema named _edb_replicator_sub.
Step 1: Select the Subscription node of the subscription for which you wish to perform snapshot replication.
Step 2: Open the Snapshot dialog box in any of the following ways:
Step 3: Select the Verbose Output check box only if you want to display the output from the snapshot in the dialog box. This option should be left unchecked in a network address translation (NAT) environment as a large amount of output from the snapshot may delay the response from the Snapshot dialog box. Click the Snapshot button to start snapshot replication.
Step 4: Snapshot Taken Successfully appears if the snapshot was successful. Click the OK button. If the snapshot was not successful, scroll through the messages in the Snapshot dialog box window if Verbose Output was selected or check the log files.
The status messages of each snapshot are saved in the Migration Toolkit log files named mtk.log[.n] (where [.n] is an optional history file count if log file rotation is enabled) in the following directories:
POSTGRES_HOME\.enterprisedb\xdb\x.x
POSTGRES_HOME is the home directory of the Windows postgres account (enterprisedb account for Advanced Server installed in Oracle compatible configuration mode). The specific location of POSTGRES_HOME is dependent upon your version of Windows. The xDB Replication Server version number is represented by x.x.
Step 1: When the trigger-based method of synchronization replication is in use, select the Subscription node of the subscription for which you wish to perform synchronization replication.
Step 2: Open the Synchronize dialog box in any of the following ways:
Step 3: Click the Synchronize button to start synchronization replication.
Step 4: Subscription Synchronized Successfully appears if the synchronization was successful. Click the OK button. If the synchronization was not successful, scroll through the messages in the Synchronize dialog box window.
Note: This section discusses various aspects of managing a subscription of a replication system. For a similar discussion on managing a publication of a replication system, see Section 7.6.
Step 1: The subscription server whose login information you want to save, change, or delete in the server login file must be running before you can make any changes to the file. See Step 1 of Section 5.3.1 for directions on starting the subscription server.
Step 2: Click the secondary mouse button on the Subscription Server node and choose Update. The Update Subscription Server dialog box appears.
Step 3: Complete the fields in the dialog box according to your purpose for updating the server login file:
Step 4: Click the Update button. If the dialog box closes, then the update to the server login file was successful. Click the Refresh icon in the xDB Replication Console tool bar to show the updated Subscription Server node.
Note: Depending upon the database type (Oracle, SQL Server, or Postgres), certain attributes must not be changed. If you have already added subscriptions, you must not change any attribute that alters access to the schema where the subscription tables were created.
Step 1: Make sure the database server that you ultimately wish to save as the subscription database definition is running and accepting client connections.
Step 2: Make sure the subscription server whose node is the parent of the subscription database definition you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 3: Select the Subscription Database node corresponding to the subscription database definition that you wish to update.
Step 4: From the Subscription menu, choose Subscription Database, and then choose Update Database. Alternatively, click the secondary mouse button on the Subscription Database node and choose Update Database. The Update Database Source dialog box appears.
Step 5: Enter the desired changes. See Step 3 of Section 5.3.2 for the precise meanings of the fields.
Step 6: Click the Test button. If Test Result: Success appears, click the OK button, then click the Save button.
Step 7: Click the Refresh icon in the xDB Replication Console tool bar to show the updated Subscription Database node and any of its subscriptions.
Step 1: Make sure the subscription server whose node is the parent of the subscription you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 2: Select the Subscription node whose attributes you wish to update.
Step 3: From the Subscription menu, choose Update Subscription. Alternatively, click the secondary mouse button on the Subscription node and choose Update Subscription. The Update Subscription dialog box appears.
Step 4: If the publication server now runs on a host with a different IP address or port number than what is shown in the dialog box, enter the correct information. You must also enter the admin user name and password saved in the xDB Replication Configuration file that resides on the host on which the publication server is running. Click the Update button.
Step 5: If Subscription Updated Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.
Step 6: If the publication server with the new network location manages publications subscribed to by other subscriptions, repeat steps 1 through 5 for these other subscriptions.
Step 1: Make sure the publication server whose node is the parent of the publication associated with the subscription you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server. Make sure the subscription server whose node is the parent of the subscription you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 2: Select the Subscription node of the subscription on which you wish to enable or disable individual filter rules.
Step 3: Open the Filter Rules tab in any of the following ways:
Step 4: In the Filter Rules tab check or uncheck the boxes to specify the filter rules to enable or disable on the subscription. At most one filter rule may be enabled any given subscription table. Click the Update button.
Step 5: A confirmation box appears presenting a warning message and a recommendation to perform a snapshot replication to any subscription on which you changed the filtering criteria.
Step 6: If you clicked the Ok button in the preceding step, the Filter Rules updated successfully confirmation message appears if the update was successful.
Step 7: It is strongly recommended that a snapshot replication be performed to the subscription that contains tables on which the filtering criteria has changed.
Step 1: Make sure the subscription server whose node is the parent of the subscription you wish to remove is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 2: Select the Subscription node of the subscription that you wish to remove.
Step 3: Remove the subscription in any of the following ways:
Step 4: In the Remove Subscription confirmation box, click the Yes button.
Step 1: Make sure the subscription server whose node is the parent of the subscription database definition you wish to remove is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 2: Select the Subscription Database node that you wish to remove.
Step 3: From the Subscription menu, choose Subscription Database, then Remove Database. Alternatively, click the secondary mouse button on the Subscription Database node and choose Remove Subscription. The Remove Subscription Database confirmation box appears.
Step 4: In the Remove Subscription Database confirmation box, click the Yes button.
Controlled switchover is the exchanging of roles between a publication database and a subscription database. That is, the tables that were formerly publications become the subscription tables. The former subscription tables now become the publications.
Note: This discussion assumes that the trigger-based method of synchronization replication is used by the publication database. If the publication database employs the log-based method, then it must be determined if the current subscription database meets the criteria for using the log-based method if that is so desired when it is switched to the role of the publication database. If the subscription database does not meet the criteria, then the trigger-based method must be implemented and used. See Section 2.2.10 for information on the log-based method and the necessary configuration steps that must be performed if the log-based method is to be used.
•
Update certain control schema tables so as to exchange the connection information for the publication database and subscription database. These updates must be made in the control schema of all publication databases to ensure consistency of the control schema across all publication databases.
Step 1: Stop all transaction processing against the publication database.
Step 2: Perform an on demand synchronization replication or a snapshot replication (for snapshot-only publications) in order to replicate any pending updates in the publication database shadow tables to the subscription database.
Step 3: Stop the publication server and the subscription server.
Step 4: Review the prerequisites in Section 5.1 to ensure that the subscription database and its host can be used in the role of a publication database, and the publication database and its host can be used in the role of a subscription database.
Step 5: Create a backup of schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler from the publication database on node 1.
Step 6: Create a backup of the replication triggers and their corresponding trigger functions on the publication tables on node 1. For the trigger-based method, these triggers are named with prefixes of rrpd_, rrpi_ and rrpu_. The trigger functions are named with the same prefixes. For the log-based method, a trigger for each table is prefixed with rrpt_. The function is named capturetruncateevent.
Step 7: Create a backup of schema _edb_replicator_sub from the subscription database on node 2.
Step 8: Restore the backups of schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler created in Step 5 to the subscription database on node 2. Also restore the backup of the replication triggers and trigger functions created in Step 6 to the subscription database on node 2.
Step 9: Restore the backup of schema _edb_replicator_sub created in Step 7 to the publication database on node 1.
Step 10: Update the control schema objects so that the publication database definition references the new publication database (that is, the former subscription database) on node 2 and the subscription database definition references the new subscription database (that is, the former publication database) on node 1.
•
•
Step 11: If you decide to use a publication server or subscription server on a new host, perform the following step, otherwise go to Step 12.
Step 12: Edit the xDB Replication Configuration file on the publication server and subscription server host so that it contains the controller database connection and authentication information for the new publication database now running on node 2.
Step 13: Update the pg_hba.conf files of the database servers to allow access to the subscription database now on node 1 and the publication database now on node 2 in accordance with Section 5.1.6.3.
Step 14: When using the log-based method, create a replication slot on the database server that now contains the publication database.
See Section 10.3.4.4 for additional information on deleting the replication slot if the pg_drop_replication_slot function is not successful. If you switch back the databases to their original roles, you will just have to recreate the replication slot on the publication database server as previously described in this step.
Step 15: The controlled switchover is now complete. Start the publication server and the subscription server.
Step 16: After confirming that the publication tables are consistent with the subscription tables, the first replication operation must be a snapshot. After performing a snapshot, synchronization replications may be performed.
Failover is the replacement of the publication database by the subscription database should a failure occur on the publication database or its host. Failover is considered an irreversible action so the subscription database permanently takes over the role of the publication database.
•
If the control schema objects on the publication database (that is, schemas _edb_replicator_pub, _edb_replicator_sub, _edb_scheduler, and their objects) cannot be salvaged or restored from a backup, then performing a failover may only be possible with the assistance of EnterpriseDB Technical Support Services.
Note: Most of these configuration options are applicable to multi-master replication systems as well. Options applicable to multi-master replication systems are those that apply to the publication server and are not specific to a database product other than Postgres (such as an Oracle feature).
Note: The options described in this section apply to the publication server only and are set in the publication server configuration file unless otherwise specified.
When the copyViaDBLinkOra option is set to true, the Oracle database link API, dblink_ora, is used instead of JDBC COPY to populate Advanced Server subscription tables from an Oracle publication during snapshot replication.
Note: The Oracle database link API feature is not available with PostgreSQL, therefore the copyViaDBLinkOra option is not applicable to PostgreSQL subscription tables.
Note: Prior to using dblink_ora with xDB Replication Server, there are a number of required configuration steps that must be performed in Advanced Server. For Advanced Server versions 9.3 or earlier, see the readme text file, README-dblink_ora_setup.txt located in the POSTGRES_INSTALL_HOME/doc/contrib directory for directions. For Advanced Server versions 9.4 or later, see Chapter dblink_ora in the Database Compatibility for Oracle Developer’s Guide for directions.
Set the useFastCopy option to true to skip Write-Ahead Log (WAL) logging during COPY operations in order to optimize data transfer speed.
The archive_mode configuration parameter in the postgresql.conf file of the target Postgres database server must be off (thereby disabling archiving of WAL data) in order to use the useFastCopy option.
Use the cpBatchSize option to set the batch size (in Megabytes) that is used in the JDBC COPY operation during a snapshot. Increase the value of this option for large publication tables.
This option is influential when Postgres is the subscription database since the JDBC COPY operation is used to load Postgres subscription tables.
The batchSize option controls the number of INSERT statements in a JDBC batch.
For a Postgres subscription database, tables are loaded using JDBC COPY, however, if the COPY operation fails for some reason, then table loading is retried using JDBC batches of INSERT statements as in the case of Oracle and SQL Server.
Set the skipAnalyze option to true if you want to skip execution of the ANALYZE command after loading Postgres subscription tables. The ANALYZE command gathers statistical information on the table contents. These statistics are used by the query planner.
Note: To apply this option to a single-master replication system, it must be set for the subscription server within the subscription server configuration file. To apply this option to a multi-master replication system, it must be set for the publication server within the publication server configuration file.
The snapshotParallelLoadCount option controls the number of threads used to perform snapshot data replication in parallel mode. The default behavior is to use a single thread. However, if the target system architecture contains multi-CPUs/cores you can specify a value greater than 1, normally equal to the CPU/core count, to fully utilize the system resources.
If a table contains a column with a data type typically used for large objects such as BYTEA, BLOB, or CLOB, there is a greater possibility that a heap space error may occur because of a potentially large amount of data (hundreds of megabytes) brought into memory. In order to minimize the possibility of this error, a snapshot replication loads tables containing a large object data type, one row at a time using a single INSERT statement per batch.
Note: The options described in this section apply to the publication server only and are set in the publication server configuration file.
When synchronization replication occurs, the changes recorded in the shadow tables are applied to the subscription tables in JDBC batch updates. Within each batch, changes may be applied using either an individual SQL statement for each change; or a set of changes may be applied using a single, prepared SQL statement. A prepared SQL statement is parsed and compiled only once, but it can be executed multiple times using different values for certain components of the SQL statement in each execution. A SQL statement that is not prepared is parsed, compiled, and executed only once.
Prepared statements are useful only if the same type of SQL statement (INSERT, UPDATE or DELETE) is executed repeatedly and consecutively with the same target table, but with different values. If there is a sequence of consecutive changes that occur to the same table using the same operation such as inserting a set of rows into the same table populating the same columns, the publication server may apply these changes using a prepared statement. Otherwise, each change is applied with its own individual SQL statement.
The defaultBatchUpdateMode option controls whether the default mode is to use individual SQL statements in the JDBC batch update (this mode of operation is referred to as BUS) or to use prepared SQL statements in the JDBC batch update (this mode of operation is referred to as BUP).
The switchBatchUpdateMode option controls whether or not the publication server dynamically switches between BUS mode and BUP mode during the replication process depending upon the type and sequence of updates it encounters in the shadow tables for the trigger-based method or the changeset stream for the log-based method.
This means using the default settings of defaultBatchUpdateMode=BUS and switchBatchUpdateMode=true, the publication server starts out by applying updates with individual SQL statements. When it encounters a stream of consecutive changes that can all be processed in a single prepared statement, it will switch to using prepared SQL statements.
Note: If you want a certain batch update mode used throughout all synchronization replications applied by a given publication server without switching update modes, set the defaultBatchUpdateMode option to the desired mode in combination with switchBatchUpdateMode=false. For example, if you only want prepared statements used, set the following options:
Note: When Oracle is the subscription database, synchronization replication always occurs in BUP mode as if the preceding two options were always set. The reason for this is so large columns of TEXT data type from Postgres publications can successfully replicate to Oracle CLOB columns. In BUS mode an individual Oracle SQL statement has a string literal maximum length of 4000 characters. This limitation does not occur for prepared SQL statements that are used in BUP mode.
The busBatchThresholdCount option sets the number of consecutive updates of the same type that must be encountered in the shadow tables for the trigger-based method or the changeset stream for the log-based method before the publication server switches from BUS mode to BUP mode if dynamic switching is permitted (that is switchBatchUpdateMode=true).
If changes to the publication were made using many SQL statements where each statement affected more than one row, then it may be beneficial to lower busBatchThresholdCount to encourage the use of prepared statements on the multiple shadow table rows resulting from each individual change on the publication.
The bupBatchThresholdCount option is used in combination with the bupBatchThresholdRepeatLimit option to control the frequency of mode switches based on the volatility of expected update types to the publication.
Each time the same prepared SQL statement is consecutively executed, an internal “batch” counter is incremented. If this batch count falls below bupBatchThresholdCount for the number of executions of a given prepared statement, then a second internal “repeat” counter is incremented by one. If the repeat counter eventually reaches bupBatchThresholdRepeatLimit, the update mode is switched from BUP to BUS.
Thus, if there are frequent, consecutive changes of prepared SQL statements (as measured against bupBatchThresholdRepeatLimit), each of which is executed a small number of times (as measured against bupBatchThresholdCount), then the mode of execution changes back to individual SQL statements instead of prepared statements.
Note: The publication server changes back to prepared statements when the threshold set by busBatchThresholdCount is met.
The following example illustrates the processing of updates when bupBatchThresholdCount is set to 3 and bupBatchThresholdRepeatLimit is set to 4. A change to the “query domain” referred to in this example means a different statement type (INSERT, UPDATE, or DELETE) or a different target table are encountered in the next update, thus requiring the use of a different prepared SQL statement.
At this point the query domain is changed after the first two updates (change from table emp to dept) and the number of executions of the prior prepared statement (2) is less than bupBatchThresholdCount, so the repeat counter is set to 1.
The query domain is changed again (change from table dept to emp), but this time the number of executions (4) for the same query domain (updates 3 thru 6) exceeds bupBatchThresholdCount so the repeat counter is reset to 0.
The query domain is changed again (INSERT statement to UPDATE statement) and the number of executions (2) is less than bupBatchThresholdCount, so the repeat counter is incremented to 1.
Parallel synchronization takes advantage of multi-CPUs or cores in the system architecture by using multiple threads to apply transaction sets in parallel.
The syncLoadThreadLimit option controls the maximum number of threads used to load data from source publication tables during parallel synchronization. The default count is 4. However, depending on the target system architecture (specifically, multi-CPUs/cores) you can choose to specify a custom count, normally equal to the CPU/core count, to fully utilize the system resources.
The dataSyncThreadCount option controls the maximum number of threads used to apply incremental changes during synchronization replication to the target slave databases (for single-master replication systems) or to the target master nodes (for multi-master replication systems) in parallel mode. The default behavior (when dataSyncThreadCount is set to 0) is to use as many threads as there are target nodes.
The targetDBQueryTimeout option controls the timeout interval (in milliseconds) before an attempt by the publication server to apply a transaction set on a target database is aborted by the database server (typically due to a lock acquired by another application on one or more of the target tables).
The targetDBQueryTimeout option sets the default lock timeout value to 10 minutes. Change the 10 minute default value to a higher value if you want to allow a longer wait time before the transaction is aborted. Change the value to 0 if you want to turn off usage of the targetDBQueryTimeout option in which case the timeout interval is controlled by the setting of the Postgres database server statement_timeout configuration parameter.
A higher value of targetDBQueryTimeout delays processing of subsequent transaction sets on other target databases because if a transaction set is blocked, the next transaction set cannot be loaded until: 1) the lock is released and the blocked transaction set can then be applied to completion, or 2) the targetDBQueryTimeout interval is exceeded.
The syncBatchSize option controls the number of statements in a synchronization replication JDBC batch.
The syncFetchSize option controls how many rows are fetched from the publication database in one network round-trip. For example, if there are 1000 pending row changes, the default fetch size requires 5 database round-trips. Using a fetch size of 500 retrieves all changes in 2 round trips.
The txSetMaxSize option defines the maximum number of transactional rows that can be grouped in a single transaction set. The publication server loads and processes the changes by fetching as many rows in memory as grouped in a single transaction set.
Set enablePerformanceStats option to true only if you need to conduct performance testing and analyze the replication statistics. When enabled, the publication server creates additional triggers on the publication tables in each master node. The triggers produce transaction statistics that are recorded in the mmr_transaction_history table in the control schema. This option should be disabled in a production environment to avoid performance overhead.
•
wal_level. Set to logical.
•
max_wal_senders. Specifies the maximum number of concurrent connections (that is, the maximum number of simultaneously running WAL sender processes). Set at minimum, to the number of MMR master nodes on this database server that will use the log-based method. In addition, if SMR publication databases are to run on this database server, also add the number of SMR publication databases that will use the log-based method.
•
max_replication_slots. Specifies the maximum number of replication slots. For support of MMR systems, the minimum is the total number of master nodes in the multi-master replication system multiplied by the number of master nodes residing on this database server. For information, see Section 2.2.10.4. In addition, if SMR publication databases are to run on this database server, also add the number of SMR publication databases that will use the log-based method.
•
track_commit_timestamp. Set to on. This configuration parameter applies only to Postgres database servers of version 9.5. See Section 6.6.1 for additional information.
See Section 2.2.10 for information on the log-based method of synchronization replication.
In addition, the pg_hba.conf file requires an entry for each publication database user of master nodes that are to use the log-based method. Such database users must be included as a replication database user in the pg_hba.conf file. See Section 6.1.5 for additional information.
•
The database user has superuser privileges. Superuser privileges are required because the database configuration parameter session_replication_role is altered by the database user when the master definition node receives updates from other master nodes during a synchronization replication. The database user temporarily changes session_replication_role to replica to prevent the triggers on the publication tables from firing. This session change also occurs for snapshot operations involving replication of the control schema from one publication database to another.
•
Three tables named dept, emp, and jobhist are members of schema edb.
Step 1: Create a user name with login and superuser privileges for the master definition node. This user becomes the owner of xDB Replication Server metadata database objects that will be created in the master definition node to track, control, and record the replication process and history. The xDB Replication Server metadata database objects are created in a schema named _edb_replicator_pub.
Step 2 (Optional): If users are to access the data in the publication tables residing on this master node, it is convenient to have one or more “group” roles containing the required privileges to access these tables. Privileges must also be granted on the control schema objects to users who are to perform inserts, updates, or deletions on the publication tables.
See Step 2 of Section 5.1.4.3 for information on creating such roles.
•
The database user has superuser privileges. Superuser privileges are required because the database configuration parameter session_replication_role is altered by the database user when the master node receives updates from other master nodes during a synchronization replication. The database user temporarily changes session_replication_role to replica to prevent the triggers on the publication tables from firing. This session change also occurs for snapshot operations involving replication of the control schema from one publication database to another.
Step 1: Create a database user name for the master node. This user becomes the owner of xDB Replication Server metadata database objects that will be created in the master node to track, control, and record the replication process and history. The xDB Replication Server metadata database objects are created in a schema named _edb_replicator_pub.
Step 2: Create a database that will be used as the master node if such a database does not already exist.
A Postgres database server uses the host-based authentication file, pg_hba.conf, to control access to the databases in the database server.
You need to modify the pg_hba.conf file on each Postgres database server that contains a master node.
The modification needed to the pg_hba.conf file is discussed in the following section.
host masternode_db masternode_user pub_ipaddr/32 md5
The value you substitute for masternode_db is the name of the database you intend to use as the master node. The value you substitute for masternode_user is the database user name you created in Step 1 of Section 6.1.3 or Step 1 of Section 6.1.4.
For two master nodes using databases named edb and mmrnode running on the same database server, the resulting pg_hba.conf file appears as follows:
If the master node using database mmrnode with database user name mmruser is running on a separate host than where database edb is running, the pg_hba.conf file on the database server with database mmrnode would look like the following:
The preceding examples assume databases edb and mmrnode are using the trigger-based method of synchronization replication. If the log-based method is used, the pg_hba.conf file must contain additional entries with the DATABASE field set to replication for masternode_user and pub_ipaddr to allow replication connections from the publication server on the host on which it is running.
See sections 2.2.10 and 6.1.2 for additional information on synchronization replication with the log-based method.
Step 1: Make sure the database server for the master definition node is running and accepting client connections.
Step 2: Select the MMR type node under the Publication Server node. From the Publication menu, choose Publication Database, and then choose Add Database. Alternatively, click the secondary mouse button on the MMR type node and choose Add Database. The Publication Service – Add Database dialog box appears.
Step 3: Fill in the following fields:
•
Database Type. Select PostgreSQL or Postgres Plus Advanced Server for the master definition node. For an Advanced Server Oracle compatible installation, select the Postgres Plus Advanced Server option. For PostgreSQL or an Advanced Server PostgreSQL compatible installation, select the PostgreSQL option.
•
Host. IP address of the host on which the master definition node is running.
•
Port. Port on which the master definition node is listening for connections.
•
User. The database user name for the master definition node created in Step 1 of Section 6.1.3.
•
Password. Password of the database user.
•
Database. Enter the database name of the master definition node.
•
URL Options (For SSL connectivity). Enter the URL options to establish SSL connectivity to the master definition node. See Section 7.11 for information on using SSL connections.
•
Changeset Logging (For Postgres). Select Table Triggers to use the trigger-based method of synchronization replication. Select WAL Stream to use the log-based method of synchronization replication. See Section 2.2.9 for information on the trigger-based method. See Section 2.2.10 for information on the log-based method.
•
Node Priority Level. An integer from 1 to 10, which is the priority level assigned to this master node for conflict resolution based on node priority. The highest priority is 1 while the lowest is 10. See Section 6.6.4 for information on conflict resolution strategies. The default is 1 for the master definition node.
Step 4: Click the Test button. If Test Result: Success appears, click the OK button, then click the Save button.
The label MDN appears at the end of the node in the replication tree and in addition, the MDN field is set to Yes in the Property window to indicate this is the master definition node.
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.
•
Publish. Check the boxes next to the tables that are to be included in the publication. 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 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 Section 7.1 for information on the wildcard selector.
Step 3 (Optional): Table filters consist of a set of filter rules that control the selection criteria for rows replicated between master nodes during a snapshot or a synchronization replication.
Note: See Section 2.2.12.3 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 that defines the selection criteria for rows that are to be included during a replication.
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.
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.
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.
Note: To enable table filters on the master definition node under which you are currently creating the publication, you must first switch the role of the master definition node to a different master node (see Section 6.10), and then follow the directions in Section 6.9 to enable the table filters.
Step 4 (Optional): If you want to modify or see the current conflict resolution options, click the Conflict Resolution Options tab. For each table, you can select the primary conflict resolution strategy and a standby strategy by clicking the primary mouse button over the appropriate box to expose a drop-down list of choices.
•
Earliest Timestamp. The conflicting change with the earliest timestamp is accepted and replicated to all other master nodes. All other conflicting changes are discarded.
•
Latest Timestamp. The conflicting change with the latest timestamp is accepted and replicated to all other master nodes. All other conflicting changes are discarded.
•
Node Priority. The conflicting change occurring on the master node with the highest priority level is accepted and replicated to all other master nodes. All other conflicting changes are discarded.
•
Custom. Update/update conflicts are resolved with a PL/pgSQL custom conflict handling program.
•
Manual. The conflict remains unresolved. Conflicting changes remain applied in each master node where they originated, but are not replicated to other master nodes. The proper adjustments must be manually applied in each master node.
See Section 6.6.4 for more information on conflict resolution strategies.
Step 5: If you expect update/update conflicts, then set the REPLICA IDENTITY option to FULL on those tables where the conflicts are expected to occur. See Section 6.6.1 for additional information.
Step 6: Click the Create button. If Publication Created Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.
Step 1: Make sure the database server for the master definition node is running and accepting client connections.
Step 2: Select the MMR type node under the same Publication Server node that contains the master definition node. From the Publication menu, choose Publication Database, and then choose Add Database. Alternatively, click the secondary mouse button on the MMR type node and choose Add Database. The Publication Service – Add Database dialog box appears.
Step 3: Fill in the following fields:
•
Database Type. Select PostgreSQL or Postgres Plus Advanced Server for the master node. For an Advanced Server Oracle compatible installation, select the Postgres Plus Advanced Server option. For PostgreSQL or an Advanced Server PostgreSQL compatible installation, select the PostgreSQL option.
•
Host. IP address of the host on which the master node is running.
•
Port. Port on which the master node is listening for connections.
•
User. The database user name for the master node created in Step 1 of Section 6.1.4.
•
Password. Password of the database user.
•
Database. Enter the database name of the master node.
•
URL Options (For SSL connectivity). Enter the URL options to establish SSL connectivity to the master node. See Section 7.11 for information on using SSL connections.
•
Changeset Logging (For Postgres). This setting is predetermined by the selection on the master definition node (see Section 6.2.2). Table Triggers is for the trigger-based method of synchronization replication. WAL Stream is for the log-based method of synchronization replication. See Section 2.2.9 for information on the trigger-based method. See Section 2.2.10 for information on the log-based method.
•
Node Priority Level. An integer from 1 to 10, which is the priority level assigned to this master node for conflict resolution based on node priority. The highest priority is 1 while the lowest is 10. See Section 6.6.4 for information on conflict resolution strategies. As each additional master node is added, the default priority level number increases assigning a lower priority level to each additional node.
•
Replicate Publication Schema. Check this box if you want the publication server to create the publication table definitions in the new master node by copying the definitions from the master definition node. If you do not check this box, it is assumed that you have already created the table definitions in the master node. If you are using the offline snapshot technique to create this master node, do not check this box. See Section 7.9 for information on using an offline snapshot.
•
Perform Initial Snapshot. Check this box if you want the publication server to perform a snapshot from the master definition node to this master node when you click the Save button. If you do not check this box, the tables on the master node will not be loaded until you perform a replication at some later time. If you are using the offline snapshot technique to create this master node, you should have already loaded the table rows. Therefore do not check this box unless you want to reload the data. See Section 7.9 for information on using an offline snapshot.
Note: Unless you intend to use the offline snapshot technique (see Section 7.9), it is suggested that you check the Perform Initial Snapshot box. An initial snapshot replication must be performed from the master definition node to every other master node before performing synchronization replications on demand (see Section 6.5.2) or by a schedule (see Section 7.2). If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that master node. The initial snapshot can also be taken by performing an on demand snapshot (see Section 6.5.1).
Step 4: Click the Test button. If Test Result: Success appears, click the OK button.
Step 5 (Optional): If you defined a set of available table filters for the publication, you have the option of enabling these filters on this master node. See Section 6.2.3 for instructions on defining table filters. If you do not wish to filter the rows that are replicated to this master node, go to Step 6.
Note: See Section 2.2.12.3 for table setup requirements for a log-based replication system as well as general restrictions on the use of table filters.
In the following example the filter named dept_10_20_30 is enabled on the dept table and the filter named dept_30 is enabled on the emp table of this master node.
Step 6: Check the Perform Initial Snapshot box if you want the publication server to perform a snapshot from the master definition node to this master node when you click the Save button. If you do not check this box, the tables on the master node will not be loaded until you perform a replication at some later time.
Unlike the master definition node, the label MDN does not appear at the end of the node in the replication tree. The MDN field is set to No in the Property window to indicate this is not the master definition node.
Step 7: If you expect update/update conflicts, then set the REPLICA IDENTITY option to FULL on those tables where the conflicts are expected to occur. See Section 6.6.1 for additional information.
Step 8 (Optional): If users are to access the data in the publication tables residing on this master node, it is convenient to have one or more “group” roles containing the required privileges to access these tables. For the trigger-based method, privileges must also be granted on the control schema objects to users who are to perform inserts, updates, or deletions on the publication tables. When using the log-based method a user needs access to the publication tables and to certain control schema objects as well under certain circumstances.
See Section 5.2.4 for the control schema objects created in each master node.
Step 1: Select the Publication node under the master node for which you wish to perform snapshot replication.
Step 2: Open the Snapshot dialog box in any of the following ways:
Step 3: Select the Verbose Output check box only if you want to display the output from the snapshot in the dialog box. This option should be left unchecked in a network address translation (NAT) environment as a large amount of output from the snapshot may delay the response from the Snapshot dialog box. Click the Snapshot button to start snapshot replication.
Step 4: Snapshot Taken Successfully appears if the snapshot was successful. Click the OK button. If the snapshot was not successful, scroll through the messages in the Snapshot dialog box window if Verbose Output was selected or check the log files.
The status messages of each snapshot are saved in the Migration Toolkit log files named mtk.log[.n] (where [.n] is an optional history file count if log file rotation is enabled) in the following directories:
POSTGRES_HOME\.enterprisedb\xdb\x.x
POSTGRES_HOME is the home directory of the Windows postgres account (enterprisedb account for Advanced Server installed in Oracle compatible configuration mode). The specific location of POSTGRES_HOME is dependent upon your version of Windows. The xDB Replication Server version number is represented by x.x.
Note: Be sure an initial snapshot replication has been performed from the master definition node to every other master node in the multi-master replication system. If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that master node. The initial snapshot could be taken when the master node is first added (see Section 6.3) or by performing an on demand snapshot (see Section 6.5.1).
There may be circumstances where changes made on different nodes result in conflicts. Section 6.6 discusses the types of conflicts that may occur and how they can be resolved.
Step 1: Select the Publication node under any master node. Regardless of the master node chosen, synchronization is applied to every master node pair in the replication system.
Step 2: Open the Synchronize dialog box in any of the following ways:
Step 3: Click the Synchronize button to start synchronization replication.
Step 4: Publication Synchronized Successfully appears if the synchronization was successful. Click the OK button. If the synchronization was not successful, an error message is displayed.
Conflict resolution deals with the topic of the types of conflicts that might occur, the strategies for dealing with conflicts, and the options available for automatically resolving such conflicts.
•
track_commit_timestamp. Any Postgres 9.5 database server containing a master node must have its track_commit_timestamp configuration parameter enabled. The track_commit_timestamp parameter is located in the postgresql.conf file. If track_commit_timestamp is not enabled, then update/update conflicts are not automatically resolved such as by using the earliest timestamp of the conflicting transactions. As a result, these conflicting transactions are left in a pending state. See Section 6.6.7 for an example of how update/update conflicts are automatically resolved.
•
REPLICA IDENTITY FULL. If update/update conflicts are expected to occur on a given publication table, then the REPLICA IDENTITY setting for the table must be set to FULL on every master node. The case where update transactions occur on separate master nodes, but updating different columns in the same row, is not considered an update/update conflict. However, if REPLICA IDENTITY is not set to FULL, then this case will be recorded as an update/update conflict.
The REPLICA IDENTITY option is set to FULL using the ALTER TABLE command as shown by the following:
ALTER TABLE schema.table_name REPLICA IDENTITY FULL
The REPLICA IDENTITY setting can be displayed by the PSQL utility using the \d+ command:
Note: In addition to conflict resolution requirements, the REPLICA IDENTITY FULL setting may be required on publication tables for other reasons in xDB Replication Server. See Section 2.2.12.3 for additional requirements.
•
Uniqueness Conflict. A uniqueness conflict occurs when the same value is used for a primary key or unique column in an insert transaction on two or more master nodes. This is also referred to as an insert/insert conflict.
•
Update Conflict. An update transaction modifies a column value in the same row on two or more master nodes. For example, an employee address column is updated on master node A, and another user updates the address column for the same employee on master node B. The timestamps of when the transactions occur on each node could be different, but both transactions occur in a time interval during which synchronization has not yet occurred. Thus when synchronization does take place, both conflicting transactions are to be applied. This is also referred to as an update/update conflict.
•
Delete Conflict. The row corresponding to an update transaction on the source node is not found on the target node as the row has already been deleted on the target node. This is referred to as an update/delete conflict. Conversely, if there is a delete transaction on the source node and an update transaction for the same row on the target node, this case is referred to as a delete/update conflict. Finally, in the case where the row corresponding to a delete transaction on the source node is not found on the target node as the row has already been deleted on the target node is referred to as a delete/delete conflict.
Node A: INSERT INTO addrbook (name, address) VALUES ('A', 'ADDR A');
Node A: INSERT INTO addrbook (name, address) VALUES ('B', 'ADDR B');
Node B: INSERT INTO addrbook (name, address) VALUES ('C', 'ADDR C');
id = 1, name = 'C', address = 'ADDR C'
Node A: UPDATE addrbook SET address = 'ADDR B1' WHERE id = 2;
Node B: UPDATE addrbook SET address = 'ADDR B2' WHERE id = 2;
Node A: UPDATE addrbook SET address = 'ADDR B1' WHERE id = 2;
Node B: DELETE FROM addrbook WHERE id = 2;
Row with id = 2 deleted
The row with id = 2 is already deleted on target Node B, hence update from Node A fails.
•
If no conflict is detected, the transactional change is replicated to the target master node and the transaction status for that target node is marked as completed in the source master node control schema. A transaction status mapping for each target master node is maintained on all master nodes. For example node A contains two mappings of status – one for node B and another for node C.
•
Earliest Timestamp. When the earliest timestamp option is selected, the relevant rows involved in an update conflict from the source and target master nodes are compared based on the timestamp of when the update occurred on that particular node. The row change that occurred earliest is applied. The row changes with the later timestamps are discarded.
•
Latest Timestamp. Same approach as earliest timestamp except the row change with the latest timestamp is accepted. The row changes with earlier timestamps are discarded.
•
Node Priority. The row change of the master node with the highest node priority level is applied while the lower priority level master node changes are discarded. The node priority level is an integer in the range of 1 to 10, inclusive where 1 is the highest priority level and 10 is the lowest priority level.
•
Custom. Custom conflict handling applies to update/update conflicts only. You must supply a PL/pgSQL program to resolve any conflicts that occur resulting from an update/update conflict. See Section 6.6.8 for information on using custom conflict handling.
•
Node specific sequence range. A sequence range is reserved for each master node. For example, master node A would have MINVALUE = 1 and MAXVALUE = 1000, master node B would have MINVALUE = 1001 and MAXVALUE = 2000, and so on for other nodes. This ensures that a unique ID is always generated across all master nodes.
•
Start value variation. Each node is assigned a different start value. For example, master node A would have a START value of 1, node B would have 2, and node C would have 3. An increment greater than or equal to the number of nodes guarantees unique IDs as shown in Table 6‑4.
•
Common sequence. All nodes share a common sequence object, however this has the major disadvantage of slowing down transaction processing due to network round-trips associated with each ID generation.
•
MMR-ready sequence. This is a technique that enhances the use of sequences and provides a more flexible, reliable approach for a distributed, multiple database architecture as is inherent in a multi-master replication system. This approach is recommended over the previously listed sequence techniques. See Section 6.6.6 for information on an MMR-ready sequence.
To prevent uniqueness conflicts in a multi-master replication system, an MMR-ready sequence can be used to generate unique identifiers for each row of publication tables that do not have an inherent, unique identifier.
An MMR-ready sequence incorporates a function and a sequence to return BIGINT data type, integer values. These values combine a user-assigned, unique database identifier for each master node with a sequence generated within that master node.
A publication table requiring an MMR-ready sequence can be altered to include a BIGINT NOT NULL column with a default value returned by the function.
•
Uniqueness. The combination of the unique, database identifier with the sequence ensures that each row in a given table will have a unique value across all master nodes.
•
Clustered index support. An MMR-ready sequence does not impair the usage of a clustered index to provide retrieval efficiency. MMR-ready sequence values are returned in a typical, ordered sequence – not as random values such as if the universally unique identifier (UUID) were used.
•
Effective migration support. Tables already utilizing a sequence can be modified to use an MMR-ready sequence with minimal impact on existing primary keys and foreign keys.
•
Reliability and maintainability. In summary, an MMR-ready sequence provides a reliable and maintainable method to avoid uniqueness conflicts.
Step 1: Assign a unique, database identifier as an integer from 1 to 1024, inclusive. Thus, a maximum of 1024 databases can be uniquely identified in a multi-master replication system with an MMR-ready sequence.
ALTER DATABASE dbname SET cluster.unique_db_id TO db_id;
Use a different db_id value for each database.
Step 2: Create a sequence to uniquely identify each table row within the database.
CREATE SEQUENCE seq_name START WITH 1 INCREMENT BY 1 NO CYCLE;
A publication table column that uses an MMR-ready sequence will include a DEFAULT clause referencing the sequence name in a function call. The publication table definition must be consistent across all master nodes by referencing the same sequence name in the function call.
Step 3: Create the following function that returns the next MMR-ready sequence value when a row is inserted into the table. This function is referenced by the DEFAULT clause of the publication table column.
The sequence name created in Step 2 is specified as the seq_id input argument when the function is added to the DEFAULT clause of the publication table column.
This function performs a bitwise shift left operation (<< 52) on the database identifier (cluster.unique_db_id), thus significantly increasing its numeric value. The next sequence value is then added to this number. Thus, all rows inserted in the table on a given database fall within a numeric range determined by the shifted, database identifier value.
Step 4 (Optional): Create the following function to obtain the current MMR-ready sequence value.
The mmr_sequence_nextval function must be invoked in the current session before calling the mmr_sequence_currval function.
Step 5: Add or modify the publication table column that is to use the MMR-ready sequence. The column data type must be BIGINT. The mmr_sequence_nextval function is specified in the DEFAULT clause as shown in the following example for column id.
CREATE TABLE table_name (
Step 6: Repeat steps 1 through 4 for the other databases to be added as master nodes.
Step 7: Create the complete, multi-master replication system as described in Chapter 6.
The following is an example of a 3-master node system using an MMR-ready sequence. The databases to be used as the master nodes are mmrnode_a, mmrnode_b, and mmrnode_c. A publication table named mmr_seq_tbl uses the MMR-ready sequence.
The following commands are invoked in database mmrnode_a, which will be the master definition node:
On mmrnode_b and mmrnode_c, the commands to create different settings for the configuration parameter cluster.unique_db_id are run as well as the commands to create the sequence and the functions.
On mmrnode_b the following commands are invoked. Note that cluster.unique_db_id is set to 2.
On mmrnode_c the following commands are invoked. Note that cluster.unique_db_id is set to 3.
The following INSERT commands are invoked on mmrnode_a:
The following INSERT commands are invoked on mmrnode_b:
The following INSERT commands are invoked on mmrnode_c:
No uniqueness conflicts occur as a unique value is generated for the id primary key column as shown by the following results on mmrnode_a:
The same query on mmrnode_b shows the same set of rows:
If you have an existing application with tables that use a standard sequence such as with the SERIAL data type, these tables can be modified to use the MMR-ready sequence for incorporation into a multi-master replication system.
•
Alter the column definition to be compatible with the MMR-ready sequence including modification or addition of the DEFAULT clause to use the MMR-ready sequence function to supply the default values for subsequent inserts.
The function input and return arguments are data type BIGINT so the existing sequence columns must be altered accordingly before using the function.
Finally, the sequence columns must include the clauses BIGINT NOT NULL DEFAULT mmr_sequence_nextval('seq_name') to supply MMR-ready sequence values for future inserts.
See Section 6.6.6.1 for information on creating the objects required for an MMR-ready sequence.
Note the foreign key constraint between columns mmr_seq_child_tbl.parent_id and mmr_seq_tbl.id.
In order to convert the existing sequence values in columns mmr_seq_tbl.id, mmr_seq_child_tbl.id, and mmr_seq_child_tbl.parent_id the following steps are performed.
Change the sequence columns to data type BIGINT so they are large enough for the MMR-ready sequence.
The parent-child foreign key relationship between columns mmr_seq_child_tbl.parent_id and mmr_seq_tbl.id is maintained.
The primary key id values incorporate the old sequence values, but are increased by the addition of the 52-bit shifted, database identifier value.
The steps as described in Section 6.6.6.1 are now performed on the databases to be used as master nodes.
For database mmrnode_a that contains the converted tables, a new sequence is created with a starting value of 7 to avoid a primary key uniqueness conflict with the existing rows. In the original tables, the maximum used sequence value was 6.
The multi-master replication system is created using databases mmrnode_a, mmrnode_b, and mmrnode_c in a similar manner as described in Section 6.6.6.2.
After the system is created with the initial snapshot, mmrnode_a, mmrnode_b, and mmrnode_c all contain identical content. The following is the table content:
Content of mmrnode_a after synchronization:
Content of mmrnode_b after synchronization:
Content of mmrnode_c after synchronization:
Node A: UPDATE addrbook SET address = 'ADDR A' WHERE id = 2;
Node C: UPDATE addrbook SET address = 'ADDR C' WHERE id = 2;
Synchronization pushes Node A changes to Node C. Current address on Node C <> old value on Node A ('ADDR C' <> 'ADDR') hence conflict detected. Latest change on Node C accepted and Node A change discarded.
First, the following UPDATE statement is given in the master definition node:
Note that the original value, OPERATIONS, of column dname is the same as the value to which it is changed in the UPDATE statement.
The following UPDATE statement is then given in a second master node:
However the value of column dname in the second master node remains set to LOGISTICS. It was not reverted back to the value OPERATIONS from the master definition node as would normally be expected on a conflicting column. Note that as expected, the value in column loc is reverted from CAMBRIDGE back to the master definition node value of BEDFORD.
A column is considered a conflicting column if it is updated on more than one master node in the same synchronization. Even if the new, updated value for the column is identical in the conflicting update transactions, the fact that the same column was updated on more than one master node makes it a conflicting column.
•
Columns are to be set to the source node. When the resolution_code parameter of the function is set to a value of 1, the resultant setting of all columns in both conflicting nodes is obtained from the source node of the replication.
•
Columns are to be set to the target node. When the resolution_code parameter of the function is set to a value of 2, the resultant setting of all columns in both conflicting nodes is obtained from the target node of the replication.
•
The function logic sets the column. When the resolution_code parameter of the function is set to a value of 3, the resultant setting of the first conflicting column is obtained from the value returned in the source parameter coded within the function logic. The resultant setting of all other column values is obtained from the source node of the replication.
If the multi-master replication system is configured with the log-based method of synchronization replication the shadow tables of the INOUT source and IN target parameters are replaced with the actual publication tables as shown by the following:
INOUT parameter of the record type of the shadow table in schema _edb_replicator_pub of the master definition node on which conflicts are to be resolved. If the log-based method of synchronization replication is used, specify the actual publication table instead of the shadow table. The input values are the column values from the source node. When resolution_code is set to a value of 3, set the columns in this parameter to the values that are to be used for the final outcome.
IN parameter of the record type of the shadow table in schema _edb_replicator_pub of the master definition node on which conflicts are to be resolved. If the log-based method of synchronization replication is used, specify the actual publication table instead of the shadow table. The input values are the column values from the target node.
IN parameter of type VARCHAR(255) containing the name of the column on which the update/update conflict has occurred. If more than one column is involved in the conflict, the name of the first conflicting column is returned.
OUT parameter of type VARCHAR(255) containing any informative message to be written to the publication server log file. The publication server configuration option logging.level must be set to at least the INFO level in order for the messages to appear in the publication server log file. See Section 3.5 for the location of the publication server log file.
OUT parameter of type INTEGER that you set to one of the following values to determine how to resolve the conflict: 1 to use the column values of the source node of the replication for the final outcome, 2 to use the column values of the target node of the replication for the final outcome, or 3 to use the value set for the source INOUT parameter of the first conflicting column as the final outcome for that column.
Step 1: The publication under the master definition node must exist before adding the function to the master definition node. See Section 6.2.3 for information on creating the publication.
Step 2: Add the function to the master definition node. The following example shows the addition of the function using PSQL.
Step 3: Open the Conflict Resolution Options tab in any of the following ways:
Step 4: For the table on which you want to use custom conflict handling, select Custom from the appropriate drop-down list. In the Custom Handler text box, enter the schema and function name used in the CREATE FUNCTION statement.
Step 5: Click the Update button, and then click OK in response to the Conflict Resolution Options Updated Successfully confirmation message.
Note: If the multi-master replication system uses custom conflict handling, and you subsequently switch the role of the master definition node to another master node, you must re-add the functions to the new master definition node. That is, you must repeat Step 2 on the new master definition node.
Note: If you wish to delete the multi-master replication system, before removing the publication you must drop all custom conflict handling functions from the master definition node.
The following example shows the effect of custom conflict handling using the custom conflict handling function named custom_conflict_dept shown in Section 6.6.8.1. This function sets the target node as the winner of update/update conflicts on the dept table.
In the source master node the loc column of department 50 loses the value set in its UPDATE statement. The column is reset to the value from the target master node.
In the target master node the loc column of department 50 retains the value set from its UPDATE statement.
The target node wins the conflict as determined by the setting of the resolution_code parameter to a value of 2 in the custom conflict handling function.
The following example shows the effect of custom conflict handling using the custom conflict handling function named custom_conflict_emp shown in Section 6.6.8.1. This function sets values coded in the function as the winner of update/update conflicts on the emp table.
The following is the row from the emp table prior to the update:
After the synchronization replication the master node, edb, contains the following values for the conflicting row:
After the synchronization replication the master node, mmrnode, contains the following values for the conflicting row:
Note: As this custom conflict handling function uses a column (rrep_old_quantity in this example) that is a column of the shadow table and not of the actual publication table, this particular solution cannot be used for a publication using the log-based method of synchronization replication.
The following example uses master definition node, edb, and a second master node, mmrnode. Initially, the inventory table has the same contents on both master nodes.
For an update transaction, the shadow table contains the column values before the update was made on the publication table (columns with names rrep_old_column_name) and the values after the update was applied (columns named identically to the publication table column names).
The custom conflict handling function uses both the current and old values of the quantity columns from the source and target shadow tables as shown by the following.
Assume two items with item_id of 1 are purchased on the master definition node:
Also assume one item with item_id of 1 is purchased from the second master node:
After the synchronization replication and invocation of the custom conflict handling function, the quantity column for item_id 1 is correctly set to 47 in both master nodes:
Note: The manual conflict resolution discussion in this section applies only to multi-master replication systems configured with the trigger-based method of synchronization replication. See Section 6.6.10 for information on manual conflict resolution for multi-master replication systems configured with the log-based method of synchronization replication.
As discussed in Section 6.6.5 there is no built-in, automatic conflict resolution strategy for the uniqueness (insert/insert) conflict. If a uniqueness conflict occurs, then you must modify rows in the publication tables containing the conflict as well as modify rows in the control schema tables in the master nodes to resolve the conflict.
•
Finding Conflicts. Locating unresolved conflicts
•
Conflict Resolution Preparation. Helpful setup steps to aid in the manual conflict resolution process
•
Overview of Correction Strategies. Overview of the methods you can use to perform the corrections
•
Manual Publication Table Correction. Manual correction of the publication tables
•
Correction Using New Transactions. Using new transactions to bring all master nodes to a consistent state
•
Correction Using Shadow Table Transactions. Using existing shadow table transactions to bring all master nodes to a consistent state
Conflicts can be found using the Conflict History tab as described in Section 6.7. The following is an example of the Conflict History tab. Click the Refresh button to reveal all of the latest conflicts.
To prevent the triggers on the publication tables from firing, during the session in which you modify the publication table rows, the database server configuration parameter session_replication_role must be set to a value of replica. (The default setting of session_replication_role is origin in which case the triggers will fire.)
The suggested method to ensure the replica setting is in effect is to create a database user with a default session setting of replica for this parameter. Whenever you connect to a database with this database user, the replica setting will be in effect during this session.
In the following example database superuser mmrmaint is created and altered for this purpose:
The Conflict History tab and the SQL query described in Section 6.6.9.1 can help determine the source of an initial conflict.
Therefore, when you have discovered that a conflict has occurred, it is strongly recommended that you stop the publication server. Use the stop option of the Linux scripts or Windows services described in Step 1 of Section 5.2.1.
•
Which transactions on the publication tables have occurred and are recorded in the shadow tables following the initial conflict, and whether or not these transactions have been applied completely and correctly to the publication tables across all master nodes. These transactions may not be marked as pending. Instead their rrep_tx_conflict_status column could be set to null meaning that no specific conflict was detected during replication, or the transaction has not yet been replicated. These transactions can be identified because they have a later rrep_tx_timestamp value than the transactions causing the initial conflict.
Step 1: Make the necessary manual corrections to the rows in the publication tables across all master nodes to get them into an initial, consistent state so each publication table has the same set of identical rows across master nodes. This may be to a state before the conflicting transactions occurred, depending upon what you determine to be the easiest course of action for fully resolving the conflict.
Step 2: Apply or reapply transactions (either from your application or from the shadow tables) so that all publication tables across all master nodes are updated consistently according to the desired, expected result of what has been recorded in the shadow tables.
Step 3: In the shadow tables, update certain indicators for conflicting entries to show that these were resolved in Step 2.
Step 4: In the control schema, update certain indicators for the conflicting entries to show that these conflicts have been resolved. This update changes the Resolution Status of these entries to Resolved in the Conflict History tab. These entries will no longer appear in the SQL query described in Section 6.6.9.1.
Perform the Step 4 updates to the control schema of the controller database. The currently designated controller database can be determined from the content of the xDB Replication Configuration file (see Section 2.3.1.3). The publication server ensures that the control schema changes made on the controller database are replicated to the control schemas of all publication databases to maintain metadata consistency across all publication databases.
Step 5: Resume operation of your replication system. Start the publication server and recreate the replication schedule if you were using one.
•
Manual Publication Table Correction. Use a utility such as PSQL or pgAdmin (Postgres Enterprise Manager Client in Advanced Server) to manually correct the rows in the publication tables across all master nodes without replicating these changes. Use the database user with session_replication_role set to replica for this purpose.
•
Correction Using New Transactions. Rerun your application on one master node to create new transactions that you will allow to replicate to all other master nodes. Use this method after you have ensured that all publication tables are in a consistent state across all master nodes.
•
Correction Using Shadow Table Transactions. Force the synchronization of transactions already recorded in the shadow tables. Use this method if there are many shadow table transactions that need to be applied, and it is simpler to force the synchronization of these transactions rather than reissuing the transactions from your application.
•
A 3-node multi-master replication system has been established. The master node names are mmrnode_a (the master definition node and the controller database), mmrnode_b, and mmrnode_c.
•
The publication is named emp_pub and uses the dept and emp tables that have been used as examples throughout this document.
•
The conflict used to illustrate the first two conflict resolution methods is a uniqueness conflict occurring on the dept table on primary key column deptno on value 50 resulting from the INSERT statements shown by the following:
On mmrnode_a, the following statement is run:
On mmrnode_b, the following statement is run:
•
Master nodes mmrnode_a and mmrnode_b each contain a row with primary key value 50, but the other column values in the row are different.
•
Master node mmrnode_c does not have a row with primary key value 50.
Assuming that the correct state of the dept table should be the one in mmrnode_b, the following options are available to correct the state of all master nodes:
•
Manually correct the dept table in mmrnode_a and mmrnode_c. That is, update the row in mmrnode_a so it has the correct values, and insert the missing row in mmrnode_c. The dept table on all nodes is now consistent and up-to-date.
•
Manually delete the row with primary key value 50 from the table on both mmrnode_a and mmrnode_b. This brings the dept table on all master nodes back to a prior, consistent state. Then, with the multi-master replication system running, perform the insert transaction again using the correct column values on any one of the master nodes.
•
Manually delete the incorrect row with primary key value 50 from the table on mmrnode_a. Leave the correct row in the table in mmrnode_b. This simulates the state where the correct transaction was run on mmrnode_b, is recorded in the shadow table, but has not yet been replicated, and the incorrect transaction was never run on mmrnode_a. Update the shadow table entry in mmrnode_a to indicate that it is discarded and to ensure it is not included in any future synchronizations. Update the metadata for the shadow table entry in mmrnode_b to force its inclusion in the next synchronization. Perform a synchronization replication so the accepted shadow table entry in mmrnode_b is replicated to mmrnode_a and mmrnode_c.
Step 1: Manually correct the rows in the publication tables with session_replication_role set to replica.
On mmrnode_a, correct the erroneous row:
On mmrnode_c, insert the missing row:
The dept table on mmrnode_a and mmrnode_c now match the content of the table on mmrnode_b:
Step 2: Update the shadow table entries for the conflicting transactions in the master nodes to indicate that the conflict has been resolved.
Shadow tables are located in each master node in schema _edb_replicator_pub. Shadow tables follow the naming convention rrst_schema_table where schema is the name of the schema containing the publication table and table is the name of the publication table.
•
A row in a shadow table corresponds to an INSERT, UPDATE, or DELETE statement that is applied to the corresponding publication tables in the other master nodes. A shadow table row does not necessarily correspond to the SQL statement issued by the user application. For example, a SQL statement issued by a user application that includes a WHERE clause using a range such as greater than or less than, results in multiple, individual entries in the shadow table for each individual row in the result set of the application’s SQL statement.
•
The primary key of a shadow table is a program generated, positive integer in column rrep_sync_id. The rrep_sync_id values are unique amongst all shadow tables within a given master node. Therefore, the rrep_sync_id values for conflicting transactions may or may not have the same value across master nodes as this depends upon how many prior transactions were recorded in the shadow tables of each master node.
•
A shadow table entry for a transaction involved in a conflict that has not yet been resolved contains a value of P (pending) in column rrep_tx_conflict_status. If a transaction is not involved in a conflict, this column is set to null. (The vast majority of shadow table entries should have null in this column.) If a transaction was involved in a conflict that was resolved automatically by the publication server, and this transaction was accepted as being correct, this column contains C (complete/accepted). If a transaction was involved in a conflict that was resolved automatically, and this transaction was deemed incorrect, this column contains D (discarded).
The following query is performed on the shadow table for the dept table in mmrnode_a on rrep_sync_id value 2 obtained from field src_rrep_sync_id of RECORD 1 in the preceding output.
A similar query can locate the pending shadow table entry in mmrnode_b by querying on the key value obtained from field src_rep_sync_id: of RECORD 2:
Note: To be certain no pending transactions are overlooked, you should examine the shadow tables in all master nodes that may have been involved in the conflict and search for entries where rrep_tx_conflict_status is set to P.
The following shows the rrep_tx_conflict_status column marked P (pending) in the Postgres Enterprise Manager Client.
Modify column rrep_tx_conflict_status by changing the value to D (discarded) to show that the pending conflict has been resolved. A value of D also ensures that the shadow table entry will not be replicated during any future synchronization replications.
Be sure to qualify the row with the correct rrep_sync_id value if you perform the update using a SQL statement such as in the following:
There is no shadow table entry in mmrnode_c, since an insert transaction was not performed in that master node by the application.
Step 3: In the control schema of the publication database currently designated as the controller database, modify the entries in the xdb_conflicts table to indicate the conflict has been resolved. Table xdb_conflicts is located in schema _edb_replicator_pub.
Note: The entries in table xdb_conflicts only affect the data that appears in the Conflict History tab and the SQL query described in Section 6.6.9.1. Changing entries in xdb_conflicts has no effect on future replication operations, but provides a way to keep a record of how past conflicts were resolved.
•
A row in the xdb_conflicts table appears as an entry in the Conflict History tab.
•
The primary key of the xdb_conflicts table is comprised of columns src_db_id, target_db_id, src_rrep_sync_id, and target_rrep_sync_id. Column src_db_id contains a unique identifier for the master node in which a transaction occurred that results in a conflict when replicated to the master node identified by target_db_id. src_rrep_sync_id is the shadow table identifier of the transaction on the source master node involved in the conflict while target_rrep_sync_id is the shadow table identifier of the transaction on the target master node that is involved in the conflict. Note: For uniqueness (insert/insert) conflicts, the target_rrep_sync_id value is always set to 0. For a given uniqueness conflict, there are two entries in the xdb_conflicts table. The src_rrep_sync_id value in each of the two entries corresponds to the shadow table identifiers – one for the shadow table identifier associated with the source master node, the other for the shadow table identifier associated with the target master node.
•
Table xdb_pub_database in the control schema associates the database identifiers src_db_id and target_db_id with the master node attributes such as the database name, IP address, and port.
•
Column table_id is the identifier of the publication table on which the conflict occurred. Association of the table_id value with the publication table attributes such as its name, schema, and shadow table is found in each master node in _edb_replicator_pub.rrep_tables.
•
For uniqueness (insert/insert) conflicts only, column pk_value contains text indicating the primary key value that resulted in the conflict. The text is formatted as column_name=value. If the primary key is composed of two or more columns, each column and value pair is separated by the keyword AND such as column_1=value_1 AND column_2=value_2. This provides the primary key of the row in the publication table designated by table_id that resulted in the conflict. Note: Only uniqueness (insert/insert) conflicts contain the column_name=value text in the pk_value column. The pk_value column is null for all other conflict types (that is, update/update, delete/update, update/delete, and delete/delete conflicts).
•
Column resolution_status indicates the status of the conflict. Possible values are P (pending) or C (completed – the conflict has been resolved). This status appears in the Resolution Status column of the Conflict History tab.
•
Column win_db_id can be used to record the database identifier of the master node that contains the “winning” (accepted) transaction. This information appears in the Winning DB column of the Conflict History tab.
•
Column win_rrep_sync_id can be used to record the shadow table identifier of the winning transaction.
The conflict entry for synchronization from mmrnode_a to mmrnode_b can be located in xdb_conflicts with the following query for this example:
The conflict entry for synchronization from mmrnode_b to mmrnode_a can be located in xdb_conflicts with the following query for this example:
Change the value in column resolution_status from P (pending) to C (completed) to indicate this conflict has been resolved. The value in winning_db_id is changed to 4 to indicate master node mmrnode_b contains the winning transaction. The value in winning_rrep_sync_id is changed to the value of rrep_sync_id for the shadow table entry of the transaction in mmrnode_b since this is the one deemed to be correct.
The SQL statement to perform this update for the mmrnode_a to the mmrnode_b synchronization conflict is the following:
The SQL statement to perform this update for the mmrnode_b to the mmrnode_a synchronization conflict is the following:
The following are the updated xdb_conflicts entries:
When viewed in the Conflict History tab, the entries now show Resolved instead of Pending in the Resolution Status column, and the Winning DB column shows the address of master node mmrnode_b.
Referring back to the uniqueness conflict on the dept table, instead of correcting the erroneous row and inserting the row into the master node where it is missing as described in Section 6.6.9.4, you can delete the conflicting rows from all master nodes, then insert the correct row in one master node and let the multi-master replication system synchronize the correct row to all master nodes.
Step 1: Manually delete the inserted row from the publication tables in all master nodes with session_replication_role set to replica.
On mmrnode_a, delete the erroneous row:
On mmrnode_b, delete the row even though the transaction created the correct result:
On mmrnode_c, no changes are required as the conflicting transaction did not insert a new row into the table on this node:
Step 2: Rerun the transaction on one master node with the multi-master replication system running and with session_replication_role set to the default (origin).
For this example, the correct INSERT statement is executed on mmrnode_a:
On mmrnode_a:
Step 3: Perform synchronization replication.
On mmrnode_a;
On mmrnode_b:
On mmrnode_c:
Step 4: Update the shadow table entries for the conflicting transactions in the master nodes to indicate that the conflict has been resolved as in Step 2 of Section 6.6.9.4.
Change the rrep_tx_conflict_status column from P (pending) to D (discarded) on all master nodes.
Note the second entry for the accepted transaction you ran in Step 2 where rrep_tx_conflict_status is set to null indicating there was no conflict.
There is no shadow table entry in mmrnode_c, since an insert transaction was not performed in that master node by the application.
Step 5: In the control schema of the publication database currently designated as the controller database, modify the entries in the xdb_conflicts table to indicate the conflict has been resolved as in Step 3 of Section 6.6.9.4.
In mmrnode_b, the following row is inserted:
In mmrnode_c, the following row is inserted with the same primary key value 9001 in the empno column:
In mmrnode_c, this is followed by a series of updates to the newly inserted row:
On mmrnode_a the conflicting row has not been replicated:
On mmrnode_b the conflicting row inserted on this node remains, but is updated with the transactions replicated from mmrnode_c:
On mmrnode_c the conflicting row inserted on this node remains along with the updates performed on this node:
The following are the steps to reproduce the correct row, currently on mmrnode_c, to the other master nodes by synchronizing the shadow table entries that resulted from the original insert and updates to this row on mmrnode_c.
Step 1: Manually delete the inserted row from the publication tables on all master nodes except for mmrnode_c, which has the correct row. Be sure session_replication_role is set to replica.
On mmrnode_a, this row does not exist:
On mmrnode_b, delete the erroneous row:
On mmrnode_c, the correct, accepted row is left intact:
Step 2: On the master nodes containing the conflicting row that is to be discarded, mark the shadow table entry for that row as discarded. This indicates the conflict on this row has been resolved and ensures this shadow table entry is not replicated in the future.
Change the rrep_tx_conflict_status column from P (pending) to D (discarded) on the losing node, mmrnode_b as shown by the following:
Step 3: On winning node mmrnode_c, inspect the shadow table for the emp publication table.
Make note of the rrep_sync_id values for these four entries, which are 1, 2, 3, and 4 in this example.
Make sure the rrep_tx_conflict_status column is null for these four entries. In this case, for the insert transaction, you will need to change the P (pending) value to null.
The resulting change for the rrep_tx_conflict_status column in the shadow table on mmrnode_c is shown by the following:
Step 4: In order to replicate these four shadow table entries during the next synchronization, one or more entries must be added to the control schema table _edb_replicator_pub.rrep_mmr_txset on mmrnode_c to indicate pending status for synchronization to the target master nodes (mmrnode_a and mmrnode_b) of the four shadow table entries identified by the rrep_sync_id values of 1, 2, 3, and 4 noted in Step 3.
First, you must identify the pub_id and target db_id values that are to be associated with the pending transactions. To do so, invoke the following query substituting the rrep_sync_id values for sync_id in the query:
The results indicate that the previously executed synchronization that attempted to apply the shadow table transactions identified by the rrep_sync_id values of 1, 2, 3, and 4 were all for the publication identified by pub_id of 3. The target master nodes were identified by db_id of 1 (for mmrnode_a) and db_id of 4 (for mmrnode_b).
Thus, at least two entries must be inserted into the control schema table _edb_replicator_pub.rrep_mmr_txset on mmrnode_c. At least one entry is required for the target db_id of 1 and at least one entry for the target db_id of 4.
Since each entry in _edb_replicator_pub.rrep_mmr_txset consists of a range of rrep_sync_id values (identified by columns start_rrep_sync_id and end_rrep_sync_id) and the desired shadow table rrep_sync_id values happen to be contiguous (1 thru 4), a single entry can encompass the four rrep_sync_id values for a single target database.
Thus, in this example, a total of two entries can be added to _edb_replicator_pub.rrep_mmr_txset – one for each target database.
Note: If there were multiple, non-contiguous rrep_sync_id values required for synchronization (for example, 1, 2, 5, and 6), then multiple entries would be required for each target database. The entries would specify rrep_sync_id ranges to collectively cover all of the non-contiguous values, but omitting rrep_sync_id values that are not to be included in the synchronization (for example, one entry for 1 through 2 and a second entry for 5 through 6).
Step 5: Insert the entries into the _edb_replicator_pub.rrep_mmr_txset control schema table as identified in the preceding step.
The two INSERT statements invoked on mmrnode_c are the following:
A query of the _edb_replicator_pub.rrep_mmr_txset metadata table displays the following:
There are now two new entries with pending status (P), one for target db_id 1, the other for target db_id 4. Both entries cover the rrep_sync_id range of 1 through 4.
The two entries with completed status (C) are from the synchronization attempt that initially produced the conflict.
Step 6: Perform synchronization replication.
The insert and three update transactions recorded in the rrst_edb_emp shadow table on mmrnode_c are replicated to the other master nodes.
On mmrnode_a:
On mmrnode_b:
Step 7: In the control schema of the publication database currently designated as the controller database, modify the entries in the xdb_conflicts table to indicate the conflict has been resolved as in Step 3 of Section 6.6.9.4.
For a uniqueness (insert/insert) conflict only, the following query on the xdb_conflicts table in the controller database can display the conflicts:
The following SQL statement changes the value in column resolution_status from P (pending) to C (completed) to indicate this conflict has been resolved. The value in winning_db_id is changed to 56 to indicate master node mmrnode_c contains the winning transaction. The value in winning_rrep_sync_id is changed to the value of rrep_sync_id for the shadow table entry of the INSERT transaction in mmrnode_c since this is the one deemed to be correct.
When viewed in the Conflict History tab, the entry now shows Resolved in the Resolution Status column, and the Winning DB column shows the address of master node mmrnode_c.
Note: The manual conflict resolution discussion in this section applies only to multi-master replication systems configured with the log-based method of synchronization replication. See Section 6.6.9 for information on manual conflict resolution for multi-master replication systems configured with the trigger-based method of synchronization replication.
As discussed in Section 6.6.5 there is no built-in, automatic conflict resolution strategy for the uniqueness (insert/insert) conflict. If a uniqueness conflict occurs, then you must modify rows in the publication tables containing the conflict as well as modify rows in the control schema tables in the master nodes to resolve the conflict.
•
Finding Conflicts. Locating unresolved conflicts
•
Conflict Resolution Concept for the Log-Based Method. Basic concept on how to run transactions to apply corrections
•
Overview of Correction Strategies. Overview of the methods you can use to perform the corrections
•
Manual Publication Table Correction. Manual correction of the publication tables
•
Correction Using New Transactions. Using new transactions to bring all master nodes to a consistent state
Conflicts can be found using the Conflict History tab as described in Section 6.7. The following is an example of the Conflict History tab. Click the Refresh button to reveal all of the latest conflicts.
Note: The View Data link and Conflict Details window displayed for multi-master replication systems configured with the trigger-based method of synchronization replication are not available for multi-master replication systems configured with the log-based method of synchronization replication.
Note: Not every xDB control schema table prevents this replication of a transaction block. Use the SQL UPDATE statement as shown by the following.
The SQL UPDATE statement shown in the following transaction block is to be included to prevent replication of other publication table changes appearing within the same transaction block:
The Conflict History tab and the SQL query described in Section 6.6.10.1 can help determine the source of an initial conflict.
Therefore, when you have discovered that a conflict has occurred, it is strongly recommended that you stop the publication server. Use the stop option of the Linux scripts or Windows services described in Step 1 of Section 5.2.1.
Step 1: Make the necessary manual corrections to the rows in the publication tables across all master nodes to get them into an initial, consistent state so each publication table has the same set of identical rows across master nodes. This may be to a state before the conflicting transactions occurred, depending upon what you determine to be the easiest course of action for fully resolving the conflict.
Step 2: Apply transactions (either from your application or from transaction blocks as defined in Section 6.6.10.2) so that all publication tables across all master nodes are updated consistently according to the desired, expected result.
Step 3: In the control schema, update certain indicators for the conflicting entries to show that these conflicts have been resolved. This update changes the Resolution Status of these entries to Resolved in the Conflict History tab. These entries will no longer appear in the SQL query described in Section 6.6.10.1.
Perform the Step 3 updates to the control schema of the controller database. The currently designated controller database can be determined from the content of the xDB Replication Configuration file (see Section 2.3.1.3). The publication server ensures that the control schema changes made on the controller database are replicated to the control schemas of all publication databases to maintain metadata consistency across all publication databases.
Step 4: Resume operation of your replication system. Start the publication server and recreate the replication schedule if you were using one.
•
Manual Publication Table Correction. Use a utility such as PSQL or pgAdmin (Postgres Enterprise Manager Client in Advanced Server) to manually correct the rows in the publication tables across all master nodes without replicating these changes. Apply these manual corrections within the transaction block described in Section 6.6.10.2.
•
Correction Using New Transactions. Rerun your application on one master node to create new transactions that you will allow to replicate to all other master nodes. Use this method after you have ensured that all publication tables are in a consistent state across all master nodes.
•
A 3-node multi-master replication system has been established. The master node names are mmrnode_a (the master definition node and the controller database), mmrnode_b, and mmrnode_c.
•
The publication is named emp_pub and uses the dept and emp tables that have been used as examples throughout this document.
•
The conflict used to illustrate the conflict resolution methods is a uniqueness conflict occurring on the dept table on primary key column deptno on value 50 resulting from the INSERT statements shown by the following:
On mmrnode_a, the following statement is run:
On mmrnode_b, the following statement is run:
•
Master nodes mmrnode_a and mmrnode_b each contain a row with primary key value 50, but the other column values in the row are different.
•
Master node mmrnode_c does not have a row with primary key value 50.
Assuming that the correct state of the dept table should be the one in mmrnode_b, the following options are available to correct the state of all master nodes:
•
Manually correct the dept table in mmrnode_a and mmrnode_c. That is, update the row in mmrnode_a so it has the correct values, and insert the missing row in mmrnode_c. The dept table on all nodes is now consistent and up-to-date.
•
Manually delete the row with primary key value 50 from the table on both mmrnode_a and mmrnode_b. This brings the dept table on all master nodes back to a prior, consistent state. Then, with the multi-master replication system running, perform the insert transaction again using the correct column values on any one of the master nodes.
Step 1: Manually correct the rows in the publication tables with SQL statements incorporated within a transaction block as described in Section 6.6.10.2.
On mmrnode_a, correct the erroneous row by running the following transaction block:
On mmrnode_c, insert the missing row with the following transaction block:
The dept table on mmrnode_a and mmrnode_c now match the content of the table on mmrnode_b:
Step 2: In the control schema of the publication database currently designated as the controller database, modify the entry in the xdb_conflicts table to indicate the conflict has been resolved. Table xdb_conflicts is located in schema _edb_replicator_pub.
Note: The entries in table xdb_conflicts only affect the data that appears in the Conflict History tab and the SQL query described in Section 6.6.10.1. Changing entries in xdb_conflicts has no effect on future replication operations, but provides a way to keep a record of how past conflicts were resolved.
•
A row in the xdb_conflicts table appears as an entry in the Conflict History tab.
•
The primary key of the xdb_conflicts table is comprised of columns src_db_id, target_db_id, src_rrep_sync_id, and target_rrep_sync_id. Column src_db_id contains a unique identifier for the master node in which a transaction occurred that results in a conflict when replicated to the master node identified by target_db_id. src_rrep_sync_id is the identifier of the transaction on the source master node involved in the conflict while target_rrep_sync_id is the identifier of the transaction on the target master node that is involved in the conflict. Note: The src_rrep_sync_id and target_rrep_sync_id values are used internally by xDB Replication Server and are not needed for the manual conflict resolution process.
•
Table xdb_pub_database in the control schema associates the database identifiers src_db_id and target_db_id with the master node attributes such as the database name, IP address, and port.
•
Column table_id is the identifier of the publication table on which the conflict occurred. Association of the table_id value with the publication table attributes such as its name and schema is found in each master node in _edb_replicator_pub.rrep_tables.
•
Column pk_value contains text indicating the primary key value that resulted in the conflict. The text is formatted as column_name=value. If the primary key is composed of two or more columns, each column and value pair is separated by the keyword AND such as column_1=value_1 AND column_2=value_2. This provides the primary key of the row in the publication table designated by table_id that resulted in the conflict.
•
Column resolution_status indicates the status of the conflict. Possible values are P (pending) or C (completed – the conflict has been resolved). This status appears in the Resolution Status column of the Conflict History tab.
•
Column win_db_id can be used to record the database identifier of the master node that contains the “winning” (accepted) transaction. This information appears in the Winning DB column of the Conflict History tab.
The entry for the pending insert/insert conflict on the deptno primary key value of 50 can be located in xdb_conflicts with the following query for this example:
Change the value in column resolution_status from P (pending) to C (completed) to indicate this conflict has been resolved. The value in winning_db_id is changed to 22 to indicate master node mmrnode_b contains the winning transaction.
The SQL statement to perform this update for the mmrnode_a to the mmrnode_b synchronization conflict is the following:
The following is the updated xdb_conflicts entry:
When viewed in the Conflict History tab, the entry now shows Resolved instead of Pending in the Resolution Status column, and the Winning DB column shows the address of master node mmrnode_b.
Referring back to the uniqueness conflict on the dept table, instead of correcting the erroneous row and inserting the row into the master node where it is missing as described in Section 6.6.10.4, you can delete the conflicting rows from all master nodes, then insert the correct row in one master node and let the multi-master replication system synchronize the correct row to all master nodes.
Step 1: Manually delete the inserted row from the publication tables in all master nodes using the transaction block described in Section 6.6.10.2.
On mmrnode_a, delete the erroneous row with the following transaction block:
On mmrnode_b, delete the row even though the transaction created the correct result:
On mmrnode_c, no changes are required as the conflicting transaction did not insert a new row into the table on this node:
Step 2: Rerun the correct transaction on one master node with the multi-master replication system running. Do not run this within the transaction block described in Section 6.6.10.2 as the objective is to synchronize it to all master nodes.
For this example, the correct INSERT statement is executed on mmrnode_a:
On mmrnode_a:
Step 3: Perform synchronization replication.
On mmrnode_a;
On mmrnode_b;
On mmrnode_c;
Step 4: In the control schema of the publication database currently designated as the controller database, modify the entry in the xdb_conflicts table to indicate the conflict has been resolved as in Step 2 of Section 6.6.10.4.
See Section 6.6 for more information on conflict resolution.
Note: The conflict history can be viewed from the Publication node under any master node in the multi-master replication system. The history shows conflicts on all publication tables of all master nodes that occurred during synchronization, and hence, the history appears the same regardless of the master node under which it is viewed.
Note: For uniqueness (insert/insert) conflicts the number of entries appearing under the Conflict History tab differs when the trigger-based method of synchronization replication is used as compared to the log-based method. If the trigger-based method is used, a single insert/insert conflict appears as two entries in the conflict history. Each entry differs in that the source and target database fields for the two conflicting master nodes are interchanged. If the same conflict occurs when the log-based method is used, only one entry appears in the conflict history.
Step 1: Select any Publication node under a Database node representing a master node. Tabs labeled General, Realtime Monitor, Replication History, and Conflict History appear.
Step 2: Click the Conflict History tab to show conflict history. Click the Refresh button to ensure all conflicts are listed.
Step 3: Use the Conflict Display Criteria drop-down list to display only conflicts of the chosen status.
Step 4: Click the View Data link to show the details of a particular conflict.
Note: The View Data link and Conflict Details window are available only for multi-master replication systems configured with the trigger-based method of synchronization replication. There is no View Data link or Conflict Details window for multi-master replication systems configured with the log-based method of synchronization replication.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication node under the Publication Database node representing the master definition node.
Step 3: Open the Conflict Resolution Options dialog box in any of the following ways:
Step 4: For each table, you can select the primary conflict resolution strategy and a standby strategy by clicking the primary mouse button over the appropriate box to expose a drop-down list of choices.
Step 5: Click the Update button, and then click OK in response to Conflict Resolution Options Updated Successfully.
Note: See Section 2.2.12.3 for table setup requirements for a log-based replication system as well as general restrictions on the use of table filters.
Step 1: Make sure the publication server whose node is the parent of the master nodes of the replication system is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication Database node corresponding to the master node on which you wish to enable or disable individual filter rules.
Step 3: Click the secondary mouse button on the Publication Database node and choose Update Filter Rule.
Note: If you wish to enable or disable filter rules on the current master definition node, you must first switch the role of the master definition node to another master node in order to expose the Update Filter Rule option in the master node context menu. See Section 6.10 for directions on switching the master definition node.
Step 4: In the Filter Rules tab check or uncheck the boxes to specify the filter rules to enable or disable on the master node. At most one filter rule may be enabled on any given table. Click the Save button.
Step 5: A confirmation box appears presenting a warning message and a recommendation to perform a snapshot replication to any master node on which you changed the filtering criteria.
Step 6: If you clicked the Ok button in the preceding step, the Filter Rules updated successfully confirmation message appears if the update was successful.
Step 7: It is strongly recommended that a snapshot replication be performed to the master node that contains tables on which the filtering criteria has changed.
Note: The master definition node, which provides the source of the table content for a snapshot, should contain a superset of all the data contained in the other master nodes of the multi-master replication system. This ensures that the target of the snapshot receives all of the data that satisfies the updated filtering criteria.
Step 1: Make sure the publication server whose node is the parent of the master nodes of the replication system is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication Database node corresponding to the master node that you wish to set as the master definition node.
Step 3: Click the secondary mouse button on the Publication Database node and choose Set as MDN.
Step 4: In the Set as MDN confirmation box, click the Yes button.
Step 5: The selected master node is now the master definition node.
Step 6: The value Yes in the MDN field of the Property window indicates this database is the master definition node.
Note: The new master definition node is moved to the top of the replication tree in the xDB Replication Console.
Note: You should now perform a synchronization replication to ensure that the new master definition node is synchronized with the other master nodes. See Section 6.5.2 for directions on performing a synchronization replication.
Note: Replication history may take a longer period of time to replicate from the controller database to the other publication databases, therefore it is possible that some replication history may be lost if access to the controller database fails, and a switchover is made to another publication database to act as the controller database. See Section 7.4 for information on replication history.
The controller database authentication and connection information is modified accordingly in the xDB Replication Configuration file (see Section 2.3.1.3). Thus, any subsequent startups of the publication and subscription servers use this newly designated controller database.
The publication server configuration options are set in the publication server configuration file. See Section 10.4.1 for a detailed explanation of how to set the configuration options in this file.
The uniquenessConflictDetection option determines if uniqueness conflict needs to be detected at data load time or should be deferred to when data is applied against a target master node. Possible values are EAGER and LAZY. Set it to EAGER if there is a high probability of duplicate inserts across master nodes.
When the number of master nodes is greater than two, then the conflict detection is always performed in EAGER mode. (A LAZY mode setting is ignored.) This is primarily required to avoid removing the already replicated conflicted changes from a target node, which otherwise is an expensive option.
The default value is LAZY when the number of master nodes is two.
The skipConflictDetection option controls whether or not to skip conflict detection during synchronization replication. The default is false and should be changed only when the probability of data conflict across master nodes is zero. For example if each master node operates on an independent set of data then turning on this option improves the replication time.
In a multi-master replication system, if a deadlock is detected on a target master node, the deadlockRetryCount option controls the number of times the publication server attempts to retry application of the changes in the current replication cycle after waiting for the number of milliseconds specified by deadlockWaitTime. Set deadlockRetryCount to 0 to turn off this option in which case the failed changes are attempted in the next replication cycle.
The deadlockWaitTime option is used with the deadlockRetryCount option to set the wait time in milliseconds before the publication server attempts to retry application of the changes on the target master node.
Note: Though most steps described in this chapter apply to both single-master and multi-master replication systems, those steps that apply only to single-master replication systems are noted with For SMR only. Those steps that apply only to multi-master replication systems are noted with For MMR only.
When selecting tables for creating a publication for a single-master replication system (see Section 5.2.3) or a multi-master replication system (see Section 6.2.3), there may be cases where the number of available tables for selection is so large that simply choosing them from a checklist becomes a difficult and time-consuming process.
Pattern matching as performed by the wildcard selector is the process in which the eligible tables for an operation are returned in a filtered list if their schema and table name combination match a character string called a pattern.
Matching a pattern means that the schema and table name combined in a string formatted as schema_name.table_name matches the pattern, character by character, according to the rules designated for the characters appearing in the pattern.
If the schema_name.table_name string matches the pattern, then the schema and table are displayed in the filtered list for that pattern, which is the Available Tables field of the Wildcard Selector dialog box. You can then selectively choose the tables from the filtered list to be added to a local list, which contains the potential, candidate tables for the operation for which you are using the wildcard selector.
With the exception of characters called wildcards, characters appearing in a pattern require that the character in the corresponding position in the schema_name.table_name string must match the pattern character in a case insensitive manner (that is, the letters A or a, match both A and a).
The pattern characters called wildcard characters or simply wildcards are interpreted in a special manner when compared to the corresponding character position of the schema_name.table_name character string.
•
? – Single-character wildcard specifies that any single character may exist in its position of the pattern. (The SQL LIKE clause uses the underscore character (_) for this purpose.)
•
% - Multi-character wildcard specifies that any combination of multiple characters, including the absence of any character, may exist in its position of the pattern.
•
[abc...] – List wildcard specifies that any one of the characters listed within the brackets may exist in its position of the pattern.
•
[a-d] – Range wildcard specifies that any one character that is greater than or equal to the character preceding the hyphen (-) and less than or equal to the character following the hyphen may exist in its position of the pattern.
•
[abcd-f...] – List and range combination wildcard specifies that any character that matches any of the list or range wildcard descriptions as described in the previous two bullet points may exist in its position of the pattern.
•
Any character specified in the pattern other than ?, %, [, ], and the characters enclosed within the square brackets of a list or range wildcard must exist in its position of the pattern. Pattern matching of such characters is case insensitive (for example, a pattern of edb.dept matches a schema and table with the name EDB.Dept).
•
NOT pattern, !pattern, ! pattern – Exclusive pattern specifies that tables that match the pattern string indicated by pattern are omitted from the filtered list. Tables that do not match pattern are included in the filtered list. The keyword NOT may be in uppercase, lowercase, or mixed case, but must be followed by a single space character preceding pattern. !pattern specifies that pattern immediately follows the exclamation point (!) with no intervening space character. ! pattern specifies that a single space character exists between pattern and the exclamation point (!).
•
pattern* - Specify the asterisk (*) immediately following the pattern with no intervening space character if you want to include tables in the filtered list that match pattern and have been previously selected (that is, the local list tables) along with tables that have not been selected. In the filtered list, each previously selected, local list table is displayed with a check mark in its check box. Each filtered list table that was not previously selected has no check mark in its check box. By default when the asterisk is omitted, only tables that have not been previously selected are returned in the filtered list. Using the asterisk is useful for removing currently selected tables from the local list.
•
Calling Dialog Box. This is the dialog box of the operation from which you invoke the Wildcard Selector dialog box. The final set of tables from the wildcard selector is applied to the operation managed by the calling dialog box. Possible calling dialog boxes are the Create Publication dialog box (see Section 5.2.3 for a single-master replication system or Section 6.2.3 for a multi-master replication system), the Add Tables dialog box (see Section 7.6.3.1), and the Remove Tables dialog box (see Section 7.6.3.2).
•
Table List. This is the list of currently selected tables displayed in the calling dialog box. Each selected table has a check mark in its check box.
•
Local List. This is a temporary, internal copy of the table list managed by the wildcard selector. The wildcard selector allows you to add tables to the local list and to remove tables from the local list. When you click the Done button of the Wildcard Selector dialog box, the local list becomes the table list. In other words, the local list tables appear as the selected tables of the calling dialog box.
•
Unselected Tables. These are the tables eligible for, but have not been selected for the operation with which you are using the wildcard selector. When you click the Filter List button, the unselected tables that match the filter pattern are listed in the Available Tables field of the Wildcard Selector dialog box. To list all unselected tables, use the percent sign (%) for the filter pattern.
•
Selected Tables. These are the tables you have selected for the operation with which you are using the wildcard selector. That is, these are the tables comprising the local list. To display selected tables that match a filter pattern, add the asterisk character (*) immediately after the filter pattern. Each selected table has a check mark in its check box.
Step 1: Prior to opening the Wildcard Selector dialog box, you may start selecting tables from the list of available tables of the calling dialog box by adding a check mark to the check box of each such table.
Step 2: The Available Tables field displays the filtered list matching the pattern used in the Filter Pattern text field.
Step 3: Enter a pattern in the Filter Pattern text field to narrow down your desired table selection. Click the Filter List button to display the tables that match the pattern.
Step 4: Select tables from the Available Tables list that you want to add to the local list by placing a check mark in each such table’s check box. You can also click the Select All check box to select all tables and then individually deselect certain tables by removing its check mark.
Step 5: Click the Apply Selections to Local List button to add the selected tables to the local list.
Note: You can click the Cancel button at any time to terminate the wildcard selector without applying the local list changes to the table list of the calling dialog box.
Step 6: As many times as desired, repeat steps 3 through 5 using the filter patterns needed to add all of your desired tables to the local list.
Step 7: When the local list contains all of your desired, selected tables, click the Done button. The Wildcard Selector dialog box closes, and the local list becomes the list of selected tables displayed by the calling dialog box.
Step 8: You can invoke the wildcard selector again and repeat the process to add tables to, or remove tables from the table list by beginning with Step 1.
Step 9: When the calling dialog box contains the complete list of your desired tables, click the appropriate button of the calling dialog box to complete the operation with the selected tables.
A schedule establishes recurring points in time when replication is to occur.
Note (For MMR only): Be sure an initial snapshot replication has been performed from the master definition node to every other master node in the multi-master replication system. If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication initiated by a schedule may fail to apply the transactions to that master node. The initial snapshot could be taken when the master node is first added (see Section 6.3) or by performing an on demand snapshot (see Section 6.5.1).
See Section 7.3 for changing or removing a schedule.
Step 1 (For SMR only): Select the Subscription node of the subscription for which you wish to create a schedule.
Step 1 (For MMR only): Select the Publication Database node designated as the controller database. (The Controller database field in the Property window is set to Yes for the controller database.)
Step 2 (For SMR only): Open the Scheduled Task Wizard dialog box in any of the following ways:
Step 2 (For MMR only): Open the Scheduled Task Wizard dialog box in any of the following ways:
Step 3: In the Scheduled Task Wizard dialog box, select the radio button for either synchronization replication or snapshot replication.
Note: If the publication associated with this subscription is a snapshot-only publication, then only Snapshot may be chosen.
Note: In a multi-master replication system, only Synchronize may be chosen.
Step 4: Select the radio button for the scheduled replication frequency, or select Cron Expression to write your own cron expression. The frequency choices have the following meanings:
•
Continuously. Schedules replication to run continuously at an interval in seconds that you specify. Select this option if the source tables change frequently during the day and the target tables must be kept up-to-date throughout the course of the day.
•
Daily. Schedules replication to run once a day at the time you choose. Select this option if the target tables need to be refreshed daily.
•
Weekly. Schedules replication to run once a day at the time you choose, but only on the specific days of the week you choose. Select this option if you need more flexibility than a daily schedule, and the target tables do not have to be refreshed every day.
•
Monthly. Schedules replication to run one day per month on the day of the month and time you choose, but only on the specific months you choose. Select this option if updates to the source tables are not very frequent, and the target tables can be out-of-date by a month or more. The Monthly option allows you to schedule replication for as frequently as once a month or infrequently as once a year.
•
Cron Expression. Provides additional flexibility for specifying a schedule beyond the four preceding radio button choices. See appendix Section 10.4.3 for directions on writing a cron expression.
Step 5: After completing the Scheduled Task Wizard dialog box, click the Next button.
Step 6: Your selected schedule will appear. Click the Finish button to accept the schedule.
Step 1 (For SMR only): Make sure the subscription server whose node is the parent of the subscription you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 1 (For MMR only): Make sure the publication server whose node is the parent of the controller database you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Subscription node of the subscription for which you wish to update the schedule.
Step 2 (For MMR only): Select the Publication Database node designated as the controller database for which you wish to update the schedule.
Step 3 (For SMR only): Open the Scheduled Task Wizard dialog box in any of the following ways:
Step 3 (For MMR only): Open the Scheduled Task Wizard dialog box in any of the following ways:
Step 4: The Configure Scheduler confirmation box appears. Click the Yes button.
Step 5: In the Scheduled Task Wizard dialog box, create the new schedule. See Step 3 of Section 7.2 for details on how to create a new schedule.
Step 1 (For SMR only): Make sure the subscription server whose node is the parent of the subscription you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.3.1 for directions on starting and registering a subscription server.
Step 1 (For MMR only): Make sure the publication server whose node is the parent of the controller database you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Subscription node of the subscription for which you wish to remove the schedule.
Step 2 (For MMR only): Select the Publication Database node designated as the controller database for which you wish to remove the schedule.
Step 3 (For SMR only): Remove the schedule in any of the following ways:
Step 3 (For MMR only): Remove the schedule in any of the following ways:
Step 4: In the Removing Schedule confirmation box, click the Yes button.
A summary of replications performed on each subscription or master node can be viewed in the xDB Replication Console. A detailed replication history showing each insert, update, and deletion made against each target table can be viewed as well. See Section 2.2.9 for a discussion on how changes are applied to target tables for the target-based method of synchronization replication. See Section 2.2.10 for information on the log-based method of synchronization replication.
Note (For SMR Only): The replication history can be viewed from the Publication node as well as from the Subscription node. The history shown for a Publication node is actually the exact same set of inserts, updates, and deletions made on the subscription tables by the publication server during synchronization. The history shown for a Publication node does not show the actual SQL statements processed on the publication tables that originated from user applications.
Note (For MMR only): The replication history can be viewed from the Publication node under any master node in the multi-master replication system. The history shown includes inserts, updates, and deletions made on all publication tables of all master nodes by the publication server during synchronization, and hence, the history appears the same regardless of the master node under which the history is viewed.
Step 1 (For SMR only): Select the node beneath the Subscription node. Tabs labeled General, Realtime Monitor, and Replication History appear.
Step 1 (For MMR only): Select any Publication node under a Database node representing a master node. Tabs labeled General, Realtime Monitor, Replication History, and Conflict History appear.
Step 2: Click the Replication History tab to show a history of replications.
Note: Every snapshot replication and each synchronization replication with at least one update produces a history record that is maintained in replication history tables in the control schema. Over time the size of the replication history tables will grow. Replication history records can be periodically deleted. See Section 7.5.3 for information on cleaning up replication history.
Step 1: Check the Show History With Transactions Count > 0 check box located at the bottom of the Replication History tab.
Step 2: The next time the Replication History tab refreshes, only the replications with non-zero transaction counts appear in the Replication History.
Note: Zero transaction count replication records are maintained in the publication server memory. By default, they are not permanently stored on disk. Therefore when the publication server is shut down, the in-memory zero transaction count replication records are no longer available.
Step 1: Select a table to reveal tabs that contain general information about the table and the replication history of the table. Expand a Table node to reveal the columns in the table.
Step 2: Click the Replication History tab to show a history of replications for this table.
Step 3: Click the View Data link to show a list of each change made to the table during the synchronization replication. The Synchronize History window shows two update operations followed by one insert operation against the emp target table that correspond to the following set of SQL statements executed on the emp source table:
Note: Since all insert, update, and delete operations on all source tables are recorded in shadow tables, the size of the shadow tables may grow considerably over time for volatile source tables. The rows shown in the Synchronize History window are obtained from these shadow tables. Rows in the shadow tables can be periodically deleted. See Section 7.5.2 for information on cleaning up the shadow tables.
•
Shadow Table History. Records of each change (insert, update, or delete) that was applied to each target table during synchronization replications using the trigger-based method. There is no shadow table history for synchronization replications using the log-based method.
•
Replication History. Summary records of each replication.
•
Event History. Records of each change that was applied to various control schema tables.
Note: A configuration option is available to force shadow table history cleanup after every synchronization replication. See Section 10.4.1.9 for information on this option.
Note: The cleanup of certain processed rows in the shadow tables may be delayed beyond the next scheduled cleanup, but will eventually be removed in subsequent cleanup events.
For Oracle only: For scheduling of shadow table history cleanup on an Oracle publication database, the Oracle DBMS_JOB package on the Oracle database server is used. The time you specify in the schedule for cleanup is passed and stored in DBMS_JOB without time zone translation.
For SQL Server only: For scheduling of shadow table history cleanup on a SQL Server publication database, SQL Server Agent is used on the host running SQL Server. The time you specify in the schedule for cleanup is passed to SQL Server Agent without time zone translation. The effect is the same as described for Oracle in the preceding example.
For Postgres only: For scheduling of shadow table history cleanup on a Postgres publication database, the Quartz scheduler is used on the host running the publication server based on the location of the controller database.
For Oracle only: The cleanup job on an Oracle publication database runs independently of the publication server, so the cleanup job will run regardless of whether or not the publication server is running.
For Postgres only: The publication server must be running in order for the cleanup job to run on a Postgres publication database.
Note: An alternative to using the Quartz scheduler when Postgres is the publication database, is to use pgAgent job scheduling instead. See Section 10.4.1.8 for information on how to use pgAgent job scheduling and the advantages, thereof.
Step 1: Make sure the publication server whose node is the parent of the publication database definition whose cleanup scheduling preference you want to set is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication Database node for which you want to set the cleanup scheduling preference.
Step 3: From the Publication menu, choose Preferences. Alternatively, click the secondary mouse button on the Publication Database node and choose Preferences. The Publication Server Preferences dialog box appears.
Step 4: In the Publication Server Preferences dialog box, uncheck the box if you do not want to run a scheduled shadow table history cleanup job. Click the OK button and skip the remaining steps.
Step 5: If you want to schedule shadow table history cleanup, make sure the Run Cleanup Job check box is selected. Select the radio button for the cleanup frequency. The frequency choices have the following meanings:
•
Every number of minutes/hours. Schedules shadow table history cleanup to run continuously at an interval in either minutes or hours that you specify. Select this option if there are huge volumes of updates to the publication tables during the course of the day, every day.
•
Every Day at hour of day. Schedules shadow table history cleanup to run once a day on the hour you choose. Select this option if updates to the publication tables are frequent enough to require more than once a week cleanup, but not needed more than once a day.
•
Every selected day of week at hour of day. Schedules shadow table history cleanup to run once a week on the day and at the hour you choose. Select this option if updates to the publication tables are infrequent and you do not want to run cleanup manually.
•
Cron Expression. Provides additional flexibility for specifying a schedule beyond the three preceding radio button choices. See appendix Section 10.4.3 for directions on writing a cron expression.
Note: A configuration option is available to force shadow table history cleanup after every synchronization replication. See Section 10.4.1.9 for information on this option.
Step 6: Click the OK button to accept the schedule.
•
RRST_schema_table
For Oracle only: When Oracle is the publication database, these tables are located in the publication database in the schema of the publication database user.
For SQL Server only: When SQL Server is the publication database, these tables are located in the publication database in the schema you chose during Step 5 of Section 5.1.4.2.
For Postgres only: When Postgres is the publication database, these tables are located in the publication database in schema _edb_replicator_pub.
Note: The cleanup of certain processed rows in the shadow tables may not occur during an on demand cleanup or may be delayed beyond the next scheduled cleanup, but will eventually be removed in subsequent cleanup events.
Step 1: Make sure the publication server whose node is the parent of the publication whose shadow table history you wish to clean up is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication node of the publication for which you want to clean up the shadow table history.
Step 3: From the Publication menu, choose Cleanup Shadow Table History. Alternatively, click the secondary mouse button on the Publication node and choose Cleanup Shadow Table History. The Cleanup Synchronization History confirmation box appears.
Step 4: Click the Yes button in the Cleanup Synchronization History confirmation box.
Step 5: Click the Yes button in response to Shadow Table’s Transaction History Removed Successfully.
Step 1: Make sure the publication server whose node is the parent of the publication whose replication history you wish to cleanup is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication node of the publication for which you want to clean up replication history.
Step 3: From the Publication menu, choose Cleanup Replication History. Alternatively, click the secondary mouse button on the Publication node and choose Cleanup Replication History. The Cleanup Replication History confirmation box appears.
Step 4: Click the Yes button in the Cleanup Replication History confirmation box.
Step 5: Click the Yes button in response to Replication History Has Been Removed.
Unlike shadow table history (Section 7.5.2) and replication history (Section 7.5.3), event history is neither viewable nor removable using the xDB Replication Console.
Publication server configuration option historyCleanupDaysThreshold provides the capability to designate how old the completed data must reach before its removal. The default setting is that completed data must be older than seven days before it is deleted during the daily 12 AM cleanup process.
In order to cleanup all completed event and replication history regardless of its age, set historyCleanupDaysThreshold to a value of 0, then restart the publication server. The cleanup occurs during the next scheduled 12 AM cleanup process.
See Section 10.4.1.10 for the historyCleanupDaysThreshold option.
Step 1: The publication server whose login information you want to save, change, or delete in the server login file must be running before you can make any changes to the file. See Step 1 of Section 5.2.1 for directions on starting the publication server.
Step 2: Click the secondary mouse button on the Publication Server node and choose Update. The Update Publication Server dialog box appears.
Step 3: Complete the fields in the dialog box according to your purpose for updating the server login file:
Step 4: Click the Update button. If the dialog box closes, then the update to the server login file was successful. Click the Refresh icon in the xDB Replication Console tool bar to show the updated Publication Server node.
Note: This section applies only to single-master replication systems.
Step 1: The publication server whose metadata you want to change must be running. See Step 1 of Section 5.2.1 for directions on starting the publication server.
Step 2: Click the secondary mouse button on the Publication Server node and choose Update Subscription Servers. The Update Subscription Servers dialog box appears.
Note: If the error message box reappears, click the OK button and repeat Step 2.
Step 3: Enter the new network location for each subscription server in the list whose network location has changed.
Step 4: Click the Update button. If the dialog box closes, then the update to the publication server’s metadata was successful.
Step 5: If the subscription server with the new network location manages subscriptions associated with publications in other publication servers, repeat steps 1 through 4 for these other publication servers.
Note: Depending upon the database type (Oracle, SQL Server, or Postgres), certain attributes must not be changed. You must not change any attribute that alters access to the schema where the control schema objects were created when you originally added this publication database definition. See Section 5.2.4 for the location of the control schema objects.
Step 1: Make sure the database server that you ultimately wish to save as the publication database definition is running and accepting client connections.
Step 2: Make sure the publication server whose node is the parent of the publication database definition you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 3: Select the Publication Database node corresponding to the publication database definition that you wish to update.
Step 4: From the Publication menu, choose Publication Database, and then choose Update Database. Alternatively, click the secondary mouse button on the Publication Database node and choose Update Database. The Update Database Source dialog box appears.
Step 5: Enter the desired changes. See Step 3 of Section 5.2.2 for the precise meanings of the fields for a single-master replication system. See sections 6.2.2 and 6.3 for a multi-master replication system.
Step 6: Click the Test button. If Test Result: Success appears, click the OK button, then click the Save button.
Step 7: Restart the publication server. See Section 5.2.1 for directions on restarting the publication server.
Step 8: Click the Refresh icon in the xDB Replication Console tool bar to show the updated Publication Database node and any of its publications.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication node of the publication to which you wish to add tables.
Step 2 (For MMR only): Select the Publication node under the Publication Database node representing the master definition node.
Step 3: Open the Add Tables dialog box in any of the following ways:
Step 4: Fill in the following fields in the Add Tables tab of the Add Tables dialog box:
•
Add. Check the boxes next to the table names from the Available Tables list that are to be added to the publication. If the publication is a snapshot-only publication, then views would appear in the Available Tables list as well. The Available Tables list contains only tables and views that are not already members of other publications under the same Publication Database node. Alternatively or in addition, click the Use Wildcard Selection button to use wildcard pattern matching for selecting tables to be added to the publication.
•
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 Section 7.1 for information on the wildcard selector.
Step 5 (Optional): If you want to filter the rows of the publication tables or views, click the Table Filters tab. Define filter rules by entering a unique, descriptive filter name and an appropriate SQL WHERE clause in the Filter dialog box to select the rows you want to replicate.
For a single-master replication system, see Section 5.2.3 for information on defining table filters on a publication table.
Step 6 (For SMR only): Click the Add Tables button. If Publication Updated Successfully appears, click the OK button, otherwise investigate the error and make the necessary corrections.
Step 6 (For MMR only): Click the Add Tables button. The Data Sync Check dialog box appears warning you that synchronization replication is performed before the table is added.
Step 7: The replication tree appears as follows with the newly added table under the Publication node. Click the Refresh icon. The newly added table appears under the Subscription nodes of a single-master replication system or the additional master nodes of a multi-master replication system.
Step 8 (For MMR only): If you want to modify or see the default conflict resolution options assigned to the newly added table, follow the directions in Section 6.8.
Step 9 (Optional): If you defined table filters on the newly added table, and you wish to use these filters on any subscriptions or master nodes, you must enable the filters on the table within the desired subscriptions or master nodes.
For a single-master replication system, see Section 5.5.4 for directions on enabling table filters on a subscription.
For a multi-master replication system, see Section 6.9 for directions on enabling table filters on a master node.
pp_xdb_repsvr_ug_erdiag
In the preceding entity relationship diagram, the emp table has a foreign key constraint referencing the dept table, and the jobhist table has two foreign key constraints. One constraint references the emp table and the other references the dept table.
•
Remove the jobhist table only.
•
Remove both the jobhist table and the emp table.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication node of the publication from which you wish to remove tables.
Step 2 (For MMR only): Select the Publication node under the Publication Database node representing the master definition node.
Step 3: Open the Remove Tables dialog box in any of the following ways:
Step 4: Use the Remove Tables dialog box as follows:
•
Remove. Check the boxes next to the table names from the Available Tables list that are to be removed from the publication. If the publication is a snapshot-only publication, then views would appear in the Available Tables list as well. Alternatively or in addition, click the Use Wildcard Selection button to use wildcard pattern matching for selecting tables to be removed from the publication.
•
Use Wildcard Selection. Click this button to use the wildcard selector to choose tables to remove from the publication. See Section 7.1 for information on the wildcard selector.
Step 5: Click the Remove button, then click the Yes button of the confirmation box.
Step 6: Click the OK button in response to Tables Removed Successfully.
Note: See Section 2.2.12.3 for table setup requirements for a log-based replication system as well as general restrictions on the use of table filters.
See Section 5.2.3 for information on using table filters in a single-master replication system and Section 6.2.3 for a multi-master replication system.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication node of the publication in which you wish to update the set of available table filters.
Step 2 (For MMR only): Select the Publication node under the Publication Database node representing the master definition node.
Step 3: Open the Update Filters dialog box in any of the following ways:
Step 4: The set of all available filter rules defined in the publication are listed under the Table Filters tab.
Step 5: A confirmation box appears presenting a warning message and a recommendation to perform a snapshot replication to any subscription or master node on which you intend to enable the change in filtering criteria.
Step 6: You may selectively enable any new filter rules to the corresponding tables of the associated subscriptions or master nodes. See Section 5.5.4 for information on enabling table filters on a subscription. See Section 6.9 for enabling table filters on a master node.
Once a publication is created, do not directly change the definitions of the tables belonging to the publication. Doing so may cause a failure during the replication process. Examples of table definitions that must not be altered include:
Note: Do not change the triggers generated by xDB Replication Server. If it becomes necessary to regenerate the triggers, you must remove the associated publication and then recreate the publication.
•
Remove the publication. See Section 7.6.6 for directions to remove a publication.
•
Re-add the publication. See Section 5.2.3 for directions to add a publication.
•
Re-add the subscription. See Section 5.3.3 for directions to add a subscription.
•
Remove the publication. See Section 7.6.6 for directions to remove a publication.
•
Remove the publication database definition of the master definition node. See Section 7.6.7 for directions to remove a publication database definition.
•
Re-add the publication. See Section 6.2.3 for directions to add a publication.
•
Re-add additional master nodes. See Section 6.3 for directions to add an additional master node. When creating a master node, uncheck the Replicate Publication Schema check box if you have already created the table definitions on all master nodes. Check the Replicate Publication Schema check box if you want to propagate the table definitions from the master definition node to all other master nodes. A snapshot reloads the master node tables from the master definition node.
Note: This validation feature is only available for publications using the trigger-based method of synchronization replication. This validation feature is not available for publications using the log-based method of synchronization replication.
The validation operation described here and in Section 7.6.5.2 can check for the following types of table modifications:
Note: In a multi-master replication system, publication tables in only the master definition node are validated. The validation operation does not check if table definitions have changed in other master nodes.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to validate is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication node of the publication you want to validate.
Step 2 (For MMR only): Select the Publication node under the Publication Database node representing the master definition node.
Step 3: From the Publication menu, choose Validate Publication. Alternatively, click the secondary mouse button on the Publication node and choose Validate Publication.
Step 4: If All Schema of Published Tables in Publication 'publication_name' Are Up-To-Date appears, click the OK button. If an error appears, determine which tables were changed and what changes were made to the table definitions. These issues need to be resolved on a case by case basis as discussed earlier in this section.
Note: This validation feature is only available for publications using the trigger-based method of synchronization replication. This validation feature is not available for publications using the log-based method of synchronization replication.
Note: In a multi-master replication system, publication tables in only the master definition node are validated. The validation operation does not check if table definitions have changed in other master nodes.
Step 1: Make sure the publication server whose node is the parent of the publications you wish to validate is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication Database node under which you want to validate all publications.
Step 2 (For MMR only): Select the Publication Database node representing the master definition node.
Step 3: From the Publication menu, choose Validate All Publications. Alternatively, click the secondary mouse button on the Publication Database node and choose Validate All Publications.
Step 4: If there were no modified tables, click the OK button.
Step 1: Make sure the publication server whose node is the parent of the publication you wish to remove is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2 (For SMR only): Select the Publication node of the publication that you wish to remove.
Step 2 (For MMR only): Select the Publication node under the Publication Database node representing the master definition node.
Step 3: Remove the publication in any of the following ways:
Step 4: In the Remove Publication confirmation box, click the Yes button.
For Oracle and SQL Server: All metadata database objects under the publication database user’s schema are deleted.
For Postgres only: The schema _edb_replicator_pub and all of its database objects are deleted from the publication database.
Step 1: Make sure the publication server whose node is the parent of the publication database definition you wish to remove is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication Database node that you wish to remove.
Step 3: From the Publication menu, choose Publication Database, then Remove Database. Alternatively, click the secondary mouse button on the Publication Database node and choose Remove Database. The Remove Publication Database confirmation box appears.
Step 4: In the Remove Publication Database confirmation box, click the Yes button.
Note: If the controller database is an Oracle or a SQL Server publication database, then a second Oracle or SQL Server publication database cannot be added to create a second single-master replication system. In order for xDB Replication Server to run more than one single-master replication systems consisting of Oracle or SQL Server publication databases, a Postgres publication database must be designated as the controller database.
Upon switching the controller database, the publication server updates the xDB Replication Configuration file so the parameters user, password, host, port, database, and type are set to the connection and authentication settings for the selected publication database.
Step 1: Make sure the publication server whose node is the parent of the publication databases is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 2: Select the Publication Database node corresponding to the publication database that you wish to set as the controller database.
Step 3: Click the secondary mouse button on the Publication Database node and choose Set as Controller database.
Step 4: In the Set as Controller database confirmation box, click the Yes button.
Step 5: The selected publication database has now been set as the controller database.
Step 6: The value Yes in the Controller database field of the Property window indicates this database is the controller database.
Note: See Section 7.6.5 for information on dealing with other types of table definition changes.
Table definition changes are generally implemented using the SQL ALTER TABLE statement, which is issued in an SQL command line utility program such as PSQL.
The DDL change replication feature accepts one or more ALTER TABLE statements. The statements may be provided by means of a text file or by entering them directly into the Alter Publication Table dialog box. The latter can be done by copying and pasting the statements into the dialog box, or by directly typing in the statements. The DDL change replication feature then performs the following actions:
•
Applies the ALTER TABLE statements to the appropriate target table in the publication and subscription databases of a single-master replication system, or in all master nodes (including the master definition node) of a multi-master replication system.
The syntax of the ALTER TABLE statement accepted by the DDL change replication features is as follows:
ALTER TABLE schema.table_name action
where action can be any of the following:
RENAME [ COLUMN ] column_name TO new_column_name
ADD [ COLUMN ] column_name data_type
[ DEFAULT dflt_expr ]
[ column_constraint_1 [ column_constraint_2 ] ...]
DROP [ COLUMN ] column_name [ RESTRICT ]
ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type
[ COLLATE "collation" ]
[ USING data_type_expr ]
Set the DEFAULT value of a column:
ALTER [ COLUMN ] column_name SET DEFAULT dflt_expr
Note: The SET DEFAULT clause is not supported when Oracle or SQL Server is the subscription database.
Drop the DEFAULT value of a column:
ALTER [ COLUMN ] column_name DROP DEFAULT
Note: The DROP DEFAULT clause is not supported when Oracle or SQL Server is the subscription database.
ALTER [ COLUMN ] column_name SET NOT NULL
Note: The SET NOT NULL clause is not supported when SQL Server is the subscription database.
ALTER [ COLUMN ] column_name DROP NOT NULL
Note: The DROP NOT NULL clause is not supported when SQL Server is the subscription database.
The following restrictions apply to the manner in which the ALTER TABLE statements are specified whether it is in a text file or entered directly into the dialog box:
•
Each ALTER TABLE statement must be terminated by a semicolon and begin on a separate line.
•
Although the Postgres ALTER TABLE statement allows multiple actions per statement, the xDB DDL change replication feature permits only one action per ALTER TABLE statement.
•
The target table of all ALTER TABLE statements must be the same.
•
The DROP COLUMN action cannot be specified for a column that comprises part of the table’s primary key.
The name of the schema containing table_name. This value is case-sensitive.
A column constraint such as a UNIQUE or CHECK constraint. For additional information on column constraints see the CREATE TABLE SQL command in the PostgreSQL Core Documentation located at:

https://www.postgresql.org/docs/current/static/sql-createtable.html
In the DROP COLUMN clause, do not drop the column if there are objects dependent upon it. This is the default. Note: You cannot specify the CASCADE option as it is not supported by the DDL change replication feature.
The following are examples of ALTER TABLE statements that can be used by the DDL change replication feature.
The following set of ALTER TABLE statements, either specified by a text file or entered directly into the dialog box, adds columns to the edb.emp table.
The following ALTER TABLE statement changes the data type length of the title column and sets its values with the USING data_type_expr clause.
The following query shows the values assigned to the title column after the DDL change replication feature applies the preceding ALTER TABLE statement to the edb.emp table. This change to the title column and assignment of values occurs in all the subscription databases of a single-master replication system or in all the master nodes of a multi-master replication system.
The following set of ALTER TABLE statements drops the columns that were added in the first example.
The DDL statement is executed in a controlled manner such that the target table is exclusively locked (by the default setting of configuration option ddlChangeTableLock) during the course of the operation. This is done to avoid loss of any transactions while the replication triggers and shadow table are modified by the DDL change replication process. Only one target table is locked at a time while DDL change replication takes place on that table, its triggers, and shadow table.
Note: Exclusive acquisition of each target table during the DDL change replication process can be turned off by setting ddlChangeTableLock to false. However, this should be done only when there are no write transactions taking place against the target table, otherwise transactions may not be recorded by the replication system. See Section 10.4.1.11 for additional information on the ddlChangeTableLock configuration option.
•
If the publication server configuration option ddlChangeTableLock is set to its default value of true, an exclusive table lock is requested on the table to which the DDL change is to be applied. If another application already has a lock on the table, there is a wait time of 2 minutes after which the DDL change replication process is aborted if the lock is not released before then. If ddlChangeTableLock is set to false, an exclusive table lock is not requested.
Step 1: If you plan to use a file to supply the ALTER TABLE statements to a publication table, prepare the text file. Make sure this text file is accessible by the operating system account with which you will open the xDB Replication Console.
Alternatively, you can copy and paste, or directly type in the ALTER TABLE statements into the Alter Publication Table dialog box without having to save the statements in a file.
Step 2: Make sure the publication server whose node is the parent of the publication containing the table you wish to change is running and has been registered in the xDB Replication Console you are using. See Section 5.2.1 for directions on starting and registering a publication server.
Step 3: Under the publication database of a single-master replication system, or under the master definition node of a multi-master replication system, open the Alter Publication Table dialog box by clicking the secondary mouse button on the Table node of the table to be modified and choose Alter Table.
pub_alter_table_dialog_box_1
Step 4: In the Alter Publication Table dialog box, if you saved the ALTER TABLE statements in a text file, make sure the DDL Script File option is selected, browse for this file, and click the OK button.
pub_alter_table_dialog_box_2a
Alternatively, if you are directly entering the ALTER TABLE statements, select the DDL Script option instead of the DDL Script File option. Directly type in, or copy and paste the ALTER TABLE statements from your source into the text box. Click the OK button.
pub_alter_table_dialog_box_2b
Step 5: If the DDL replicated successfully message box appears, the DDL change was successful across all databases. Click the OK button.
pub_alter_table_dialog_box_3
•
Were the modifications in the ALTER TABLE statements successfully applied to the target table in each database of the replication system?
•
For the trigger-based method, was the shadow table RRST_schema_table located in the _edb_replicator_pub schema in each database of the replication system modified to account for the ALTER TABLE statements?
If one of the updates had been an insertion of a new row, and this new row is already in the target table loaded from the offline snapshot, a duplicate key error results when the publication server attempts to apply the batch containing the INSERT statement for this row. The duplicate key error forces the rollback of the entire batch. This causes the exclusion of updates in the batch that may not yet have been carried over to the target tables. The source tables and target tables are now inconsistent since there were updates to the source tables that have not been applied to the target tables.
Note: The effects of applying UPDATE and DELETE statements in the batch to a target table that already has been changed by these updates does not cause the same problem as repeated application of INSERT statements. The UPDATE statement would just change the row to the same values a second time. When a DELETE statement affects no rows, this is not considered an error by the database server, and therefore, no rollback of the batch occurs.
The batchInitialSync configuration option controls whether the first synchronization replication occurs in batch or non-batch mode.
Note: An offline snapshot cannot be used to add a subscription or a master node to an active replication system that uses the log-based method. For the log-based method, offline snapshots can only be used to initially configure the system, and not to update it with additional nodes after the publication database or master node is actively receiving transactions.
If you are using offline snapshots to initially create the entire replication system that has yet to be activated, and the content of the offline snapshots are all assumed to be consistent for the source and target tables, then batchInitialSync can be left with its default setting of true since it is assumed that the first synchronization replication will not apply any duplicate updates.
Note: These options apply to the publication server only.
The offlineSnapshot option must be set to true before creating the subscription for a single-master replication system, or before adding the master node for a multi-master replication system.
When set to true, the offlineSnapshot option prevents the usual creation of the subscription schema and table definitions when the subscription is defined in a single-master replication system since it is assumed that you are creating the subscription table definitions and loading them from an external source other than the publication.
When offlineSnapshot is set to true, this has the direct effect within the control schema by setting column has_initial_snapshot to a value of O indicating an offline snapshot is used for the target subscription or master node represented by the row. Column has_initial_snapshot is set in table xdb_publication_subscriptions for a single-master replication system and in table xdb_mmr_pub_group for a multi-master replication system.
The setting of has_initial_snapshot influences the behavior of the batchInitialSync option as explained in the following section.
After the first replication completes to the target subscription or master node, has_initial_snapshot is changed to Y by xDB Replication Server.
The batchInitialSync option is used to control whether the first synchronization after loading the target tables from an offline snapshot is done in batch mode (the default) or non-batch mode.
Set the batchInitialSync option to false to perform synchronization replication in non-batch mode.
The offlineSnapshot configuration option must have first been set to true prior to creating the subscription or adding the additional master node. A non-batch mode synchronization occurs only if batchInitialSync is false and the has_initial_snapshot column in the control schema is set to a value of O as described for the offlineSnapshot option.
Step 1: Register the publication server, add the publication database definition, and create the publication as described in Section 5.2.
Step 2: Register the subscription server and add the subscription database definition as described in sections 5.3.1 and 5.3.2, respectively.
Note: Steps 3 and 4 must be performed before creating the subscription. Steps 3 through 9 can be repeated each time you wish to create an additional subscription from an offline snapshot.
Step 3: Modify the publication server configuration file if these options are not already set as described by the following:
•
Change the offlineSnapshot option to true. When the publication server is restarted, offlineSnapshot set to true has the effect that: 1) creating a subscription does not create the schema and subscription table definitions in the subscription database as is done with the default setting, and 2) creating a subscription sets a column in the control schema indicating an offline snapshot is used to load this subscription.
•
Set the batchInitialSync option to the appropriate setting for your particular situation as discussed at the end of Section 7.9.1.
Step 4: Restart the publication server if the publication server configuration file was modified in Step 3. See Section 5.2.1 for directions on restarting a publication server.
Step 5: In the subscription database, create the schema, the subscription table definitions, and load the subscription tables from your offline data source. The subscription database user name used in Section 5.3.2 must have full privileges over the database objects created in this step. Also review the beginning of Section 5.3.2 regarding the rules as to how xDB Replication Server creates the subscription definitions from the publication for each database type as you must follow these same conventions when you create the target definitions manually.
Step 6: Add the subscription as described in Section 5.3.3.
Step 7: Perform an on demand synchronization replication. See Section 5.4.2 for directions on performing an on demand synchronization replication.
Step 8: If you are not planning to load any other subscriptions using an offline snapshot at this time, change the offlineSnapshot option back to false and the batchInitialSync option to true in the publication server configuration file.
Step 9: Restart the publication server if you modified the publication server configuration file in Step 8.
Note: Offline snapshots are not supported for a multi-master replication system that is actively in use. Any changes on an active master node will be lost during the offline snapshot process of dumping or restoring the data of another node.
Step 1: Register the publication server, add the master definition node, and create the publication as described in Section 6.2.
Note: The following steps must be performed before adding a master node that is to be loaded by an offline snapshot. Steps 2 through 10 can be repeated each time you wish to create an additional master node from an offline snapshot.
Step 2: Be sure there is no schedule defined on the replication system, otherwise remove the schedule for the duration of the following steps. See Section 7.3.2 for directions on removing a schedule.
Step 3: Modify the publication server configuration file if these options are not already set as described by the following:
•
Change the offlineSnapshot option to true. When the publication server is restarted, offlineSnapshot set to true has the effect that adding a master node sets a column in the control schema indicating an offline snapshot is used to load this master node.
•
Set the batchInitialSync option to the appropriate setting for your particular situation as discussed at the end of Section 7.9.1.
Step 4: Restart the publication server if the publication server configuration file was modified in Step 3. See Section 5.2.1 for directions on restarting a publication server.
Step 5: In the database to be used as the new master node, create the schema, the table definitions, and load the tables from your offline data source.
Step 6: Add the master node as described in Section 6.3 with options Replicate Publication Schema and Perform Initial Snapshot unchecked.
Step 7: Perform an initial on demand synchronization. See Section 6.5.2 for directions on performing an on demand synchronization.
Step 8: If you are not planning to load any other master nodes using an offline snapshot at this time, change the offlineSnapshot option back to false and the batchInitialSync option to true in the publication server configuration file.
Step 9: Restart the publication server if you modified the publication server configuration file in Step 8.
Step 10: Re-add the schedule if one had been removed in Step 2. See Section 7.2 for directions on creating a schedule.
If you are using Advanced Server, partitioned tables can be created using the CREATE TABLE statement with partitioning syntax compatible with Oracle databases. For information on partitioning compatible with Oracle databases, see Chapter 10 “Table Partitioning” in the EDB Postgres Advanced Server 10.0 Database Compatibility for Oracle Developers Guide available from the EnterpriseDB website located at:
If you are using version 10 or later of PostgreSQL or Advanced Server, declarative partitioning can be used to create partitioned tables. The CREATE TABLE syntax for creating a declarative partitioned table is similar to the partitioning compatible with Oracle databases, but the individual partitions of the declarative partitioned table must be separately created with their own CREATE TABLE statements.
If you are using native PostgreSQL version 9.6 or earlier, you must use a technique called table inheritance where you first create a parent table from which you then create one or more child tables that inherit the columns of the parent. Each child is an independent table in its own right except that it includes the column definitions of its parent. You then define a trigger on the parent table to direct which child table an inserted row is to be stored. Table inheritance can be used on Advanced Server as well.
All three partitioning techniques are illustrated on the emp table used as an example throughout this document. The partitioned table is then used in a publication of a multi-master replication system in the following sections:
Note: When creating a declarative partitioned table that is to be replicated using xDB Replication Server, the PRIMARY KEY constraint must be included in the CREATE TABLE statements of the individual partitions, not in the CREATE TABLE statement of the parent table to be partitioned.
Querying the parent table, emp, with the asterisk appended to the table name in the SELECT statement, shows the rows in the parent and child tables. This is the default behavior if the asterisk is omitted.
The following queries show how the rows are physically divided amongst the child tables. The use of the ONLY keyword results in rows only in the specified table of the SELECT statement, and not from any of its children.
Section 7.10.2 shows creation of the publication when using partitioning compatible with Oracle databases or declarative partitioning on a Postgres 10 or later database server.
Follow the directions in Section 6.2 to create a master definition node along with a publication containing the partitioned table. (For a single-master replication system, create the publication database along with the publication according to the directions in Section 5.2.)
Create additional master nodes as described in Section 6.3. (For a single-master replication system, create the subscription database and subscription according to the directions in Section 5.3.)
Note: If you are using table inheritance, you must still use the process described in Section 7.10.1 even when creating the publication on a Postgres 10 or later database server.
Follow the directions in Section 6.2 to create a master definition node along with a publication containing the partitioned table. (For a single-master replication system, create the publication database along with the publication according to the directions in Section 5.2.)
Create additional master nodes as described in Section 6.3. (For a single-master replication system, create the subscription database and subscription according to the directions in Section 5.3.)
Note: SSL connections are not used from the xDB Replication Console or the xDB Replication Server Command Line Interface. The xDB user interfaces communicate with the publication server and subscription server, which in turn connect to the publication/subscription databases or master nodes.
Note: The Migration Toolkit connection using SSL occurs within the context of the publication server and subscription server SSL connections. Therefore, there are no separate steps that you need to perform for the Migration Toolkit SSL connection.
The Java truststore is the file containing the Certificate Authority (CA) certificates with which the Java client (the publication server and subscription server) uses to verify the authenticity of the server to which it is initiating an SSL connection.
The Java keystore is the file containing private and public keys and their corresponding certificates. The keystore is required for client authentication to the server, which is used for xDB Replication Server SSL connections.
Step 1: Create the certificate signing request (CSR).
In the following example the generated certificate signing request file is server.csr. The private key is generated as file server.key.
Note: When creating the certificate, the value specified for the common name field (designated as CN=enterprisedb in this example) must be the database user name that is specified in the User field of the Add Database or Update Database dialog box used when defining the publication database (see Section 5.2.2), subscription database (see Section 5.3.2), or master nodes (see sections 6.2.2 and 6.3).
Alternatively, user name maps can be used as defined in the pg_ident.conf file to permit more flexibility for the common name and database user name. Steps 8 and 9 describe the use of user name maps.
Step 2: Generate the self-signed certificate.
The following generates a self-signed certificate to file server.crt using the certificate signing request file, server.csr, and the private key, server.key, as input.
Step 3: Make a copy of the server certificate (server.crt) to be used as the root Certificate Authority (CA) file (root.crt).
Step 4: Delete the now redundant certificate signing request (server.csr).
Step 5: Move or copy the certificate and private key files to the Postgres database server data directory, POSTGRES_INSTALL_HOME/data.
Step 6: Set the file ownership and permissions on the certificate files and private key file.
Set the ownership to the operating system account that owns the data subdirectory of the Postgres database server, which is either enterprisedb or postgres depending upon the chosen installation mode (Oracle compatible or PostgreSQL compatible) when you installed your Postgres database server.
Step 7: In the postgresql.conf file, make the following modifications.
Step 8: Modify the pg_hba.conf file to enable SSL usage on the desired publication, subscription, or master node databases.
In the pg_hba.conf file, the hostssl type indicates the entry is used to validate SSL connection attempts from the client (the publication server and the subscription server).
The authentication method is set to cert with the option clientcert=1 in order to require an SSL certificate from the client against which authentication is performed using the common name of the certificate (enterprisedb in this example).
The map=sslusers option specifies that a mapping named sslusers defined in the pg_ident.conf file is to be used for authentication. This mapping allows a connection to the database if the common name from the certificate and the database user name attempting the connection match the SYSTEM-USERNAME/PG-USERNAME pair listed in the pg_ident.conf file.
The following is an example of the settings in the pg_hba.conf file if the publication and subscription databases (edb and subnode) must use SSL connections.
Step 9: The following shows the user name maps in the pg_ident.conf file related to the pg_hba.conf file by the map=sslusers option. These user name maps permit you to specify database user names pubuser, subuser, mmruser, or enterprisedb in the User field of the Add Database or Update Database dialog box when adding the publication, subscription, or master node databases in the xDB Replication Console.
Step 10: Restart the Postgres database server after you have made the changes to the Postgres configuration files.
Step 1: Using files server.crt and server.key located under the Postgres database server data subdirectory, create copies of these files and move them to the host where the publication server and subscription server are running.
For this example, assume file xdb.crt is a copy of server.crt and xdb.key is a copy of server.key.
Step 2: Create a copy of xdb.crt.
Step 3: Create a Distinguished Encoding Rules (DER) format of file xdb_root.crt. The generated DER format of this file is xdb_root.crt.der. The DER format of the file is required for the keytool program in the next step.
Step 4: Use the keytool program to create a keystore file (xdb.keystore) using xdb_root.crt.der as the input. This process adds the certificate of the Postgres database server to the keystore file.
The keytool program can be found under the bin subdirectory of the Java Runtime Environment installation.
Step 5: Generate the encrypted form of the new password specified in the preceding step.
The encrypted password must be specified with the sslTrustStorePassword configuration option of the publication server configuration file for publication server SSL connections and the subscription server configuration file for subscription server SSL connections. (See Section 10.4.1 for information on the publication server and subscription server configuration files.)
Encrypt the password using the xDB Replication Server CLI encrypt command. The following example shows this process encrypting the password contained in file infile.
Step 6: Create a PKCS #12 format of the keystore file (xdb_pkcs.p12) using files xdb.crt and xdb.key as input.
Step 7: Generate the encrypted form of the new password specified in the preceding step,
The encrypted password must be specified with the sslKeyStorePassword configuration option of the publication server configuration file for publication server SSL connections and the subscription server configuration file for subscription server SSL connections.
Step 8: Copy files xdb.keystore and xdb_pkcs.p12 to a directory location where they are to be accessed by the publication server and subscription server.
Step 9: In the publication server and subscription server configuration files, set the location of file xdb.keystore with the sslTrustStore option and the location of file xdb_pkcs.p12 with the sslKeyStore option.
The encrypted sslTrustStorePassword is obtained from Step 5 after being specified for the keytool program in Step 4.
The encrypted sslKeyStorePassword is obtained from Step 7 after being specified for the openssl pkcs12 program in Step 6.
Section 7.11.4 contains a summary of the publication server and subscription server configuration options for SSL connections.
Step 10: Restart the publication and subscription servers.
pubserver_add_database_dialog_box_ssl
Note: If you no longer wish to use an SSL connection to an xDB Replication Server database, you must completely delete the ssl=true text from the URL Options field of the Add Database or Update Database dialog box. Simply changing true to false does not have the effect of disabling the SSL option.
The sslTrustStoreType option specifies the truststore format. Set this option to the Java truststore format of the client.
sslTrustStoreType=truststore_format
The default value for truststore_format is jks for the JKS truststore file format.
The typical default location of the truststore is in directory JAVA_HOME/jre/lib/security or JAVA_HOME/lib/security in a file named cacerts. (JAVA_HOME is the Java installation directory.)
sslTrustStore=truststore_file
Encrypt the password for the Java system truststore using the xDB Replication Server CLI encrypt command (see Section 8.3.4) and specify the encrypted password with the sslTrustStorePassword option.
sslTrustStorePassword=encrypted_password
The sslKeyStoreType option specifies the keystore format. Set this option to the Java keystore format of the client.
sslKeyStoreType=keystore_format
The default value for keystore_format is pkcs12 for the PKCS #12 keystore file format.
sslKeyStore=keystore_file
Encrypt the password for the Java system keystore using the xDB Replication Server CLI encrypt command (see Section 8.3.4) and specify the encrypted password with the sslKeyStorePassword option.
sslKeyStorePassword=encrypted_password
This chapter discusses the syntax and usage of the xDB Replication Server Command Line Interface (CLI). This utility program is a command line driven alternative to the xDB Replication Console.
The steps for creating a replication system using the xDB Replication Server CLI are no different than those required when using the xDB Replication Console. The logical components of the replication system must be created in the same order, with the same sets of attributes as when creating the replication system with the xDB Replication Console.
You should understand the concepts and steps presented in chapters 2, and 5 (for single-master replication) or 6 (for multi-master replication) before building a replication system using the xDB Replication Server CLI.
There are no restrictions on using both the xDB Replication Console and the xDB Replication Server CLI to build and manage the same replication system.
In Section 8.3, the syntax and examples are given for each xDB Replication Server CLI command run individually. Where applicable, the discussion of a command contains a reference back to its xDB Replication Console counterpart where a detailed description of the affected component and its attributes can be found.
The xDB Replication Server CLI is included if the xDB Replication Console component is chosen when installing xDB Replication Server. The xDB Replication Server CLI is a Java application found in directory XDB_HOME/bin.
Step 1: Follow the installation steps given in Chapter 3 to install xDB Replication Server.
Step 2: Follow the prerequisite steps given in Section 5.1 for single-master replication systems or Section 6.1 for multi-master replication systems.
Step 3: Set the Java Runtime Environment as described by the following discussion.
On the host from which you intend to run the xDB Replication Server CLI, the Java Runtime Environment (JRE) must be present and the Java runtime bin directory must be included in the path of the operating system user name that will be used to run xDB Replication Server CLI.
The xDB Startup Configuration file, xdbReplicationServer-xx.config, contains the path of the JRE runtime program that was detected during the installation of xDB Replication Server. The following is an example of the xDB Startup Configuration file (see Section 3.5 for the location of this file.)
On Windows systems, open the Properties dialog box of My Computer, choose Advanced System Settings, and then click on Environment Variables. Edit the Path system environment variable to include the Java Runtime Environment bin directory. Alternatively, you can set the path for just the current session when you open the Command Prompt window as in the following example:
You can run the xDB Replication Server CLI from any host on which you can run the xDB Replication Console. The xDB Replication Server CLI is run by executing the java runtime program and specifying the following arguments to the java program:
•
The path to the xDB Replication Server CLI jar file edb-repcli.jar
•
An xDB Replication Server CLI command
The Java jar file edb-repcli.jar is located in directory XDB_HOME/bin.
Each xDB Replication Server CLI command has the following general syntax:
-command [ { pubname | subname } ...]
[ -parameter [ value ] ...] ...
In the preceding syntax diagram, command is the name of an xDB Replication Server CLI command. The command name must be prefixed by a hyphen character (-). If the command acts on a publication, the name of the publication represented by pubname is specified. If the command acts on a subscription, the subscription name represented by subname is specified. Certain commands may allow the specification of more than one publication name or more than one subscription name.
java -jar XDB_HOME/bin/edb-repcli.jar
-command [ { pubname | subname } ...]
[ -parameter [ value ] ...] ...
Note: You can continue a command onto the next physical line if you enter the operating system’s continuation character (for example, the backslash character (\) in Linux or the caret character (^) in Windows) before pressing the Enter key.
If you execute the xDB Replication Server CLI with the help command, xDB Replication Server CLI will list a syntax summary of all commands.
See Section 8.3.1 for details on the help command.
This section discusses the syntax and usage of an xDB Replication Server CLI parameter, required by many commands, named repsvrfile. Using parameter repsvrfile is the xDB Replication Server CLI equivalent for the process of registering the publication server or the subscription server in the xDB Replication Console.
Section 5.2.1 discusses how the first step in building a replication system is to register the publication server. In the xDB Replication Console, the registered publication server appears as a node in the replication tree. The Publication Server node provides a context to which you can add other logical components of the replication system.
When using the xDB Replication Server CLI, there is no replication tree image available with which to relate the other logical components of the replication system. Instead, whenever you execute an xDB Replication Server CLI command that requires the context of a publication server or subscription server, you must specify the publication server’s login information or the subscription server’s login information by means of the repsvrfile parameter.
The repsvrfile parameter takes as its value, the path to a text file that contains the login information of either the publication server instance or the subscription server instance that you want to use. The general xDB Replication Server CLI command syntax including the repsvrfile parameter is shown in the following diagram:
-command [ { pubname | subname } ...]
[ -parameter [ value ] ...] ...
[ -repsvrfile repsvrfile ]
[ -parameter [ value ] ...] ...
The xDB Replication Server CLI command to be executed is represented by command. If required, publication names represented by pubname or subscription names represented by subname are specified next. The path to the text file containing either the publication server or subscription server login information is represented by repsvrfile. The parameters and their values that are used with command are denoted by parameter and value.
The order on the command line in which -repsvrfile repsvrfile and -parameter and its values are given does not matter. For example, -repsvrfile repsvrfile can be given as the first parameter on the command line, the last parameter on the command line, or somewhere in between other parameters.
The following is an example of repsvrfile for a publication server:
The following is an example of repsvrfile for a subscription server:
•
•
•
•
This is the same information with which you would need to register the publication server or subscription server if you were using the xDB Replication Console. See Section 5.2.1 for additional information on registering the publication server. See Section 5.3.1 for information on registering the subscription server.
The following example illustrates how the repsvrfile parameter is used along with the printpublist command.
When using the xDB Replication Server CLI, text files are used to store certain information, which may include user names and passwords. An example is the files containing publication server and subscription server login information used with the repsvrfile parameter.
In the file specified with parameter repsvrfile, the password field must be set to a password in encrypted form. Using an encrypted password prevents unauthorized personnel from accessing the publication server or subscription server using the values of user and password if the file was somehow compromised. (The encrypted password cannot be used to access the publication server or subscription server from its dialog box in the xDB Replication Console.)
See Section 8.3.4 for directions on generating an encrypted password using the encrypt command.
The paramfile command allows you to run an xDB Replication Server CLI command and its parameters that have been coded into a text file. This technique is useful if you want to save the command and its parameters for repeated executions.
The syntax for executing paramfile is shown by the following:
java -jar XDB_HOME/bin/edb-repcli.jar
-paramfile cmdparamfile
The syntax of the xDB Replication Server CLI command and its parameters coded into text file cmdparamfile is the same as if given at the command line prompt as shown by the following:
-command [ { pubname | subname } ...]
[ -parameter [ value ] ...] ...
[ -repsvrfile repsvrfile ]
[ -parameter [ value ] ...] ...
Using the paramfile command has the following restrictions:
•
Only one xDB Replication Server CLI command can be coded into the parameter file cmdparamfile.
•
The parameters to be used with the xDB Replication Server CLI command must all be included in cmdparamfile. You cannot code some of the parameters into cmdparamfile and give other parameters on the command line.
The following example creates an Advanced Server publication database definition using a parameter file named addpubdb_advsvr.
For Windows only: The -repsvrfile directory path can be specified with either the forward slash or backslash character. Enclose the entire directory path in double quotation marks if a directory name contains space characters:
Note: Unlike entering the xDB Replication Server CLI command and its parameters directly at the command line prompt, when coded into a text file, no continuation characters are needed to continue onto the following lines.
An exit status of 0 indicates successful execution. A non-zero exit status indicates a failure has occurred.
For Linux only: The environment variable, $?, contains the exit status.
The following example shows the 0 exit status upon the successful execution of the addpubdb command contained in the addpubdb_advsvr parameter file described in Section 8.2.5.
For Windows only: The environment variable, %ERRORLEVEL%, contains the exit status.
Note: Though most commands described in this section apply to both single-master and multi-master replication systems, those commands that apply only to single-master replication systems are noted with For SMR only. Those commands that apply only to multi-master replication systems are noted with For MMR only. The same notation is used for command parameters that may apply only to single-master replication systems or multi-master replication systems.
For the examples used in this section, it is assumed that the xDB Replication Server CLI commands are executed after you have made XDB_HOME/bin your current working directory, thereby eliminating the need to specify the full path of XDB_HOME/bin for each execution of the edb-repcli.jar file. For example, assuming xDB Replication Server is installed in the default installation directory you have issued the following command in Linux:
Whenever the repsvrfile parameter appears in the examples, file ~/pubsvrfile contains the publication server login information and is located in the user’s home directory while ~/subsvrfile contains the subscription server login information. For Windows, the equivalent usage is %HOMEPATH%\pubsvrfile and %HOMEPATH%\subsvrfile.
The examples in this section were run on Linux so you will see use of the Linux continuation character, which is a backslash (\), to show how an xDB Replication Server CLI command can be continued onto the next line if you do not want to wrap the text in your terminal window. For Windows, use the Windows continuation character, which is a caret (^).
The help command provides a syntax summary of all xDB Replication Server CLI commands.
The version command provides the xDB Replication Server CLI’s version number.
The repversion command provides the xDB Replication Server’s version number.
The file containing the publication server login information.
The encrypt command encrypts the text supplied in an input file and writes the encrypted result to a specified output file. Use the encrypt command to generate an encrypted password that can be copied into a text file that will be referenced by an xDB Replication Server CLI command that requires a user name and the user’s password.
-encrypt –input infile –output pwdfile
The text in infile is processed using the MD5 encryption algorithm, and the encrypted text is written to file pwdfile. Make sure that infile contains only the text that you want to encrypt and that there are no extraneous characters or empty lines before the text or after the text that you want to encrypt.
The file infile contains the word “password”.
The encrypt command is then executed producing a file named pwdfile.
The content of file pwdfile contains the encrypted form of “password”.
The uptime command prints the time interval since the publication server has been up and running.
The file containing the publication server login information.
The addpubdb command adds a publication database definition.
-repsvrfile pubsvrfile
{ -dbpassword encrypted_pwd | -dbpassfile pwdfile }
[ -urloptions jdbc_url_parameters ]
[ -filterrule filterid_1[,filterid_2 ] ...]
[ -nodepriority priority_level ]
The addpubdb command creates a new publication database definition. The addpubdb command displays a unique publication database ID that is assigned to the newly created publication database definition. The publication database ID is used to identify the publication database definition on which to operate when running other xDB Replication Server CLI commands.
See Section 5.2.2 for details on the database connection information that must be supplied when adding a publication database definition for a single-master replication system. See sections 6.2.2 and 6.3 for a multi-master replication system.
The file containing the publication server login information.
Specify oracle if the database is an Oracle database. Specify enterprisedb if the database is an Advanced Server database in Oracle compatible configuration mode. Specify postgresql if the database is a PostgreSQL database or an Advanced Server database in PostgreSQL compatible configuration mode. Specify sqlserver if the database is a Microsoft SQL Server database.
The port number on which the database server is listening for connections.
The encrypted password of the publication database user. See Section 8.3.4 for directions on using the encrypt command to generate an encrypted password.
Specify sid if the Oracle system ID (SID) is used to identify the publication database in the database parameter. Specify servicename if the Oracle service name is used to identify the publication database in the database parameter. Note: For Oracle 12c, use the service name.
Extended usage of JDBC URL parameters such as for support of SSL connectivity. (See Section 7.11 for information on SSL connectivity to the publication database.)
For MMR only: Applies to non-MDN nodes. Comma-separated list of filter IDs identifying the filter rules from the set of available table filters to enable on the corresponding tables in the new master node. Use the printpubfilterslist command to obtain the filter IDs for the available filter rules in the publication (see Section 8.3.17). Note: There must be no white space between the comma and filter IDs.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system. If omitted, the default is s.
For MMR only: Applies to non-MDN nodes. Set this option to true if you want the publication table definitions replicated from the master definition node when creating a new master node. Set this option to false if you have already created the table definitions in the new master node. If omitted, the default is true. Do not specify this parameter when creating the master definition node.
For MMR only: Applies to non-MDN nodes. Specify this option if you want an initial snapshot replication to be performed when creating the master node. Omit this option if you do not want an initial snapshot replication to be performed when creating the master node.
Note (For MMR only): Unless you intend to use the offline snapshot technique (see Section 7.9), it is suggested that you specify this option. An initial snapshot replication must be performed from the master definition node to every other master node before performing synchronization replications on demand (see Section 8.3.42) or by a schedule (see Section 8.3.44). If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that master node. The initial snapshot can also be taken by performing an on demand snapshot (see Section 8.3.41).
Set this option to true if you want the output from the snapshot to be displayed. Set this option to false if you do not want the snapshot output displayed. If omitted, the default is true.
Note: This option may be given only directly following the specification of the -initialsnapshot option.
For MMR only: Integer value from 1 through 10 assigning the priority level to a master node with 1 having the highest priority and 10 having the lowest priority.
Specify T to use the trigger-based method of synchronization replication for this publication database. Specify W to use the log-based (WAL) method of synchronization replication for this publication database. If omitted, the default is T.
The following example adds a publication database definition for an Oracle database. The encrypted password is given on the command line with the dbpassword parameter. A publication database ID of 1 is assigned to the database by the publication service.
The following example adds a publication database definition for an Advanced Server database. The encrypted password is read from a file named pwdfile with the dbpassfile parameter. A publication database ID of 2 is assigned to the database by the publication service.
The following example adds a publication database definition for a master node (other than the master definition node) in a multi-master replication system where an initial snapshot is not invoked (the initialsnapshot parameter is omitted). Filter rules with filter IDs 8 and 16 are applied to this master node. A node priority level of 3 is assigned to the master node.
Note: A publication must be created in the master definition node before creating additional master nodes. See Section 8.3.14 for the command to create a publication.
The printpubdbids command prints the publication database IDs of the publication database definitions.
The file containing the publication server login information.
The printpubdbidsdetails command prints the connection information for each publication database definition.
dbid:host:port:dbname:user
Note: The database user’s password is not displayed.
The file containing the publication server login information.
The port number on which the database server is listening for connections.
The printcontrollerdbid command prints the publication database ID of the controller database.
The file containing the publication server login information.
For MMR only: The printmdndbid command prints the publication database ID of the master definition node.
The file containing the publication server login information.
The updatepubdb command provides the ability to change the connection information for an existing publication database definition identified by its publication database ID.
-repsvrfile pubsvrfile
{ -dbpassword encrypted_pwd | -dbpassfile pwdfile }
[ -urloptions jdbc_url_parameters ]
[ -nodepriority priority_level ]
See Section 5.2.2 for details on the database connection information that must be supplied for a publication database definition for a single-master replication system. See sections 6.2.2 and 6.3 for a multi-master replication system.
The file containing the publication server login information.
The port number on which the database server is listening for connections.
The password of the database user in encrypted form. See Section 8.3.4 for directions on using the encrypt command to generate an encrypted password.
Specify sid if the Oracle system ID (SID) is used to identify the publication database in the database parameter. Specify servicename if the Oracle service name is used to identify the publication database in the database parameter. Note: For Oracle 12c, use the service name.
Extended usage of JDBC URL parameters such as for support of SSL connectivity. (See Section 7.11 for information on SSL connectivity to the publication database.) Specification of the urloptions parameter completely replaces any existing JDBC URL parameters that may have previously been specified with this database. Omission of the urloptions parameter deletes any existing JDBC URL parameters that may have previously been specified with this database.
For MMR only: Integer value from 1 through 10 assigning the priority level to a master node with 1 having the highest priority and 10 having the lowest priority.
The removepubdb command removes a publication database definition.
–repsvrfile pubsvrfile
See Section 7.6.7 for additional information on removing a publication database.
The file containing the publication server login information.
The gettablesfornewpub command lists the tables and views that are available for inclusion in a new publication from a given publication database definition.
-gettablesfornewpub –repsvrfile repsvrfile –pubdbid dbid
The file containing the publication server login information.
For the publication database definition identified by publication database ID 1, the tables available for inclusion in a publication are EDB.DEPT, EDB.EMP, and EDB.JOBHIST. The view available for inclusion in a publication is EDB.SALESEMP.
The createpub command creates a new publication.
-createpub pubname
-repsvrfile pubsvrfile
-tables schema_t1.table_1 [ schema_t2.table_2 ] ...
[ -views schema_v1.view_1 [ schema_v2.view_2 ] ...]
"ordinal_t1:filtername_t1:filterclause_t1"
[ "ordinal_t2:filtername_t2:filterclause_t2" ] ...]
"ordinal_v1:filtername_v1:filterclause_v1"
[ "ordinal_v2:filtername_v2:filterclause_v2" ] ...]
ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
[ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
[ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
The createpub command adds a new publication subordinate to the publication database definition with the publication database ID given by parameter pubdbid. If the publication is designated as snapshot-only by setting parameter reptype to s, then any views listed after the views parameter are ignored.
See Section 5.2.3 for additional information on creating a publication for a single-master replication system. See Section 6.2.3 for a multi-master replication system.
Note: The schema names, table names, and view names that you supply as values for the tables and views parameters are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
Specify s if the publication is to be a snapshot-only publication. Specify t if the publication is to allow synchronization replications.
The name of the schema containing the nth table of the tables parameter list. This value is case-sensitive.
The table name of the nth table in the tables parameter list. This value is case-sensitive.
For SMR only: The name of the schema containing the nth view of the views parameter list. This value is case-sensitive.
For SMR only: View name of the nth view in the views parameter list. This value is case-sensitive.
The filter clause to be applied to the table in the tables parameter list at the position indicated by ordinal_tn.
For SMR only: The ordinal number (that is, the position in the list counting from left to right starting with 1) of a view in the views parameter list to which an attribute is to be applied.
For SMR only: The filter clause to be applied to the view in the views parameter list at the position indicated by ordinal_vn.
For MMR only: For the conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling. The specified conflict resolution applies to the table in the position given by ordinal_tn counting from left to right in the tables parameter list. If omitted the default is E.
For MMR only: For the standby conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling. The specified conflict resolution applies to the table in the position given by ordinal_tn counting from left to right in the tables parameter list. If omitted the default is M.
For MMR only: For the conflict resolution option or the standby conflict resolution option, specify customhandler_tn as the function name with an optional schema prefix (that is, formatted as schema.function_name) as given in the CREATE FUNCTION command for the custom conflict handling function created for the table in the tables parameter list at the position indicated by ordinal_tn. The custom conflict handling function must be added to the master definition node. See Section 6.6.8.2 for an example of adding the custom conflict handling function using PSQL. The custom handler name option must be specified if and only if the conflict resolution option or the standby conflict resolution option is set for custom conflict handling with the C value.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system. If omitted, the default is s.
In the following example, a publication named dept_emp is created that contains the EDB.DEPT and EDB.EMP tables of an Oracle database. The replication method is synchronization.
In the following example, a publication named salesemp is created that contains the EDB.SALESEMP view of an Oracle database. The replication method is snapshot-only.
In the following example, a publication named analysts_managers is created that contains the edb.dept table and employees from the edb.emp table who are analysts or managers. The tables are in an Advanced Server database. The replication method is snapshot-only.
The following example creates a publication for a multi-master replication system. One table filter is defined on table edb.dept and three table filters are defined on table edb.emp. Table edb.dept is assigned node priority conflict resolution and latest timestamp as the standby conflict resolution strategy. Table edb.emp is assigned earliest timestamp conflict resolution and manual resolution (the default) as its standby strategy.
The printpublist command prints a list of publication names.
The file containing the publication server login information.
If the pubdbid parameter is specified, only the publication names subordinate to the publication database definition specified by dbid are printed. If the pubdbid parameter is omitted, all publication names subordinate to the publication server are printed.
The printpublishedtables command prints a list of tables and views that belong to the given publication.
-printpublishedtables pubname -repsvrfile pubsvrfile
The file containing the publication server login information.
The printpubfilterslist command prints a list of table filters that are defined in the given publication.
-printpubfilterslist pubname -repsvrfile pubsvrfile
The file containing the publication server login information.
The table filters in publication analysts_managers are printed.
The addtablesintopub command adds tables or views into an existing publication.
-repsvrfile pubsvrfile
[ -tables schema_t1.table_1 [ schema_t2.table_2 ] ...]
[ -views schema_v1.view_1 [ schema_v2.view_2 ] ...]
"ordinal_t1:filtername_t1:filterclause_t1"
[ "ordinal_t2:filtername_t2:filterclause_t2" ] ...]
"ordinal_v1:filtername_v1:filterclause_v1"
[ "ordinal_v2:filtername_v2:filterclause_v2" ] ...]
ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
[ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
[ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
The addtablesintopub command updates an existing publication identified by pubname. If the publication is snapshot-only, then any views listed after the views parameter are ignored.
See Section 7.6.3.1 for additional information on adding tables to a publication.
Note: The schema names, table names, and view names that you supply as values for the tables and views parameters are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
The name of the schema containing the nth table of the tables parameter list. This value is case-sensitive.
The name of the nth table in the tables parameter list. This value is case-sensitive.
For SMR only: The name of the schema containing the nth view of the views parameter list. This value is case-sensitive.
For SMR only: The name of the nth view in the views parameter list. This value is case-sensitive.
The filter clause to be applied to the table in the tables parameter list at the position indicated by ordinal_tn.
For SMR only: The ordinal number (that is, the position in the list counting from left to right starting with 1) of a view in the views parameter list to which an attribute is to be applied.
For SMR only: The filter clause to be applied to the view in the views parameter list at the position indicated by ordinal_vn.
For MMR only: For the conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling. The specified conflict resolution applies to the table in the position given by ordinal_tn counting from left to right in the tables parameter list. If omitted the default is E.
For MMR only: For the standby conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling. The specified conflict resolution applies to the table in the position given by ordinal_tn counting from left to right in the tables parameter list. If omitted the default is M.
For MMR only: For the conflict resolution option or the standby conflict resolution option, specify customhandler_tn as the function name with an optional schema prefix (that is, formatted as schema.function_name) as given in the CREATE FUNCTION command for the custom conflict handling function created for the table in the tables parameter list at the position indicated by ordinal_tn. The custom conflict handling function must be added to the master definition node. See Section 6.6.8.2 for an example of adding the custom conflict handling function using PSQL. The custom handler name option must be specified if and only if the conflict resolution option or the standby conflict resolution option is set for custom conflict handling with the C value.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system. Note: This parameter is not required and may be completely omitted. It is present to provide support for its usage in previous xDB Replication Server CLI versions.
In the following example, table edb.jobhist and view edb.salesemp are added to an existing publication named analysts_managers.
The removetablesfrompub command removes tables from a publication.
-repsvrfile pubsvrfile
[ -tables schema_t1.table_1 [ schema_t2.table_2 ] ...]
[ -views schema_v1.view_1 [ schema_v2.view_2 ] ...]
See Section 7.6.3.2 for additional information on removing tables from a publication.
Note: The schema names, table names, and view names that you supply as values for the tables and views parameters are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
The name of the schema containing the nth table of the tables parameter list. This value is case-sensitive.
The name of the nth table in the tables parameter list. This value is case-sensitive.
The name of the schema containing the nth view of the views parameter list. This value is case-sensitive.
The name of the nth view in the views parameter list. This value is case-sensitive.
In the following example, table edb.jobhist and view edb.salesemp are removed from the analysts_managers publication.
The addfilter command adds the definition of table filter rules to the specified publication.
See Section 8.3.38 for information on enabling table filter rules.
-addfilter pubname
–repsvrfile pubsvrfile
[ -tables schema_t1.table_1 [ schema_t2.table_2 ] ...]
[ -views schema_v1.view_1 [ schema_v2.view_2 ] ...]
"ordinal_t1:filtername_t1:filterclause_t1"
[ "ordinal_t2:filtername_t2:filterclause_t2" ] ...]
"ordinal_v1:filtername_v1:filterclause_v1"
[ "ordinal_v2:filtername_v2:filterclause_v2" ] ...]
See Section 2.2.12 for additional information on table filters.
Note: The schema names and table or view names that you supply as values for the tables or views parameters are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
The name of the schema containing the nth table of the tables parameter list. This value is case-sensitive.
The name of the nth table in the tables parameter list. This value is case-sensitive.
For SMR only: The name of the schema containing the nth view of the views parameter list. This value is case-sensitive.
For SMR only: The name of the nth view in the views parameter list. This value is case-sensitive.
The filter clause to be applied to the table in the tables parameter list at the position indicated by ordinal_tn.
For SMR only: The ordinal number (that is, the position in the list counting from left to right starting with 1) of a view in the views parameter list to which an attribute is to be applied.
For SMR only: The filter clause to be applied to the view in the views parameter list at the position indicated by ordinal_vn.
In the following example, a table filter is added to table edb.emp in publication analysts_managers.
The updatefilter command changes the filter clauses of the specified tables or views.
–repsvrfile pubsvrfile
"filterid_1:filterclause_1"
[ "filterid_2:filterclause_2" ] ...
See Section 2.2.12 for additional information on table filters.
The file containing the publication server login information.
Filter ID identifying the filter rule for which the filter clause is to be changed. Use the printpubfilterslist command to obtain the filter IDs for the available filter rules in the publication (see Section 8.3.17).
The filter clause with filter ID 26 in publication analysts_managers is modified.
The removefilter command deletes the table filter from the specified publication.
–repsvrfile pubsvrfile
-filterid filterid
See Section 2.2.12 for additional information on table filters.
The file containing the publication server login information.
Filter ID identifying the filter rule to be deleted. Use the printpubfilterslist command to obtain the filter IDs for the filter rules in the publication (see Section 8.3.17).
In the following example, the filter rule with filter ID 26 is removed from publication analysts_managers.
For MMR only: The printconfresolutionstrategy command prints the conflict resolution strategy and the standby conflict resolution strategy of the specified table.
–repsvrfile pubsvrfile
-table schema_t.table_name
See Section 6.6 for additional information on conflict resolution.
Note: The schema name and table or view name that you supply as values for the table parameter are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
The name of the schema containing table_name. This value is case-sensitive.
In the following example, the conflict resolution strategy on Advanced Server table edb.emp in publication emp_pub is printed.
For MMR only: The updateconfresolutionstrategy command changes the conflict resolution strategy or standby conflict resolution strategy of the specified table.
–repsvrfile pubsvrfile
-table schema_t.table_name
[ -customhandlername customhandler ]
See Section 6.8 for additional information on updating the conflict resolution strategy.
Note: The schema name and table or view name that you supply as values for the table parameter are case-sensitive. Unless quoted identifiers were used to build the database objects, Oracle names must be entered using uppercase letters (for example, EDB.DEPT), and Advanced Server names must be entered in lowercase letters (for example edb.dept). See Section 10.4.5 for additional information on quoted identifiers and case translation.
The file containing the publication server login information.
The name of the schema containing table_name. This value is case-sensitive.
For the conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling.
For the standby conflict resolution option, specify E for earliest timestamp conflict resolution, L for latest timestamp conflict resolution, N for node priority conflict resolution, M for manual conflict resolution, or C for custom conflict handling.
For the custom handler name option, specify customhandler as the function name with an optional schema prefix (that is, formatted as schema.function_name) as given in the CREATE FUNCTION command for the custom conflict handling function. The custom conflict handling function must be added to the master definition node. See Section 6.6.8.2 for an example of adding the custom conflict handling function using PSQL. The custom handler name option must be specified if and only if the conflict resolution option or the standby conflict resolution option is set for custom conflict handling with the C value.
The conflict resolution strategy on Advanced Server table edb.emp in publication emp_pub is modified to use latest timestamp conflict resolution with a standby strategy of node priority conflict resolution.
Custom conflict handling is set for the edb.dept table along with the custom conflict handling function edb.custom_conflict_dept.
For MMR only: The setasmdn command sets a master node to the role of master definition node.
-setasmdn pubdbid
–repsvrfile pubsvrfile
See Section 6.10 for additional information on setting the master definition node.
The file containing the publication server login information.
The setascontroller command sets a publication database to be designated as the controller database. The publication database may be the master database of a single-master replication system or a master node of a multi-master replication system.
–repsvrfile pubsvrfile
See Section 7.7 for additional information on setting the controller database.
The file containing the publication server login information.
The validatepub command checks if any of the definitions of the tables in the given publication have changed since the publication was created.
-validatepub pubname
–repsvrfile pubsvrfile
See Section 7.6.5 for additional information on validating publications.
The file containing the publication server login information.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system.
The validatepubs command checks if any of the definitions of the tables subordinate to the given publication database definition have changed since the publication was created.
–repsvrfile pubsvrfile
See Section 7.6.5 for additional information on validating publications.
The file containing the publication server login information.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system.
In the following example, the Oracle publication database definition identified by publication database ID 1 is validated.
The removepub command removes one or more publications.
-removepub pubname_1 [ pubname_2 ] ...
–repsvrfile pubsvrfile
See Section 7.6.6 for additional information on removing a publication.
The file containing the publication server login information.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system.
A publication named dept_emp is removed from a single-master replication system.
The replicateddl command applies an ALTER TABLE statement to a publication table in all databases of a replication system as well as updates the xDB Replication Server insert/update/delete triggers and shadow table associated with that publication table.
–repsvrfile pubsvrfile
-table schema_t.table_name
-ddlscriptfile script_file
See Section 7.8 for additional information on DDL change replication.
The file containing the publication server login information.
The name of the schema containing table_name. This value is case-sensitive.
The name of the table in the ALTER TABLE statement whose definition is to be modified. This value is case-sensitive.
Path to the file containing the ALTER TABLE statements.
The following example shows the addition of a column named title to table edb.emp. The ALTER TABLE statement is in the text file addcolumn.sql as shown by the following:
The replicateddl command is executed using the addcolumn.sql file to update the triggers and shadow tables on the master nodes:
For SMR only: The addsubdb command adds a subscription database definition.
-repsvrfile subsvrfile
{ -dbpassword encrypted_pwd | -dbpassfile pwdfile }
[ -urloptions jdbc_url_parameters ]
The addsubdb command creates a new subscription database definition. The addsubdb command displays a unique subscription database ID that is assigned to the newly created subscription database definition. The subscription database ID is used to identify the subscription database definition on which to operate when running other xDB Replication Server CLI commands.
See Section 5.3.2 for details on the database connection information that must be supplied when adding a subscription database definition.
The file containing the subscription server login information.
Specify oracle if the database is an Oracle database. Specify enterprisedb if the database is an Advanced Server database in Oracle compatible configuration mode. Specify postgresql if the database is a PostgreSQL database or an Advanced Server database in PostgreSQL compatible configuration mode. Specify sqlserver if the database is a Microsoft SQL Server database.
The port number on which the database server is listening for connections.
The encrypted password of the subscription database user. See Section 8.3.4 for directions on using the encrypt command to generate an encrypted password.
Specify sid if the Oracle system ID (SID) is used to identify the subscription database in the database parameter. Specify servicename if the Oracle service name is used to identify the subscription database in the database parameter. Note: For Oracle 12c, use the service name.
Extended usage of JDBC URL parameters such as for support of SSL connectivity. (See Section 7.11 for information on SSL connectivity to the subscription database.)
The following example adds a subscription database definition for an Oracle database. The encrypted password is given on the command line with the dbpassword parameter. A subscription database ID of 1 is assigned to the database by the subscription server.
The following example adds a subscription database definition for an Advanced Server database. The encrypted password is read from a file named pwdfile with the dbpassfile parameter. A subscription database ID of 2 is assigned to the database by the subscription server.
For SMR only: The printsubdbids command prints the subscription database IDs of the subscription database definitions.
The file containing the subscription server login information.
For SMR only: The printsubdbidsdetails command prints the connection information for each subscription database definition.
dbid:host:port:dbname:user
Note: The database user’s password is not displayed.
The file containing the subscription server login information.
The port number on which the database server is listening for connections.
For SMR only: The updatesubdb command provides the ability to change the connection information for an existing subscription database definition identified by its subscription database ID.
-repsvrfile subsvrfile
{ -dbpassword encrypted_pwd | -dbpassfile pwdfile }
[ -urloptions jdbc_url_parameters ]
See Section 5.3.2 for details on the database connection information that must be supplied for a subscription database definition.
The file containing the subscription server login information.
The port number on which the database server is listening for connections.
The password of the database user in encrypted form. See Section 8.3.4 for directions on using the encrypt command to generate an encrypted password.
Specify sid if the Oracle system ID (SID) is used to identify the subscription database in the database parameter. Specify servicename if the Oracle service name is used to identify the subscription database in the database parameter. Note: For Oracle 12c, use the service name.
Extended usage of JDBC URL parameters such as for support of SSL connectivity. (See Section 7.11 for information on SSL connectivity to the subscription database.) Specification of the urloptions parameter completely replaces any existing JDBC URL parameters that may have previously been specified with this database. Omission of the urloptions parameter deletes any existing JDBC URL parameters that may have previously been specified with this database.
For SMR only: The removesubdb command removes a subscription database definition.
-removesubdb –repsvrfile subsvrfile –subdbid dbid
See Section 5.5.6 for additional information on removing a subscription database.
The file containing the subscription server login information.
For SMR only: The createsub command creates a new subscription.
-createsub subname
-subsvrfile subsvrfile
-pubsvrfile pubsvrfile
-pubname pubname
[ -filterrule filterid_1[,filterid_2 ] ...]
The createsub command adds a new subscription subordinate to the subscription database definition with the subscription database ID given by parameter subdbid.
See Section 5.3.3 for additional information on creating a subscription.
The file containing the subscription server login information of the subscription server under which the new subscription is subordinate.
The file containing the publication server login information of the publication server under which the publication is subordinate to which the new subscription is to be associated.
Comma-separated list of filter IDs identifying the filter rules from the set of available table filters to enable on the corresponding tables in the new subscription. Use the printpubfilterslist command to obtain the filter IDs for the available filter rules in the publication (see Section 8.3.17). Note: There must be no white space between the comma and filter IDs.
In the following example, a subscription named dept_emp_sub is created in the Advanced Server subscription database identified by subscription database ID 2. The subscription is associated with a publication named dept_emp.
For SMR only: The printsublist command prints a list of subscription names.
-printsublist -repsvrfile subsvrfile -subdbid dbid
The file containing the subscription server login information.
The enablefilter command enables one or more filter rules on a single-master replication system subscription or on a multi-master replication system master node other than the master definition node.
The enablefilter command is used when it is desired to apply a filter rule to a subscription or a non-MDN node, but the filter rule did not yet exist or it was neglected to be included with the subscription or the non-MDN node when these components were initially created.
-repsvrfile pubsvrfile
{ -subname subname | -dbid dbid }
-filterids filterid_1 [ filterid_2 ] ...
See Section 2.2.12 for additional information on table filters.
•
•
The table filter was added to an existing publication using the addfilter command (see Section 8.3.20) or by the xDB Replication Console (see Section 7.6.4).
•
The table filter was added to an existing publication using the addfilter command (see Section 8.3.20) or by the xDB Replication Console (see Section 7.6.4).
For SMR: Use the enablefilter command or the xDB Replication Console (see Section 5.5.4).
For MMR: Use the enablefilter command or the xDB Replication Console (see Section 6.9).
The file containing the publication server login information.
For SMR only: The name of the subscription containing the tables on which the filter rules are to be enabled.
For MMR only: The publication database ID of the non-MDN node containing the tables on which the filter rules are to be enabled.
One or more filter IDs separated by space characters identifying the filter rules from the set of available table filters to enable on the corresponding tables in the SMR subscription specified by subname or in the MMR non-MDN node specified by dbid. Use the printpubfilterslist command to obtain the filter IDs for the available filter rules in the publication (see Section 8.3.17).
The disablefilter command disables one or more filter rules on a single-master replication system subscription or on a multi-master replication system master node other than the master definition node.
-repsvrfile pubsvrfile
{ -subname subname | -dbid dbid }
-filterids filterid_1 [ filterid_2 ] ...
See Section 2.2.12 for additional information on table filters.
For SMR: Use the disablefilter command or the xDB Replication Console (see Section 5.5.4).
For MMR: Use the disablefilter command or the xDB Replication Console. (see Section 6.9).
For either SMR or MMR: Use the removefilter command (see Section 8.3.22) or the xDB Replication Console (see Section 7.6.4).
The file containing the publication server login information.
For SMR only: The name of the subscription containing the tables on which the filter rules are to be disabled.
For MMR only: The publication database ID of the non-MDN node containing the tables on which the filter rules are to be disabled.
For SMR only: The dosnapshot command performs snapshot synchronization on the specified subscription in a single-master replication system.
-dosnapshot subname -repsvrfile subsvrfile
See Section 5.4.1 for additional information on performing snapshot replication.
The file containing the subscription server login information.
Set this option to true if you want the output from the snapshot to be displayed. Set this option to false if you do not want the snapshot output displayed. If omitted, the default is true.
For MMR only: The dommrsnapshot command performs snapshot synchronization on the specified master node in a multi-master replication system.
–repsvrfile pubsvrfile
The file containing the publication server login information.
Set this option to true if you want the output from the snapshot to be displayed. Set this option to false if you do not want the snapshot output displayed. If omitted, the default is true.
In the following example snapshot replication is performed on publication emp_pub to the target master node identified by publication database ID 9.
The dosynchronize command performs synchronization replication on the specified subscription for a single-master replication system, or for an entire multi-master replication system.
-dosynchronize { subname | pubname }
-repsvrfile { subsvrfile | pubsvrfile }
-dosynchronize subname –repsvrfile subsvrfile
-dosynchronize pubname -repsvrfile pubsvrfile -repgrouptype m
Note (For SMR only): The dosynchronize command can be used on a subscription without first having to perform a snapshot using the dosnapshot command. The dosynchronize command automatically performs the first required snapshot.
Note (For MMR only): Be sure an initial snapshot replication has been performed from the master definition node to every other master node in the multi-master replication system. If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that master node. The initial snapshot could be taken when the master node is first added (see Section 6.3 or Section 8.3.6) or by performing an on demand snapshot (see Section 6.5.1 or Section 8.3.41).
See Section 5.4.2 for additional information on performing synchronization replication for a single-master replication system. See Section 6.5.2 for a multi-master replication system.
For SMR only: The name of the subscription for which synchronization replication is to be performed.
For MMR only: The name of the publication for which synchronization replication is to be performed.
For SMR only: The file containing the subscription server login information.
For MMR only: The file containing the publication server login information.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system. If omitted, the default is s.
In the following example, synchronization replication is performed on publication emp_pub of a multi-master replication system. Note that the -repgrouptype m parameter is required in this case.
For SMR only: The confschedule command creates a schedule as to when recurring replications are to be initiated for a single-master replication system.
-confschedule subname –repsvrfile subsvrfile
{ -realtime no_of_sec |
-daily hour minute |
-weekly day_of_week hour minute |
-monthly month day_of_month hour minute |
-cronexpr "cron_expression"
If the remove parameter is specified, then the schedule is deleted from the subscription. No other parameters other than subname and repsvrfile can be specified in this case.
If the remove parameter is omitted, then the jobtype parameter and one of parameters realtime, daily, weekly, monthly, or cronexpr must be specified along with the subname and repsvrfile parameters. If there is an existing schedule for subscription subname, it will be replaced by the new schedule.
See Section 7.2 for additional information on creating a schedule.
The file containing the subscription server login information.
If the remove parameter is specified, then any existing schedule is removed from the subscription. If the remove parameter is not specified, then a schedule is created for the subscription.
Specify s if the scheduled replication is to be done by snapshot. Specify t if the scheduled replication is to be done by synchronization. If the associated publication is a snapshot-only publication, then -jobtype s must be used.
The day of the week. This can be any of the following values: SUN, MON, TUE, WED, THU, FRI, or SAT. This value is case insensitive so Sun and sun will work as well as SUN.
The month of the year. This can be any of the following values: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, or DEC. This value is case insensitive so Jan and jan will work as well as JAN.
The day of the month. This can be any integer greater than or equal to 1, and less than or equal to the number of days in month.
A cron expression. See appendix Section 10.4.3 for information on writing a cron expression.
For MMR only: The confschedulemmr command creates a schedule as to when recurring replications are to be initiated for a multi-master replication system.
Note: Be sure an initial snapshot replication has been performed from the master definition node to every other master node in the multi-master replication system. If a newly added master node did not undergo an initial snapshot, any subsequent synchronization replication initiated by a schedule may fail to apply the transactions to that master node. The initial snapshot could be taken when the master node is first added (see Section 6.3 or Section 8.3.6) or by performing an on demand snapshot (see Section 6.5.1 or Section 8.3.41).
-confschedulemmr pubdbid -pubname pubname
–repsvrfile pubsvrfile
{ -realtime no_of_sec |
-daily hour minute |
-weekly day_of_week hour minute |
-monthly month day_of_month hour minute |
-cronexpr "cron_expression"
If the remove parameter is specified, then the schedule is deleted from the publication. No other parameters other than pubdbid, pubname, and repsvrfile can be specified in this case.
If the remove parameter is omitted, then one of parameters realtime, daily, weekly, monthly, or cronexpr must be specified along with the pubdbid, pubname, and repsvrfile parameters. If there is an existing schedule for publication pubname, it will be replaced by the new schedule.
See Section 7.2 for additional information on creating a schedule.
The file containing the publication server login information.
If the remove parameter is specified, then any existing schedule is removed from the publication. If the remove parameter is not specified, then a schedule is created for the publication.
The day of the week. This can be any of the following values: SUN, MON, TUE, WED, THU, FRI, or SAT. This value is case insensitive so Sun and sun will work as well as SUN.
The month of the year. This can be any of the following values: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, or DEC. This value is case insensitive so Jan and jan will work as well as JAN.
The day of the month. This can be any integer greater than or equal to 1, and less than or equal to the number of days in month.
A cron expression. See appendix Section 10.4.3 for information on writing a cron expression.
In the following example, a schedule is created to perform synchronization replication on publication emp_pub subordinate to the master definition node whose publication database ID is 6. Replication is to occur daily at 8:00 AM.
The printschedule command prints a recurring replication schedule.
-printschedule { subname | pubname }
-repsvrfile { subsvrfile | pubsvrfile }
-printschedule subname –repsvrfile subsvrfile
-printschedule pubname -repsvrfile pubsvrfile -repgrouptype m
For SMR only: The name of the subscription for which the schedule is to be printed.
For MMR only: The name of the publication for which the schedule is to be printed.
For SMR only: The file containing the subscription server login information.
For MMR only: The file containing the publication server login information.
Specify s if this command applies to a single-master replication system. Specify m if this command applies to a multi-master replication system. If omitted, the default is s.
For SMR only: The updatesub command allows you to update certain metadata of a given subscription. This metadata allows the subscription server to find the host running the publication server that manages the publication associated with the subscription.
-updatesub subname
-subsvrfile subsvrfile
-pubsvrfile pubsvrfile
-host newpubsvr_ipaddress
-port newpubsvr_port
The updatesub command allows you to update the subscription metadata consisting of the IP address and port number identifying the publication server that is the parent of the publication associated with the subscription.
You would use the updatesub command in the scenario where you have built your replication system using IP addresses that are valid at that point in time. At some later point, the IP address assigned to the host running the publication server has changed.
You use the host and port parameters of the updatesub command to supply the new network address identifying the publication server.
See Section 5.5.3 for additional information on updating a subscription.
The file containing the subscription server login information for the subscription server in which subscription subname was created.
The file containing publication server login information for the publication server that manages the publication associated with subscription subname. Note that the values that you supply for newpubsvr_ipaddress and newpubsvc_port must be the same as the values set in fields host and port in file pubsvrfile.
The new IP address for the publication server that manages the publication associated with subscription subname. This value must be the same as the IP address specified for field host in file pubsvrfile.
The new port number for the publication server that manages the publication associated with subscription subname. This value must be the same as the port number specified for field port in file pubsvrfile.
If the publication server host IP address has been changed to 192.168.2.7, then make sure the publication server login information in file pubsvrfile.prop contains the new IP address as shown by the following:
To update the metadata for subscription dept_emp_sub so that its subscription server can find the new publication server host, run the following command:
For SMR only: The removesub command removes a subscription.
-removesub subname –repsvrfile subsvrfile
See Section 5.5.5 for additional information on removing a subscription.
The file containing the subscription server login information.
A subscription named dept_emp_sub is removed.
The confcleanupjob command creates a schedule as to when shadow table history is to be deleted.
-confcleanupjob pubdbid –repsvrfile pubsvrfile
{ -minutely no_of_minutes |
-hourly no_of_hours |
-daily hour |
-weekly day_of_week hour |
-cronexpr "cron_expression"
If the disable parameter is specified, then the schedule is deleted. No other parameters other than pubdbid and pubsvrfile can be specified in this case.
If the disable parameter is omitted, then the enable parameter and one of parameters minutely, hourly, daily, weekly, or cronexpr must be specified along with the pubdbid and pubsvrfile parameters.
See Section 7.5.1 for additional information on creating a schedule for shadow table history cleanup.
The file containing the publication server login information.
If the disable parameter is specified, then any existing shadow table history cleanup schedule is removed from the publication database definition. If the disable parameter is not specified, then enable must be specified.
The day of the week. This can be any of the following values: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, or SATURDAY. This value is case insensitive so Sunday and sunday will work as well as SUNDAY.
A cron expression. See appendix Section 10.4.3 for information on writing a cron expression.
The cleanshadowhistforpub command deletes the shadow table history for the specified publication.
–repsvrfile pubsvrfile
[ -mmrdbid dbid_1[,dbid_2 ] ...]
See Section 7.5.2 for additional information on cleaning up shadow table history.
The file containing the publication server login information.
For MMR only: The publication database ID of the master node for which the shadow table history is to be deleted. This parameter is required for a multi-master replication system specifying one or more comma-separated, publication database IDs. Note: There must be no white space between the comma and publication database IDs.
The cleanrephistoryforpub command deletes the replication history for the specified publication.
-cleanrephistoryforpub pubname –repsvrfile pubsvrfile
See Section 7.5.3 for additional information on cleaning up replication history.
The file containing the publication server login information.
The cleanrephistory command deletes the replication history for all publications in the specified publication server.
See Section 7.5.3 for additional information on cleaning up replication history.
The file containing the publication server login information.
In the following example, replication history is deleted for all publications in the publication server identified by the content of file pubsvrfile.prop.
The two databases being compared are referred to as the source database and the target database. The source database can be of type Oracle, EnterpriseDB, SQL Server, Sybase®, or MySQL®. The target database must be either Oracle or EnterpriseDB.
Note: The Data Validator does not validate columns having the following data types. Tables containing one or more columns of these types will only be partially validated.
•
•
•
•
•
•
•
•
Note: Regarding the usage of the Data Validator with tables in an xDB Replication Server single-master or multi-master replication system, be sure all synchronization replication between the source and target xDB Replication Server tables has been completed before using the Data Validator. If synchronization replication is still in progress, it is probable that the Data Validator will report differences in table content.
Step 1: When you install the xDB Replication Server product, the components for the Data Validator are installed as well. See Chapter 3 for information on installing the xDB Replication Server product.
XDB_HOME/etc
XDB_HOME/bin
runValidation.bat (Windows)
XDB_HOME\bin
Note: XDB_HOME is the directory where xDB Replication Server is installed. This may or may not be the same as the Postgres home directory depending upon how xDB Replication Server is installed.
Step 2: If you plan to use an Oracle database as the source or target database, download the Oracle JDBC driver and place it in the JAVA_HOME/jre/lib/ext directory.
Step 3: Edit the datavalidator.properties file located in the XDB_HOME/etc directory and specify the connection information for the source and target databases you want to compare.
The following are the parameters in the datavalidator.properties file.
Type of the source database. Values may be enterprisedb, oracle, sqlserver, sybase, or mysql.
The following is the initial content of the datavalidator.properties file after installation:
Step 4: Determine the location for the Data Validator logs directory.
The Data Validator generates a log file with a name formatted as datavalidator_yymmdd-hhmiss.log in the logs directory for each run.
If there are row differences between the source and target tables, a file with a name formatted as datavalidator_yymmdd-hhmiss.diff is also generated that contains output of the errors in diff format. Use a graphical diff tool like Kompare to view this file to highlight the specific differences.
The Data Validator attempts to create a subdirectory named logs within the XDB_HOME/bin directory the first time you invoke the Data Validator without the -ld option. If you do not invoke the Data Validator as the root account, it is likely that the run will fail as it attempts to create subdirectory logs in the XDB_HOME/bin directory where typically only the root account has this privilege.
•
Run the Data Validator as the root account. This enables the Data Validator to create the logs subdirectory within the XDB_HOME/bin directory, and then to create the log and diff files in the logs subdirectory.
•
Create the XDB_HOME/bin/logs directory structure before running the Data Validator. Modify the permissions on directory XDB_HOME/bin/logs so the operating system account you use to run the Data Validator has the privilege to create files in the directory.
•
Use the -ld log_directory_path option to allow the Data Validator to create the log and diff files in the specified directory location log_directory_path. Be sure the operating system account you use to run the Data Validator has the proper privileges to either create the lowest level subdirectory specified by log_directory_path if it does not already exist, or to create files within the specified directory if the full directory path already does exist.
The current working directory from which you invoke the Data Validator script runValidation.sh (runValidation.bat for Windows) must be the bin subdirectory containing the script (that is, XDB_HOME/bin).
[ option ] ...
schema_name is the name of the schema in the source database containing the tables to be validated. The choices for option are listed later in this section within the Options subsection.
[ option ] ...
The general syntax for all options except for --version and --help is shown by the following:
[ -ts schema ]
[ -it table_1 [,table_2 ] ... ]
[ -et table_1 [,table_2 ] ... ]
[ -ld log_directory_path ]
[ -ds { true | false } ]
[ -sdbms database_type ]
[ -sh host ]
[ -sp port ]
[ -sdb dbname ]
[ -su user ]
[ -spw password ]
[ -tdbms database_type ]
[ -th host ]
[ -tp port ]
[ -tdb dbname ]
[ -tu user ]
[ -tpw password ]
[ -bs row_count ]
[ -fs row_count ]
For clarity, the preceding syntax diagram shows only the single-character form of the option. The Options subsection lists both the single-character and multi-character forms of the options.
Specification of any database connection option (-sdbms through -tpw listed in the preceding syntax diagram) overrides the corresponding parameter in the datavalidator.properties file. See Section 9.1 for information on the datavalidator.properties file.
-ss, --source-schema schema
-ts, --target-schema schema
-it, --include-tables table_1 [,table_2 ] ...
-et, --exclude-tables table_1 [,table_2 ] ...
The tables within the source schema that are to be excluded from comparison. If omitted, only those tables specified with the -it option are included for comparison. If both the -it and -et options are omitted, all source schema tables are included for comparison. Note: There must be no white space between the comma and table names.
-srs, --skip-rowsonlyin-source { true | false }
When true is specified, the logging of differences for rows that exist only in the source database table are skipped. The default is false.
-srt, --skip-rowsonlyin-target { true | false }
When true is specified, the logging of differences for rows that exist only in the target database table are skipped. The default is false.
-srb, --skip-rowsin-both { true | false }
When true is specified, the logging of differences for rows that exist both in the source and target database tables with the same primary key, but with different non-primary key values are skipped. The default is false.
-ld, --logging-dir log_directory_path
Directory path to where the Data Validator log and diff files are to be created and stored. If log_directory_path does not exist, Data Validator attempts to create it. If a full directory path is not specified log_directory_path is created or assumed to be located relative to the XDB_HOME/bin subdirectory where the runValidation.sh script is invoked. (That is, the logs directory is XDB_HOME/bin/log_directory_path.) Be sure the operating system account used to invoke the runValidation.sh script has the privileges to create the directory if it does not already exist, or to create files in the specified directory if it does already exist. If omitted, the default is the XDB_HOME/bin/logs directory.
-ds, --display-summary { true | false }
Specify true to display only the Data Validator summary. This omits the source and target database connection information as well as the detailed breakdown of the results by source database table. Specify false to display all of the Data Validator results. The type and amount of information that is displayed at the command line console when the Data Validator is invoked is the same information that is also stored in the log file for that run. If omitted, the default is false (that is, all of the Data Validator results is displayed).
-sdbms, --source-dbms database_type
The type of the source database server. Supported types are oracle, enterprisedb, sqlserver, sybase, and mysql.
-sh, --source-host host
-sp, --source-port port
The port number on which the source database server is listening for connections.
-sdb, --source-database dbname
-su, --source-user user
-spw, --source-password password
-tdbms, --target-dbms database_type
-th, --target-host host
-tp, --target-port port
The port number on which the target database server is listening for connections.
-tdb, --target-database dbname
-tu, --target-user user
-tpw, --target-password password
-bs, --batch-size row_count
The -bs option specifies the number of rows to group in a batch to be used for comparison across the source and target database tables. For example, if a table contains 1000 rows, then a -bs setting of 100 requires 10 batch iterations to complete the comparison across the source and target databases. The Data Validator reads 100 rows, both from the source and target tables, and adds them in source and target buffers. The validation thread then reads the 100 rows from the source and target buffers and performs the comparison. It will then move to read and prepare the next 100 rows for comparison and so on. Note that the actual database round trips required to bring in 100 rows from the database depends on the -fs option for the fetch size. For example, an -fs setting of 100 needs just one round trip whereas an -fs setting of 10 requires 10 database round trips.
-fs, --fetch-size row_count
Performing data validation for tables that are quite large in size may cause the Data Validator to terminate with an out of heap space error when using the default fetch size of 5000 rows. Use the -fs option to specify a smaller fetch size to help avoid the out of heap space issue. The result set iteration will bring in as many rows as represented by the row_count value in a single database round trip.
The following lists the tables in schema EDB along with the content of tables DEPT and EMP in the Oracle source database:
The following lists the tables in schema public along with the content of tables dept and emp in the Advanced Server edb database:
•
The Oracle EDB schema contains one additional table named ORATAB that does not exist in the Advanced Server public schema.
•
The Oracle DEPT table contains one extra row with DEPTNO 50 that does not exist in the Advanced Server dept table.
•
The rows in the EMP table with EMPNO values 9001 and 9002 have column values that differ between the Oracle and Advanced Server tables
•
In this example, the JOBHIST table contains identical rows for both the Oracle and Advanced Server tables.
The content of the datavalidator.properties file is set as follows:
The following example compares all tables in the Oracle EDB schema against the Advanced Server public schema.
The Data Validator log files are created in directory /home/user/datavalidator_logs as specified with the -ld option. The operating system account used to invoke the runValidation.sh script has write access to the /home/user directory so the Data Validator can create the datavalidator_logs subdirectory.
All tables count: 4
Validated tables count: 3
Rows count: 38
Errors count: 3
Missing tables on the target database count: 1
Tables list:
- EDB.ORATAB
Tables having only unsupported datatypes count: 0
Tables having primary key limitation count: 0
Total time(s): 0.678
Rows per second: 56
•
There is one error in the DEPT table (the missing row).
•
There are two errors in the EMP table (the two rows with mismatching column values)
•
The JOBHIST table contains no errors.
•
The ORATAB table does not exist on the target database.
The following example includes only tables dept and emp with the -it option when comparing the Oracle EDB schema against the Advanced Server public schema.
The following example excludes tables ORATAB and jobhist with the -et option when comparing the Oracle EDB schema against the Advanced Server public schema. The -ds true option results in the display of only the Data Validator summary.
•
Oracle 10g Release 2 version 10.2.0.1.0 has been explicitly certified. Newer minor versions in the 10.2 line are supported as well.
•
Oracle 11g Release 2 version 11.2.0.2.0 has been explicitly certified. Newer minor versions in the 11.2 line are supported as well.
•
Oracle 12c version 12.1.0.2.0 has been explicitly certified. Newer minor versions in the 12.1 line are supported as well.
•
SQL Server 2008 version 10.50.1617.0 has been explicitly certified. Newer minor versions in the 10.50 line are supported as well.
•
SQL Server 2012 version 11.0.6020.0 has been explicitly certified. Newer minor versions in the 11.0 line are supported as well.
•
SQL Server 2014 version 12.0.5000.0 has been explicitly certified. Newer minor versions in the 12.0 line are supported as well.
Note: For Advanced Server version 11, certification has been initially performed against version 11 beta, but no issue is expected with the version 11 GA release.
Depending upon the database products you are using with xDB Replication Server (Oracle, SQL Server, PostgreSQL, or Advanced Server) along with the compatibility configuration mode if you are using Advanced Server, certain combinations of a source database server and a target database server are not permitted for a publication and its associated subscription in a single-master replication system.
Advanced Server supports two compatibility configuration modes of operation, which are the following:
•
Oracle compatible configuration mode. Operations are performed using Oracle syntax and semantics for data types, functions, database object creation, and so forth. This mode is useful when your applications are migrated from Oracle, or you want your applications built in an Oracle compatible fashion.
•
PostgreSQL compatible configuration mode. Operations are performed using native PostgreSQL syntax and semantics. This mode is useful when your applications are migrated from PostgreSQL, or you want your applications built in a PostgreSQL compatible fashion.
For more information on features supported in Oracle compatible configuration mode, see the Database Compatibility for Oracle Developer’s Guide located at:
For multi-master replication systems, each master node acts as both a source for all master nodes and a target for all master nodes. Thus, the permitted database servers comprising a particular multi-master replication system or cluster is determined by the overall composition of the cluster, which is initially established when selecting the database type of the master definition node (see Step 3 in Section 6.2.2).
•
PostgreSQL compatible cluster. All master nodes must consist of PostgreSQL database servers or Advanced Servers installed in PostgreSQL compatible configuration mode.
•
Advanced Server Oracle compatible cluster. All master nodes must consist of Advanced Servers installed in Oracle compatible configuration mode.
Step 1: Any pending backlog of transactions on the publication tables must be replicated before starting the upgrade process.
Step 2: After all pending transactions have been replicated to their target databases, stop the xDB Replication Server 6.1.x publication server and subscription server (see sections 5.2.1 and 5.3.1).
Step 3: Install xDB Replication Server 6.2. See Chapter 3 for instructions on installing xDB Replication Server, but note the differences described in the following steps.
Step 4: Following the acceptance of the license agreement in Step 11 of Section 3.1, the Select Components screen appears, but with the entries grayed out. The old xDB Replication Server components are replaced by the new ones in the old xDB Replication Server’s directory location. Click the Next button.
Step 5: The Existing Installation screen confirms that an existing xDB Replication Server installation was found. Click the Next button to proceed with the upgrade.
Step 6: On the Ready to Install screen, click the Next button.
Step 7: The remaining screens that appear confirm completion of the installation process and allow you to exit from Stack Builder or StackBuilder Plus.
Step 8: After installation completes, the publication server of the new xDB Replication Server product should be running, connected to the controller database used by xDB Replication Server 6.1. The subscription server may or may not be running at this point, however, that is an expected outcome of this process.
Step 9: Complete the publication server and subscription server configuration file setup.
In the XDB_HOME/etc directory, a new set of configuration files for xDB Replication Server version 6.2 are created. These files are named xdb_pubserver.conf.new and xdb_subserver.conf.new. The new configuration files contain any new configuration options added for xDB Replication Server 6.2.
The final set of active configuration files must be named xdb_pubserver.conf and xdb_subserver.conf.
In the XDB_HOME/etc/sysconfig directory, make sure the xDB Startup Configuration file xdbReplicationServer-62.config contains the parameter settings you wish to use with xDB Replication Server 6.2. See Section 2.3.1.4 for information on the xDB Startup Configuration file.
Step 10: Restart the publication server and the subscription server (see sections 5.2.1 and 5.3.1).
Step 11: Check the publication server and subscription server log files to verify that no errors have occurred (see Section 10.3.2.4).
Step 12: Adjust the publication server and subscription server port numbers if necessary.
The xDB Replication Server 6.2 publication and subscription servers are installed to use the default port numbers 9051 and 9052, respectively. If the xDB Replication Server 6.1.x replication systems used port numbers other than 9051 and 9052, then perform the modifications to correct this inconsistency as described in Section 10.2.3.
Step 13: You are now ready to use xDB Replication Server 6.2 to create new replication systems and manage existing ones.
Note: Be sure the repository configuration file edb.repo for xDB Replication Server 6.2 is set up in the /etc/yum.repos.d directory. See Section 3.3 for information.
Step 1: Any pending backlog of transactions on the publication tables must be replicated before starting the upgrade process.
Step 2: After all pending transactions have been replicated to their target databases, stop the xDB Replication Server 6.1.x publication server and subscription server (see sections 5.2.1 and 5.3.1).
Step 3: Save a copy of the following configuration files:
Step 4: If any Oracle publication or subscription databases are used in existing single-master replication systems, make sure a copy of the Oracle JDBC driver, version ojdbc5 or later, will be accessible by the publication server and subscription server where xDB Replication Server 6.2 will be installed. See Section 5.1.3.1 for information.
Note: There are two options available: Option 1) Copy the Oracle JDBC driver to the jre/lib/ext subdirectory of your Java runtime environment. Option 2) Copy the Oracle JDBC driver to the lib/jdbc subdirectory of the xDB Replication Server installation directory.
It is suggested that you perform option 1 (copy the Oracle JDBC driver to the jre/lib/ext subdirectory of your Java runtime environment).
If on the other hand you perform option 2, you must copy the Oracle JDBC driver to the /usr/ppas-xdb-6.2/lib/jdbc directory after you have installed xDB Replication Server 6.2.
Step 5: It is best to ensure that the controller database is up and running. The other publication and subscription databases of existing SMR and MMR systems do not need to be up and running.
Step 6: As the root account invoke the yum update command to begin the upgrade from xDB Replication Server 6.1.x to xDB Replication Server 6.2 as shown by the following:
Be sure to include the asterisk character (*) following ppas-xdb in order to update all xDB Replication Server components.
•
xDB Replication Server 6.1.x remains in directory location /usr/ppas-xdb-6.1, but with the files removed from the subdirectories such as bin and lib.
•
In the etc subdirectory, there may be the configuration files renamed as xdb_pubserver.conf.rpmsave and xdb_subserver.conf.rpmsave.
•
In the etc/sysconfig subdirectory, there may be the configuration file renamed as xdbReplicationServer-61.config.rpmsave.
•
In the /etc directory, there may be either one or two xDB Replication Configuration files named edb-repl.conf and possibly edb-repl.conf.rpmsave. The file edb-repl.conf should contain the connection and authentication information for the controller database used by the xDB 6.1.x publication server. The file edb-repl.conf.rpmsave contains only the new administrator user parameters admin_user and admin_password. Before starting the publication server and subscription server, be sure the controller database is up and running, and the edb-repl.conf file contains the controller database connection and authentication parameters.
Step 7: Complete the publication server and subscription server configuration file setup.
In the /usr/ppas-xdb-6.2/etc directory, a new set of configuration files for xDB Replication Server version 6.2 are created. These files are named xdb_pubserver.conf and xdb_subserver.conf. The new configuration files contain any new configuration options added for xDB Replication Server 6.2.
The old configuration files used by xDB Replication Server version 6.1.x might be found in the /usr/ppas-xdb-6.1/etc directory renamed as xdb_pubserver.conf.rpmsave and xdb_subserver.conf.rpmsave.
Note: If these files do not exist, use the ones you saved in Step 3.
The final set of active configuration files must be contained in directory /usr/ppas-xdb-6.2/etc named xdb_pubserver.conf and xdb_subserver.conf.
In the /usr/ppas-xdb-6.2/etc/sysconfig directory, make sure the xDB Startup Configuration file xdbReplicationServer-62.config contains the parameter settings you wish to use with xDB Replication Server 6.2. See Section 2.3.1.4 for information on the xDB Startup Configuration file.
Step 8: Restart the publication server and the subscription server (see sections 5.2.1 and 5.3.1).
Step 9: Check the publication server and subscription server log files to verify that no errors have occurred (see Section 10.3.2.4).
Step 10: Adjust the publication server and subscription server port numbers if necessary.
The xDB Replication Server 6.2 publication and subscription servers are installed to use the default port numbers 9051 and 9052, respectively. If the xDB Replication Server 6.1.x replication systems used port numbers other than 9051 and 9052 for the publication and subscription servers, then perform the modifications to correct this inconsistency as described in Section 10.2.3.
Step 11: You are now ready to use xDB Replication Server 6.2 to create new replication systems and manage existing ones.
The newly installed publication server and subscription server of xDB Replication Server 6.2 are configured to use the default port numbers 9051 and 9052, respectively. These port numbers are set in the xDB Startup Configuration file as described in Section 2.3.1.4.
If your xDB Replication Server 6.1.x replication systems were running under port numbers other than 9051 and 9052, some of your settings in xDB Replication Server 6.2 must be adjusted to continue to use these existing replication systems.
Note: The following changes regarding port 9052 and the subscription server are only needed if you are running a single-master replication system. If you are using only a multi-master replication system, then only the changes involving port 9051 and the publication server are needed.
•
To continue to use the old port numbers (other than 9051 and 9052) that were in use for xDB Replication Server 6.1.x, stop the publication and subscription servers. Change the settings of the PUBPORT and SUBPORT parameters in the xDB Startup Configuration file from 9051 and 9052 to the old port numbers used by xDB Replication Server 6.1.x. Restart the publication and subscription servers. Register the publication server and the subscription server with the old xDB Replication Server 6.1.x port numbers along with the admin user and password as described in sections 5.2.1 and 5.3.1.
•
To use the default port numbers 9051 and 9052 with the xDB Replication Server 6.1.x replication systems, you must replace the old port numbers with the default port numbers 9051 and 9052. Register the publication server and the subscription server with port numbers 9051 and 9052 along with the admin user and password as described in sections 5.2.1 and 5.3.1. For single-master replication systems only, you then need to change the port numbers stored in the control schema from the old port numbers to 9051 and 9052. First, perform the procedure described in Section 7.6.1.2, and then perform the procedure described in Section 5.5.3.
Resolution: Occurs when registering a publication server or subscription server. Verify the user name and password you enter matches the admin user name and password in the xDB Replication Configuration file on the host you are running the publication server or subscription server. See Section 2.3.1.3.
Resolution: Only one publication database definition can be created for any given database. (Oracle is the exception whereby more than one publication database definition can be created for the same Oracle database if different Oracle user names are specified in each publication database definition.)
Resolution: Occurs whenever a Java RMI connection cannot be made to the publication server, the subscription server, or a database server. Can occur when registering a publication or subscription server, adding a publication database or a subscription database, or identifying the publication server for a new subscription. Verify you have entered the correct host IP address and port number of the server. Verify the server is running (see Section 10.3.4.2). If the server is running on Linux, verify that in the /etc/hosts file, the host name is mapped to the correct network IP address, which matches the IP address returned by the Linux /sbin/ifconfig command, and also matches the IP address you entered in the Host field of the dialog box. Alternatively, instead of modifying the /etc/hosts file, set configuration option java.rmi.server.hostname to the IP address of the publication or subscription server (see Section 10.4.1.7). Do not use the loopback address 127.x.x.x for this entry.
Resolution: Occurs when attempting to save a publication database definition. The publication server cannot connect to the database server network location given in the Add Database dialog box. Verify that the correct IP address and port for the database server are given. Verify that the database server is running and is accessible from the host running the publication server.
Resolution: Occurs when attempting a snapshot replication from a publication database configured with the log-based method of synchronization replication (that is, WAL based logical replication), and the additional concurrent connection for logical replication exceeds the current setting, n, of the max_wal_senders configuration parameter in the postgresql.conf file. Increase the value of max_wal_senders in the postgresql.conf file of the database server running the publication database. Restart the database server containing the publication database. See Section 2.2.10.
Resolution: Occurs when attempting to create a subscription. If there are no publications in the specified publication server, then this error message is displayed.
Resolution: The metadata database objects from a prior publication already exist in the schema under which the publication server is attempting to create new metadata database objects. Perform the operation described in Section 10.3.4.3.
Resolution: Make sure all publications subordinate to the publication database definition have been removed. If no publications appear under the Publication Database node in the xDB Replication Console replication tree and the error persists, there may be a problem with the control schema objects. Perform the operation described in Section 10.3.4.3.
Resolution: The control schema objects under the Oracle publication database user schema or under the Postgres or SQL Server schemas _edb_replicator_pub, _edb_replicator_sub, or _edb_scheduler cannot be deleted by the publication server. The control schema objects or schemas may have already been deleted. The publication database definition cannot be removed using the xDB Replication Console. Perform the operation described in Section 10.3.4.3.
Resolution: Occurs when attempting to remove the publication database currently set as the controller database. Select another publication database to be used as the controller database. Use the Set As Controller option in the publication databases’ context menu to set this database as the controller database. You can then remove the original publication database. See Section 7.7.
Resolution: Occurs when attempting to set a publication database as the controller database and the database is not accessible by the publication server. Verify that the correct IP address and port has been defined in the publication database definition. Verify that the database server is running and is accessible from the host running the publication server.
Resolution: Occurs when attempting to save a subscription database definition. The subscription server cannot connect to the database server network location given in the Add Database dialog box. Verify that the correct IP address and port for the database server are given. Verify that the database server is running and is accessible from the host running the subscription server.
Database connection cannot be added. FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx", user "user_name", database "db_name", SSL off
Resolution: Occurs when attempting to save a subscription database definition. The subscription server is not permitted to connect to the database at the network location given in the Add Database dialog box. Verify that the database host IP address, port number, database user name, password, and database identifier are correct. Verify there is an entry in the pg_hba.conf file permitting access to the database by the given user name originating from the IP address where the subscription server is running.
Resolution: Occurs when attempting to add a subscription database. Verify that the xDB Replication Configuration file on the host running the subscription server contains an entry for a valid controller database. Verify that a publication database has been defined under the publication server as the controller database and its connection information is recorded in the xDB Replication Configuration file. See Section 2.3.1.3.
Resolution: All database servers in a multi-master replication system must be of the same type – either all PostgreSQL (or Advanced Server installed in PostgreSQL compatible configuration mode); or all Advanced Server installed in Oracle compatible configuration mode. This error message is displayed when attempting to add a master node and the database server type differs from the database server type of the master definition node. See Section 10.1.3.3.
Resolution: When a master node of a multi-master replication system is deleted using the xDB Replication Console or the xDB Replication Server CLI, the control schema objects that were created in the master node are also dropped. These include schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler. For the log-based method of synchronization replication there are shadow tables and triggers on the publication tables as well. If any of these control schema objects fail to be dropped, this error message is displayed. See Section 10.3.4.3 for directions on how to remove these control schema objects.
FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx", user "user_name", database "db_name", SSL off
Resolution: Occurs when attempting to save a publication database definition. The publication server is not permitted to connect to the database at the network location given in the Add Database dialog box. Verify that the database host IP address, port number, database user name, password, and database identifier are correct. Verify there is an entry in the pg_hba.conf file permitting access to the database by the given user name originating from the IP address where the publication server is running.
Resolution: Occurs when attempting to define a filter rule on a column with a binary data type in a publication table. Filter rules are not permitted on such columns. See Section 2.2.12.3.
Resolution: When adding a filter rule on a publication table, the same filter name or the same filter clause (WHERE clause) cannot be used more than once on a given table. Modify the duplicate filter name or filter clause so it is unique for the table.
Resolution: A snapshot replication must be performed before the first synchronization replication. Perform an on demand snapshot replication.
Resolution: This warning is given when localhost or 127.0.0.1 is specified as the host address of a replication system component. If is strongly recommended that all replication system components are identified by their specific IP address on the network.
Resolution: Either the user does not have the trigger creation privilege or there is a database server problem. The database server message is displayed as part of the error.
Resolution: A database server of type database_type cannot be used in a multi-master replication system. Only Advanced Server or PostgreSQL database servers may be used as master nodes in a multi-master replication system.
Resolution: When creating a subscription in a single-master replication system or creating a master node other than the master definition node in a multi-master replication system, only one filter may be selected for a given table. Uncheck the additional boxes in the Apply column under the Filter Rules tab if more than one box is selected.
Resolution: Occurs when creating an Oracle publication or subscription database definition. Copy the Oracle JDBC driver file ojdbcx.jar to subdirectory lib/jdbc of where the publication server or subscription server is installed on the host running the publication server or subscription server. Restart the publication server or subscription server.
Resolution: Occurs when attempting to add a second master node to a multi-master replication system, but no publication has been defined under the master definition node. Create a publication under the master definition node, then add the additional master nodes. See Section 6.2.3.
Resolution: Synchronization replication failed due to the unavailability of a target database. See the publication server log file for details. See Section 10.3.2.
Resolution: Master nodes are still defined in a multi-master replication system in which an attempt is being made to delete the publication from the master definition node. All master nodes (other than the master definition node) must be deleted first before deleting the publication from the master definition node. Perform this deletion process with the xDB Replication Console or xDB Replication Server CLI.
Resolution: Warning issued when you attempt to remove a publication with subscriptions associated with it. You can remove the publication, but the subscriptions are no longer usable and should be removed as well.
Resolution: Only one publication is supported in a multi-master replication system and only one such multi-master replication system can exist for an xDB Replication Server installation.
Resolution: You cannot perform synchronization replication on a snapshot-only publication. Perform snapshot replication instead.
Resolution: Occurs when creating an Oracle or SQL Server publication database definition and the current controller database is not a Postgres database (that is, the controller database is an Oracle or SQL Server database). In order to create an Oracle or SQL Server publication database, create and designate a Postgres publication database as the controller database. See Section 7.7.
Parent table table_name is not selected when its child tables are part of the publication list.
Resolution: Table selected for a publication has a foreign key referencing a parent table that has not been chosen for the publication. This is only a warning that the parent table will not be part of the subscription.
Resolution: Occurs when attempting synchronization replication and the controller database is not accessible by the publication server. Verify that the correct IP address and port has been defined in the publication database definition of the controller database. Verify that the database server is running and is accessible from the host running the publication server.
Resolution: For a Postgres publication, verify that the publication database user has CREATE ON DATABASE privilege on the publication database, or the database user is a superuser.
Resolution: In Postgres, it is possible to create a table with no columns. A publication is not allowed to include a Postgres table with no columns since the corresponding subscription table cannot be created in Oracle.
Publication cannot be created. Publication publication_name already exists on the publisher server. Please choose a different name and then proceed.
Resolution: Publication names must be unique within a publication server. Enter a different publication name.
Publication cannot be created. Table schema.table_name replica identity is set to replica_identity_setting. To define a Filter, the table replica identity should be set to FULL.
Resolution: Occurs when a table filter is attempted to be defined on a publication table used in a log-based replication system. Use the ALTER TABLE statement to change REPLICA IDENTITY to FULL. See Section 2.2.12.3.
Publication cannot be created. Table table_name does not contain a primary key. Transactional replication is not supported for a non-pk table.
Resolution: All tables used for synchronization replication must have primary keys. Create a primary key on the table or add the table to a snapshot-only publication.
Resolution: For a Postgres publication that is not for snapshot-only, the publication database user must be able to create triggers on the publication tables. In order to do this, the publication database user must have the privilege to execute the ALTER TABLE statement on the publication tables and the publication database user must have CREATE and USAGE privileges on the schema containing the publication tables. Verify that one of the following is true: 1) All the tables in the publication are owned by the publication database user and the user has CREATE and USAGE privileges on the publication tables’ schemas, or 2) the publication database user is a superuser.
Publication cannot be removed. Reason: Publication publication_name cannot be removed. Reason: Error: cannot drop table _edb_replicator_pub.rrst_schema_table_name because other objects depend on it.
Resolution: PL/pgSQL custom conflict handler functions may exist in the master definition node that are dependent upon the publication’s shadow tables. Drop the custom conflict handler functions before deleting the publication.
Publication cannot be updated. Reason: The parent table schema.table_name is selected for removal while it has one or more child tables in the publication list. Make sure that parent-child dependency holds in the publication tables.
Resolution: Choose the child tables for removal as well as the parent table.
Resolution: A given publication cannot be used in both a multi-master replication system and a single-master replication system.
Resolution: The publication does not exist for a given subscription. The subscription is no longer usable and must be removed.
Resolution: Remove the subscription, remove tables from the publication, then add the subscription.
Resolution: Occurs when attempting to create the publication database definition and the specified publication database user does not have the privilege to create a schema in database db_name. Grant the CREATE privilege on the database to the publication database user
Resolution: Verify that the publication server is running. See Section 10.3.4.2. Verify that the database server hosting the controller database specified in the xDB Replication Configuration file is running and the publication server is connected to it. See Section 2.3.1.3.
Resolution: May be caused by characters in the publication data that are illegal for the character set of the subscription database. Check the snapshot replication failure log file or the database server log file. See Section 10.4.1.2.
Resolution: See Section 10.1.3 for supported database server configurations. Use Oracle products for Oracle to Oracle replication.
Resolution: Occurs when attempting to add a publication database definition with the log-based method of synchronization replication, and the max_replication_slots configuration parameter in the postgresql.conf file is not set to a large enough value to accommodate the additional database. Increase the value of the max_replication_slots parameter and restart the database server. See Section 2.2.10 for additional information.
Subscription subscription_name already exists on the subscriber server. Please choose a different name and then proceed.
Resolution: Subscription names must be unique within a subscription server. Enter a different subscription name.
Subscription subscription_name cannot be removed. Reason: Publication does not exist on the publication server.
Resolution: Warning issued if the subscription you are attempting to remove does not have an associated publication. You can still remove the subscription.
Resolution: You cannot remove a subscription database definition if there are subordinate subscriptions. Remove the subscriptions first.
Resolution: The Subscription node you are trying to select no longer represents an existing subscription. The subscription may have been removed by a concurrent xDB Replication Console or xDB Replication Server CLI session. Click the Refresh icon in the xDB Replication Console toolbar to display the current replication tree.
Resolution: Verify that the subscription server is running. See Section 10.3.4.2
Resolution: Synchronization replication failed to complete for all target databases in the multi-master replication system due to the unavailability of some target database. See the publication server log file for details. See Section 10.3.2.
Resolution: Oracle doesn’t log changes for a large object column. Such a column cannot be referenced in the triggers that log changes to the shadow tables. Use snapshot-only replication instead.
Resolution: Occurs when testing the connection of a publication or subscription database definition. The publication or subscription server cannot connect to the database server network location given in the Add Database dialog box. Verify that the correct IP address and port for the database server are given. Verify that the database server is running and is accessible from the host running the publication or subscription server.
Database connection information test failed. FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx", user "user_name", database "db_name", SSL off
Resolution: Occurs when testing the connection of a publication or subscription database definition. The publication or subscription server is not permitted to connect to the database at the network location given in the Add Database dialog box. Verify that the database host IP address, port number, database user name, password, and database identifier are correct. Verify there is an entry in the pg_hba.conf file permitting access to the database by the given user name originating from the IP address where the publication or subscription server is running.
Resolution: Verify that the database server is running. For Oracle, verify that the Oracle listener program lsnrctl is running.
Resolution: Occurs when attempting to add a publication database definition with the log-based method of synchronization replication (that is, WAL based logical replication), and the publication database user is not a superuser or does not have REPLICATION privilege. Grant the publication database user the appropriate privilege or specify a different database user who has the appropriate privilege for logical replication as the publication database user. See Section 2.2.10.
Resolution: Occurs when attempting to add a publication database definition with the log-based method of synchronization replication (that is, WAL based logical replication), and there is no entry in the pg_hba.conf file where the DATABASE field is set to replication for user_name. The pg_hba.conf file of the target database server must contain a replication entry for the publication database user name specified when creating the publication database definition. See Section 2.2.10.
Resolution: Occurs when attempting to add a publication database definition with the log-based method of synchronization replication (that is, WAL based logical replication), and the additional concurrent connection for logical replication exceeds the current setting, n, of the max_wal_senders configuration parameter in the postgresql.conf file. Increase the value of max_wal_senders in the postgresql.conf file of the database server running the publication database. Restart the database server containing the publication database. See Section 2.2.10.
Resolution: Occurs when attempting to create a publication database definition with the log-based method of synchronization replication (that is, WAL based logical replication), and the Postgres database server is not version 9.4 or later. Only Postgres database servers of version 9.4 or later support the log-based method of synchronization replication. See Section 2.2.10.
Resolution: The DDL statements in the text file specified for the DDL change replication feature contain syntax errors or are not supported by the DDL change replication feature. See Section 7.8.
Resolution: Occurs when attempting an operation such as performing synchronization replication or creating a schedule on a publication or subscription database that cannot be accessed by the xDB Replication Console. Verify that the publication and/or subscription servers are running. Verify that the database servers of the publication and/or subscription databases are running.
Resolution: Occurs when attempting to create an MMR publication database definition and the publication server is unable to create the control schema objects in the new publication database. This typically results when creating a second publication database definition and the publication server is unable to copy by snapshot the control schema objects from the controller database to the new publication database. The publication database user of the new publication database must be a superuser. In addition, in system catalog table pg_catalog.pg_authid, column rolcatupdate must be set to true for this superuser. See Section 10.4.4.
Unable to create Subscription subscription_name. Reason: Connection rejected: FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx" user "user_name", database "db_name", SSL off
Resolution: Occurs when creating a subscription. The subscription server running on host xxx.xxx.xx.xxx could not access the controller database. Verify that the pg_hba.conf file on the controller database server permits access from the subscription server host
Resolution: Occurs when creating a subscription. The subscription server running on host xxx.xxx.xx.xxx could not access the publication database. Verify that the pg_hba.conf file on the publication database server permits access from the subscription server host.
Resolution: The subscription database type is not supported for the intended publication database type. See Section 10.1.3.2 for a list of permitted source and target database server configurations.
Resolution: The subscription server was unable to create a subscription table definition in the intended target schema. Typically, the reason is that a table with the same name already exists in the target schema of the subscription database. This can occur if you create a subscription, then remove it, but fail to drop the table definitions created under the target schema, then try to create the subscription a second time.
Resolution: Occurs when attempting to create an SMR publication database definition and the publication server is unable to create the control schema objects in the new publication database. This typically results when creating a second publication database definition and the publication server is unable to copy by snapshot the control schema objects from the controller database to the new publication database. The publication database user of the new publication database must be a superuser. In addition, in system catalog table pg_catalog.pg_authid, column rolcatupdate must be set to true for this superuser. See Section 10.4.4.
Unable to perform snapshot for subscription subscription_name. Reason: DB-42501: com.edb.util.PSQLException: ERROR: permission denied for relation pg_class.
Resolution: Occurs when attempting a snapshot replication. The database user of the database receiving the snapshot must be a superuser. In addition, in system catalog table pg_catalog.pg_authid, column rolcatupdate must be set to true for this superuser. See Section 10.4.4.
Unable to perform snapshot for subscription subscription_name. Reason: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx", user "user_name", database "db_name", SSL off
Resolution: Occurs when attempting a snapshot replication. The publication server running on host xxx.xxx.xx.xxx could not access the subscription database. Verify that the pg_hba.conf file on the subscription database server permits access from the publication server host.
Unable to synchronize. Reason: FATAL: no pg_hba.conf entry for host "xxx.xxx.xx.xxx", user "user_name", database "db_name", SSL off
Reason: Occurs during an implicit synchronization following snapshot replication. The publication server running on host xxx.xxx.xx.xxx could not access the subscription server’s controller database. Verify that the pg_hba.conf file on the subscription server permits access from the publication server host using network address xxx.xxx.xx.xxx.
Resolution: The control schema objects in the publication database may have been deleted or corrupted. For an Oracle publication database the control schema objects are located in the publication database user’s schema. For a Postgres or SQL Server publication database the metadata database objects are located in schemas _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler. See Section 10.3.4.3.
Resolution: An Oracle publication database user must have CONNECT, RESOURCE, and CREATE ANY TRIGGER privileges.
/var/log/xdb-x.x/mtk.log
POSTGRES_HOME\.enterprisedb\xdb\x.x\mtk.log
POSTGRES_HOME is the home directory of the Windows postgres account (enterprisedb account for Advanced Server installed in Oracle compatible configuration mode). The specific location of POSTGRES_HOME is dependent upon your version of Windows. The xDB Replication Server version number is represented by x.x.
See Section 10.4.1.1 for more information on setting log file options.
View the publication server and subscription server log files pubserver.log[.n] and subserver.log[.n] in the following directory:
POSTGRES_HOME\.enterprisedb\xdb\x.x
[.n] is an optional, integer suffix whose presence depends upon the logging.file.count configuration option described in Section 10.4.1.1.
POSTGRES_HOME is the home directory of the Windows postgres account (enterprisedb account for Advanced Server installed in Oracle compatible configuration mode). The specific location of POSTGRES_HOME is dependent upon your version of Windows. The xDB Replication Server version number is represented by x.x.
Note: The severity level of messages logged in these files can be controlled by a configuration option. See Section 10.4.1.1.
For Linux only: View the publication service and subscription service startup log files edb-xdbpubserver.log and edb-xdbsubserver.log as well as the service script log files edb-xdbpubserver_script.log and edb-xdbsubserver_script.log in directories /var/log/edb/xdbpubserver and /var/log/edb/xdbsubserver. These log files contain the output from the scripts used to start the publication server and subscription server, and can typically be used to confirm the port number on which the publication and subscription servers were started.
Note: The publication service and subscription service startup log files are not generated for Windows and Mac OS X operating systems.
See Section 2.3.1.3 for information on the xDB Replication Configuration file.
10.3.2.6 Oracle Errors
The directory given by parameter USER_DUMP_DEST contains errors given by user processes.
The directory given by parameter BACKGROUND_DUMP_DEST contains errors given by the Oracle background processes.
Step 1: Verify that the database server of the publication database, the database server of the subscription database (for single-master replication systems), and the database servers of the master nodes (for multi-master replication systems) are all running.
Step 2: When viewing information in the xDB Replication Console, click the Refresh icon in the toolbar to ensure you are viewing the most current information, especially after making a configuration change to your replication system.
Step 3: Verify that the publication server and the subscription server (for single-master replication systems) are running. If they are not running and cannot be started see Section 10.3.4.2.
Step 4: If you are using an Oracle publication or subscription database, verify that the Oracle JDBC driver file has been copied to the XDB_HOME/lib/jdbc directory. XDB_HOME is the location where you installed xDB Replication Server.
Step 5: Verify that the necessary privileges have been granted to the publication database user.
•
In the msdb database, verify that the database user mapped to the SQL Server login given in the publication database definition has EXECUTE and SELECT privileges on schema dbo.
•
For any database user that will be updating the publication tables, verify that these database users have EXECUTE, SELECT, and INSERT privileges on the schema containing the xDB Replication Server metadata database objects.
Step 6: Verify that the necessary privileges have been granted to the subscription database user.
Step 7 (For Linux only): Verify that the network IP address returned by the /sbin/ifconfig command either matches the IP address associated with the host name in the /etc/hosts file (see Section 5.1.6.2), or matches the IP address specified with the java.rmi.server.hostname configuration option in the publication and subscription server configuration files (see Section 10.4.1.7).
Note: The subscription server only applies to single-master replication systems.
Step 1: Check the pubserver.log and subserver.log files for errors.
Step 2: Check the log file of the database server running the controller database for errors.
Step 3: Verify that the user name and password in the xDB Replication Configuration file on the hosts running the publication server and subscription server match a database user name and password in the database server running the controller database that the publication server and subscription server are attempting to access.
Step 4: If the controller database is a Postgres database, verify that the pg_hba.conf file of its Postgres database server has entries that allow access to the controller database from the IP addresses of the hosts running the publication server and subscription server by the user name in the xDB Replication Configuration file.
In the following example, the SMR publication database edb as well as the three MMR master node databases mdnnode, mmrnode_a, and mmrnode_b are all managed by the same publication server, which connects to the controller database designated in the xDB Replication Configuration file. Thus, all publication databases edb, mdnnode, mmrnode_a, and mmrnode_b contain what should be the same control schema information.
shared_controller_repconsole
In the preceding example, subscription database subdb contains a control schema object that may have to be deleted if control schema deletion is performed on the publication database.
After you have performed this deletion process, single-master replication systems must then be recreated following the directions in sections 5.2 onward. A multi-master replication system must be recreated following the directions in sections 6.2 onward.
Step 1: Stop the publication server.
Step 2: Stop the subscription server.
Step 3: Look for the control schema objects contained within a publication database. In the example used in this section, pubuser is the publication database user name. The publication consists of two tables – dept and emp.
For Oracle only: See Section 5.2.4.1 for a list of Oracle control schema objects.
For SQL Server only: See Section 5.2.4.2 for a list of SQL Server control schema objects.
For Postgres only: See Section 5.2.4.3 for a list of Postgres control schema objects.
Step 4: If the schema that is supposed to contain the control schema objects (the publication database user name for Oracle, or the control schema you created or selected when configuring a SQL Server publication database along with _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler, or _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler for Postgres) is missing, or there are missing database objects under the control schema, then you may need to complete the process of removing all remaining control schema objects.
Step 5: For single-master replication systems, the subscription database contains a single control schema object in the form of a table named rrep_txset_health. See Section 5.3.4 for a listing of this control schema object for each type of subscription database.
Step 6: If at this point, all control schemas and control schema objects appear intact in all publication databases and all subscription databases, then chances are that the problem lies elsewhere. Do not go proceed with any further steps in this section. Instead, recheck the checklist in Section 10.3.3.
Step 7: Repeat this step for every publication database to delete its control schema and control schema objects.
For Oracle only: If the publication user name still exists, then log onto SQL*Plus or any other Oracle database administration utility and drop all control schema objects owned by the publication user. Alternatively, you can drop the publication database user along with its database objects using the cascade option, but the publication database user must be recreated and privileges reassigned if you intend to rebuild your replication systems. See Section 5.1.4 for directions on creating the publication database user. The following example illustrates use of the cascade option:
For SQL Server only: If any of the control schema objects listed in Step 3 still exist, then log onto the SQL Server command line program, sqlcmd, or SQL Server Management Studio and drop these objects. The following example assumes some of the control schema objects were created under schema pubuser. The other control schema objects are created under _edb_replicator_pub, _edb_replicator_sub, and _edb_scheduler. The publication tables are dept and emp located in schema edb.
The control schema objects under the _edb_replicator_pub schema are dropped as shown by the following:
For SQL Server 2008 only: Drop the following control schema objects when the publication database is SQL Server 2008:
For SQL Server 2012, 2014 only: Drop the following control schema objects when the publication database is SQL Server 2012 or 2014:
Drop the _edb_replicator_pub control schema:
The control schema objects under the _edb_replicator_sub schema as well as the schema itself are dropped as shown by the following.
Note (For SQL Server 2012, 2014): When the publication database is SQL Server 2012 or 2014, the first table in the following list, rrep_common_seq, does not exist. Therefore do not issue the first DROP TABLE _edb_replicator_sub.rrep_common_seq command.
The control schema objects under the _edb_scheduler schema as well as the schema itself are dropped as shown by the following:
The control schema objects under the pubuser schema are dropped as shown by the following:
For Postgres only: If any of the schemas _edb_replicator_pub, _edb_replicator_sub, or _edb_scheduler still exist in the publication database, drop the schema and all of its database objects. The following example shows a connection established in psql to the publication database edb. The DROP SCHEMA CASCADE statement is then used to drop the schemas.
Step 8: Repeat this step for every subscription database to delete its control schema and control schema object.
Delete this table in all subscription databases. For SQL Server and Postgres subscription databases, delete the parent schema _edb_replicator_sub as well. For Oracle subscription databases, the parent schema is not generated by xDB Replication Server, so it your decision as to whether to keep or delete the parent schema.
For Oracle only: The RREP_TXSET_HEALTH table is created in the subscription database user’s schema. Drop this table.
For SQL Server only: The rrep_txset_health table is created in the schema named _edb_replicator_sub. Drop this table and schema.
For Postgres only: The rrep_txset_health table is created in the schema named _edb_replicator_sub. Drop this table and schema.
Step 9: In the xDB Replication Configuration file, delete the lines containing the following parameters: user, password, host, port, database, and type.
Keep the lines with the following parameters: admin_user, admin_password, and license_key (if it exists).
See Section 2.3.1.3 for information on the xDB Replication Configuration file. See Section 3.5 for the file system location of the xDB Replication Configuration file.
Step 10: Start the publication server.
Step 11: Start the subscription server.
Step 12: In the replication tree you should see the following:
Step 13: You will need to recreate the replication system as described in sections 5.2 onward for a single-master replication system. See sections 6.2 onward for a multi-master replication system.
As described in Section 2.2.10.2 logical replication slots are used for the log-based method of synchronization replication. While a log-based replication system is in use, these replication slots remain connected to the Postgres databases. When the replication system is removed, these replication slots are also deleted.
The active column indicates whether or not the replication slot is active.
To deactivate an active replication slot, first stop the publication server. If the active column of the replication slot now displays f for false then you can remove the replication slot.
The following now shows that replication slot xdb_79910_5 for database mmrnode has been deactivated:
Now, the dropped replication slot does not appear when the pg_replication_slots directory is queried:
The configuration options for the publication server are set and passed in a text file called the publication server configuration file with file name xdb_pubserver.conf.
The configuration options for the subscription server are set and passed in a text file called the subscription server configuration file with file name xdb_subserver.conf.
See Section 3.5 for the directory locations of these files.
Step 1: The publication and subscription server configuration files are created during xDB Replication Server installation and already contain all of the configuration options as comments with their default settings.
Step 2: Restart the publication or subscription server.
Note: The options described in this section apply to the publication server and the subscription server unless otherwise specified.
See Section 10.3.2.4 for additional information on the publication and subscription server log files.
See Section 10.3.2.2 for additional information on the Migration Toolkit log file.
Set the logging.level option to control the severity of messages written to the publication server log file and the subscription server log file.
Set the logging.file.size option to control the maximum file size (in megabytes) of the publication server log file and the subscription server log file.
Note: If logging.file.count is set to 0, the setting of logging.file.size is ignored. The log file is allowed to grow without limit.
The default value is 50 megabytes.
Set the logging.file.count option to control the number of files in the log file rotation history of the publication server log file and the subscription server log file.
A non-zero value of n specifies the maximum number of log files that are to be created.
Note: In the remaining discussion the publication server log file named pubserver.log is used as an example. For the subscription server, the log file is named subserver.log.
•
Specify a value of 0 to disable log file rotation and create a single, unlimited size log file named pubserver.log. This log file will grow to an unlimited size ignoring any setting of logging.file.size.
•
Specify a value of 1 to disable log file rotation and create a single, limited size log file named pubserver.log. The log file is deleted and a new one is created each time the log file reaches the size limit set by logging.file.size.
•
Specify a value of 2 or greater to enable log file rotation. All log file names have an integer suffix (for example, pubserver.log.0, pubserver.log.1, pubserver.log.2).
When log file rotation is enabled, the log file with the greatest integer suffix contains the oldest messages. When there are enough messages to generate every file in the history rotation, the oldest messages are in pubserver.log.n-1 where n is the setting of logging.file.count. Log file pubserver.log.0 is the current, active log file containing the most recent messages.
When log file rotation is enabled and the current, active log file (pubserver.log.0) reaches the size specified by logging.file.size, then the following events occur:
•
The log file containing the oldest messages (pubserver.log.n-1) is deleted.
•
Each remaining log file is renamed with the next greater integer suffix (pubserver.log.m is renamed to pubserver.log.m+1 with m varying from 0 to n-2).
Note: This option applies to the publication server only.
Set the mtk.logging.file.size option to control the maximum file size (in megabytes) of the Migration Toolkit log file.
The default value is 50 megabytes.
Note: This option applies to the publication server only.
Set the mtk.logging.file.count option to control the number of files in the log file rotation history of the Migration Toolkit log file.
A non-zero value of n specifies the maximum number of history log files that are to be created.
•
Specify a value of 0 to disable log file rotation and create a single, limited size log file named mtk.log. The log file is deleted and a new one is created each time the log file reaches the size limit set by mtk.logging.file.size.
•
Specify a value of 1 or greater to enable log file rotation. All log file names have an integer suffix (for example, mtk.log.1, mtk.log.2).
Log file mtk.log is the current, active log file containing the most recent messages.
When the current, active log file (mtk.log) reaches the size specified by mtk.logging.file.size, then the following events occur:
•
Each remaining log file with a suffix is renamed with the next greater integer suffix (mtk.log.m is renamed to mtk.log.m+1 with m varying from 1 to n-1).
•
Log file mtk.log is renamed to mtk.log.1.
Note: The options described in this section apply to the publication server only.
Note: This option does not alter null characters encountered in columns with binary data types such as Oracle RAW and BLOB data types.
char is a single character you want to substitute for the null character. For example, the following combination will replace each null character with the hash symbol #.
Note: The option described in this section applies to the subscription server only.
By default, column CHECK constraints from publication tables are migrated to the subscription table definitions when the subscription is created. Set this option to true if you do not want CHECK constraints as part of the subscription table definitions.
Setting this option to true is useful if the CHECK constraint is based on a built-in function supported by the publication database server, and this built-in function does not exist in the subscription database server.
Note: The option described in this section must be set to the same value for both the publication server and the subscription server.
Note: This feature applies only for subscriptions in an Advanced Server database. It does not apply to subscriptions in a PostgreSQL database.
•
Range Partitioning. Ranges of values defined on a column determine which tablespace a row is stored.
•
List Partitioning. A list of values defined on a column determines which tablespace a row is stored.
•
Hash Partitioning. An algorithm on a column generates a hash key, which determines which tablespace a row is stored.
Note: If you are using Advanced Server, table partitioning using Oracle compatible table partitioning syntax is an available feature. See the section on table partitioning in the Database Compatibility for Oracle Developer’s Guide for information. See Section 7.10 for information on including Postgres partitioned tables in a replication system. The importPartitionAsTable option described in this section applies only to table partitioning in an Oracle database.
The importPartitionAsTable option controls what happens when an Oracle partitioned table is part of the publication.
Depending upon the Oracle partitioned table type and the setting of the importPartitionAsTable option one of the following may occur:
When importPartitionAsTable=false (the default setting), the following occurs:
Note: If there are subscription tables created as sets of Advanced Server inherited tables, then you must also set the enableConstBeforeDataLoad option in the publication server configuration file to true. See Section 10.4.1.6 for information on the enableConstBeforeDataLoad option.
When importPartitionAsTable=true, the following occurs:
Setting the importPartitionAsTable option to true allows you to replicate a broader range of Oracle partitioned table types, but as normal Advanced Server tables without simulating partitions by using inheritance.
Note: The option described in this section applies to the publication server only.
oraJDBCCustomURL=customURL_string
The parameters prefixed with a dollar sign ($) are dynamically replaced based on the actual connection values specified when adding the Oracle publication database (see Section 5.2.2). Alternatively, the parameters prefixed with a dollar sign can be replaced by hardcoded values in the URL string in which case these hardcoded values override what is specified when adding the publication database.
Note: The options described in this section apply to the publication server only unless otherwise specified.
When JDBC COPY is used in snapshot replication, the data delimiter between column values is an escaped tab character (\t). Set this option to false if you do not want to escape the tab delimiter character.
When JDBC COPY is used in snapshot replication, the data delimiter between column values is an escaped tab character (\t). Set this option to change the data delimiter character.
c denotes the single replacement character for the data delimiter.
The enableConstBeforeDataLoad option controls whether or not table constraints, including triggers, are re-enabled before loading data into target tables. The default process is that the tables are loaded first, and then the constraints are enabled afterwards.
Note: The option described in this section applies to the publication server and the subscription server.
An alternative method to modifying the /etc/hosts file so that the host name is associated with a non-loopback IP address as discussed in Section 5.1.6.2 is to specify the network IP address using the java.rmi.server.hostname option.
For example, instead of modifying the /etc/hosts file to look like the following for a publication or subscription server running on host 192.168.2.19:
Note: The option described in this section applies to the publication server only.
Note: Using pgAgent job scheduling has significance only if Postgres is the publication database.
Note: You must have pgAgent installed and running on the host where the publication database resides.
When the pgdbschedule option is set to true, xDB Replication Server uses the pgAgent job scheduler instead of the default Quartz job scheduler.
•
Scheduling shadow table history cleanup in the publication database. See Section 7.5.1 for information on scheduling shadow table history cleanup.
Note: The option described in this section applies to the publication server only.
The event history cleanup job is scheduled to run every day at 12 AM to remove completed, historical, event and replication history data from the control schema xdb_events, xdb_events_status, xdb_pub_replog, and xdb_pub_table_replog tables that are older than n days. By default the history data older than seven days is removed.
Specify a value of 0 to cleanup all, completed, event history and replication history data, regardless of its age.
See Section 7.5.4 for information on cleaning up event and replication history.
Note: The option described in this section applies to the publication server only.
Set ddlChangeTableLock to false if you do not want an exclusive lock placed on the table before applying the DDL change. This option should be set to false only if there are no write transactions expected on the target table. If write transactions do occur, they may not be recorded by the replication system.
See Section 7.8 for information on DDL change replication.
Note: The option described in this section applies to the publication server only.
If you wish to maintain zero transaction count records in the replication history after the publication server is restarted, set persistZeroTxRepEvent to true. Otherwise, zero transaction count records are no longer available once the publication server is restarted.
See Section 7.4 for information on viewing replication history.
Note: This option applies to the publication server only.
When skipTablePrivileges is set to false, which is the default value, the database user privileges on the publication tables in the master definition node are granted to the same database users on the publication tables in the newly created non-MDN node.
If you do not want the publication server to grant these database user privileges to the non-MDN publication tables and shadow tables when defining the non-MDN node, set skipTablePrivileges to true. In this case, you must explicitly grant the privileges on the publication tables and corresponding shadow tables in the non-MDN node for any database user that you wish to provide update access to on these tables. See Step 2 of Section 5.1.4.3 for information regarding the required privileges.
Note: This option applies to the subscription server only.
Note: This option applies only when both the publication database and the subscription database are Postgres databases.
When skipTablePrivileges is set to true, which is the default value, no database user privileges are granted on these subscription tables to any database user. By default the subscription database user specified when the subscription database definition is created (see Section 5.3.2) is the owner of the subscription tables.
If however, you do want the subscription server to grant database user privileges to the subscription tables for the same database users that already have access privileges to the publication tables, set skipTablePrivileges to false in the subscription server configuration file. (The setting of skipTablePrivileges in the publication server configuration file is ignored for this process in a single-master replication system.)
Note: This option applies to the publication server only.
When using the log-based method of synchronization replication the walTxSetCreationInterval option controls the time interval between creations of the transaction sets, which affects the size of the transaction set (that is, the batch size). The default setting results in the creation of a transaction set every 5,000 milliseconds (5 seconds) assuming changes to the publication tables to be replicated are available.
If the TPM rate is on a higher end, the walTxSetCreationInterval option should be set to a relatively low value.
The default value is 5000 milliseconds.
The walStreamQueueLimit option defines the upper limit for the number of WAL entries that can be held in the queue pending for processing at a point in time. Once the queue becomes full, the WAL stream receiver blocks additions until space becomes available in the queue as transaction entries are popped out of the queue for processing.
The pendingTxSetThreshold option defines the upper threshold limit for the number of pending transaction sets that when reached, causes the extraction of transaction data from the WAL stream and its parsing to be put on hold until the pending transactions are processed.
Note: This option applies to the publication server only.
The jdbc.pool.validationQueryTimeout option controls the timeout setting when a validation query is executed at the time of allocating a connection from the pool. This is the amount of time in seconds before an exception is returned if the connection validation query does not succeed.
If you need to change the password in the xDB Replication Configuration file, you must first encrypt the password. Use the encrypt command of the xDB Replication Server CLI to generate the encrypted form of the password from its plain text form given in an input file.
Step 1: Create a text file with the password you wish to encrypt. Do not leave any white space before or after the password.
The following example shows the text newpassword in the input file passfile:
Step 2: Use the edb-repcli.jar file to execute the xDB Replication Server CLI with the encrypt command by first including the Java bin directory in your PATH environment variable and making XDB_HOME/bin your current working directory.
For example, assuming /usr/bin contains the java executable program and xDB Replication Server is installed into the POSTGRES_INSTALL_HOME directory, perform the following:
Step 3: Copy and paste the encrypted password into the xDB Replication Configuration file.
A cron expression is a text string used to express a schedule of dates and times. The Linux cron tool uses a cron expression to schedule the execution of a job. xDB Replication Server uses the Quartz job scheduling system for scheduling replications.
ss mi hr dd mm dow [ yyyy ]
0 - 59
0 - 59
0 - 23
1 - 31 or ?
Day of the month – if dow is given, then dd must be specified as ?
1 - 12 or JAN - DEC
1 – 7 or SUN – SAT or ?
Day of the week – if dd is given, then dow must be specified as ? (3-letter day of the week abbreviations are not case sensitive)
1970 - 2099
MON,WED,FRI – Every Monday, Wednesday, and Friday
MON-FRI – Every Monday through Friday
0 10 14 * * ? – Every day of every month at 2:10 PM
x/i
Specifies an increment, i, starting with x
0 0/10 * * * ? – Every 10 minutes starting on the hour for every day of every month (e.g., 8:00:00, 8:10:00, 8:20:00)
When used in the day of the month (dd) field, means the last day of the month
0 30 15 L 8 ? – Every August 31st at 3:30 PM
30 0 12 ? AUG L – The next Saturday in August at 30 seconds past 12:00 noon
xxxL
When used in the day of the week field (dow) following a day of the week, means the last xxx day of the month
30 0 12 ? AUG 6L – The last Friday in August at 30 seconds past 12:00 noon
xW
Used in the day of the month field (dd) following a day of the month, x, to specify the weekday closest to x without going over into the next or previous month.
1W – The weekday closest to the 1st of the month. If the 1st is a Wednesday, the result is Wednesday the 1st. If the 1st is a Sunday, the result is Monday the 2nd. If the 1st is a Saturday, the result is Monday the 3rd because the result does not go into the previous or following month.
xxx#n
Used in the day of the week field (dow) to specify the nth xxx day of the month
2#3 – The third Monday of the month (2 = Monday, 3 = third occurrence)
•
In the Postgres system catalog table pg_catalog.pg_authid, the column rolcatupdate is set to true for the row identifying the superuser attempting to update a system catalog table. This requirement applies only to Postgres version 9.4 or earlier. The column rolcatupdate no longer exists in Postgres 9.5 or later.
If the Update Catalogs property is set to No, click the secondary mouse button on the user name in the Object Browser and choose Properties from the menu. Select the Role Privileges tab, check the Can Modify Catalog Directly box, and click the OK button.
A quoted identifier is an identifier created with its name enclosed within double quote characters ("). The text enclosed within double quotes is stored as the object identifier name exactly as given with no default case translation of alphabetic characters. Quoted identifiers occur in both Oracle and Postgres.
For example, CREATE TABLE "MyTable" … produces a table name that is stored in the database system’s data dictionary as MyTable. References to this table must be made using an uppercase M, an uppercase T, and lowercase letters for the rest of the name.
In Oracle, the default case translation is to uppercase. For example, CREATE TABLE MyTable … would result in an object identifier name of MYTABLE.
In Postgres, the default case translation is to lowercase. For example, CREATE TABLE MyTable … would result in an object identifier name of mytable.
The SQL_VARIANT data type defines a column so that the individual values in that column may be of different data types. For example, the same SQL_VARIANT column can store values that have been explicitly cast as character, integer, numeric, and date/time.
However, if a table containing a SQL_VARIANT column is to be replicated to a Postgres database, the usage of the column in Postgres is restricted to a single data type to which all the values in the SQL_VARIANT column are implicitly convertible (that is, without the use of explicit casting). For example, an integer value is implicitly convertible to a FLOAT data type, but a floating point value is not implicitly convertible to an INTEGER data type.
•
The values stored within the SQL_VARIANT columns of the table to be replicated must be implicitly convertible to the same data type in Postgres.
•
If there is more than one table with SQL_VARIANT columns to be replicated to the same Postgres database, then all such SQL_VARIANT columns must contain values that are implicitly convertible to the same data type in Postgres.
In the Postgres subscription database, you define a domain named sql_variant that maps to an underlying data type to which all values in the SQL_VARIANT columns are implicitly convertible.
The following example shows how to set up replication for a table containing a SQL_VARIANT data type used to store numeric values, but of different data types.
The following query uses a function named SQL_VARIANT_PROPERTY to show the values stored in column f2 and their data types.
In the Postgres subscription database, create a domain named sql_variant with an underlying data type that is compatible with the values that are stored in the SQL Server SQL_VARIANT column:
After replication occurs, the subscription table is created using the sql_variant domain in place of the SQL_VARIANT data type of the publication table.
At the bottom of the following Object Browser window, note the presence of the sql_variant domain under the Domains node of the public schema.