Adding a publication database (addpubdb) v7

The addpubdb command adds a publication database definition.

Synopsis

-addpubdb
  -repsvrfile pubsvrfile
  -dbtype { oracle | enterprisedb | postgresql | sqlserver }
  -dbhost host
  -dbport port
  -dbuser user
{ -dbpassword encrypted_pwd | -dbpassfile pwdfile }
[ -oraconnectiontype { sid | servicename } ]
  -database dbname
[ -urloptions jdbc_url_parameters ]
[ -filterrule filterid_1[,filterid_2 ] ...]
[ -repgrouptype { m | s } ]
[ -replicatepubschema { true | false } ]
[ -initialsnapshot
  [ -verboseSnapshotOutput { true | false } ] ]
[ -nodepriority priority_level ]
[ -changesetlogmode { T | W } ]

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 Replication Server CLI commands.

See Adding a publication database for details on the database connection information you must supply when adding a publication database definition for a single-master replication system. See Adding the primary definition node and Creating more primary nodes for a multi-master replication system.

Parameters

pubsvrfile

The file containing the publication server login information.

-dbtype

Specify the values as shown in the table.

ValueDatabase
oracleOracle
enterprisedbEDB Postgres Advanced Server database in Oracle-compatible configuration mode
postgresqlPostgreSQL database or an EDB Postgres Advanced Server database in PostgreSQL-compatible configuration mode
sqlserverMicrosoft SQL Server

host

The IP address of the host where the publication database server is running.

port

The port number on which the database server is listening for connections.

user

The publication database user name.

encrypted_pwd

The encrypted password of the publication database user. See Encrypting passwords to learn how to use the encrypt command to generate an encrypted password.

pwdfile

The file containing the encrypted password of the publication database user.

-oraconnectiontype

Specify sid to use the Oracle system ID (SID) to identify the publication database in the database parameter. Specify servicename to use the Oracle service name to identify the publication database in the database parameter.

Note

For Oracle 12c, use the service name.

dbname

The Postgres or SQL Server database name, the Oracle SID, or the Oracle service name of the publication database.

jdbc_url_parameters

Extended usage of JDBC URL parameters such as for support of SSL connectivity. See Preparing using secure sockets layer (SSL) connections for information on SSL connectivity to the publication database.

filterid_n

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 primary node. Use the printpubfilterslist command to get the filter IDs for the available filter rules in the publication (see Printing a list of filters in a publication). Do not use any white space between the comma and filter IDs.

-repgrouptype

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 default is s.

-replicatepubschema

For MMR only: Applies to non-MDN nodes. Set this option to true if you want the publication table definitions replicated from the primary definition node when creating a new primary node. Set this option to false if you already created the table definitions in the new primary node. The default is true. Don't specify this parameter when creating the primary definition node.

Unless you intend to use the offline snapshot technique (see Loading tables from an external data source (offline snapshot), we suggest that you specify this option. You must perform an initial snapshot replication from the primary definition node to every other primary node before performing synchronization replications on demand (see Performing a synchronization) or by a schedule (see Configuring a multi-master schedule). If a newly added primary node didn't undergo an initial snapshot, any later synchronization replication might not apply the transactions to that primary node. You can also take the initial snapshot by performing an on-demand snapshot (see Take a multi-master snapshot).

-initialsnapshot

For MMR only: Applies to non-MDN nodes. Specify this option if you want an initial snapshot replication performed when creating the primary node. Omit this option if you don't want an initial snapshot replication performed when creating the primary node.

Note

Unless you intend to use the offline snapshot technique (see Loading tables from an external data source (offline snapshot)), we suggest that you specify this option. You must perform an initial snapshot replication from the primary definition node to every other primary node before performing synchronization replications on demand (see Performing a synchronization) or by a schedule (see Configuring a multi-master schedule). If a newly added primary node didn't undergo an initial snapshot, any later synchronization replication might not apply the transactions to that primary node. You can also take the initial snapshot by performing an on-demand snapshot (see Take a multi-master snapshot) or by a schedule (see Configuring a multi-master schedule).

-verboseSnapshotOutput

Set this option to true if you want to display the output from the snapshot. Set this option to false if you don't want to display the snapshot output. The default is true.

Use this option after the -initialsnapshot option.

priority_level

For MMR only: Integer value from 1 through 10 assigning the priority level to a primary node. 1 has the highest priority and 10 has the lowest priority.

-changesetlogmode

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. The default is T.

Examples

This 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.

$ java -jar edb-repcli.jar -addpubdb -repsvrfile ~/pubsvrfile.prop \
>   -dbtype oracle -dbhost 192.168.2.6 -dbport 1521 \
>   -dbuser pubuser -dbpassword ygJ9AxoJEX854elcVIJPTw== \
>   -oraconnectiontype sid \
>   -database xe \
>   -repgrouptype s
Adding publication database...
Publication database added successfully. Publication database id:1

This example adds a publication database definition for an EDB Postgres 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.

$ java -jar edb-repcli.jar -addpubdb -repsvrfile ~/pubsvrfile.prop \
>   -dbtype enterprisedb -dbhost 192.168.2.7 -dbport 5444 \
>   -dbuser pubuser -dbpassfile ~/pwdfile \
>   -database edb \
>   -repgrouptype s
Adding publication database...
Publication database added successfully. Publication database id:2

This example adds a publication database definition for a primary definition node in a multi-master replication system.

$ java -jar edb-repcli.jar -addpubdb -repsvrfile ~/pubsvrfile.prop \
>   -dbtype enterprisedb -dbhost 192.168.2.6 -dbport 5444 \
>   -dbuser pubuser -dbpassword ygJ9AxoJEX854elcVIJPTw== \
>   -database edb \
>   -repgrouptype m \
>   -nodepriority 1
Adding publication database...
Publication database added successfully. Publication database id:3

This example adds a publication database definition for a primary node (other than the primary definition node) in a multi-master replication system. An initial snapshot isn't invoked (the initialsnapshot parameter is omitted). Filter rules with filter IDs 8 and 16 are applied to this primary node. A node priority level of 3 is assigned to the primary node.

Note

A publication must be created in the primary definition node before creating additional primary nodes. See Creating a Publication for the command to create a publication.

$ java -jar edb-repcli.jar -addpubdb -repsvrfile ~/pubsvrfile.prop \
>   -dbtype enterprisedb -dbhost 192.168.2.7 -dbport 5444 \
>   -dbuser MMRuser -dbpassword ygJ9AxoJEX854elcVIJPTw== \
>   -database MMRnode \
>   -filterrule 8,16 \
>   -repgrouptype m \
>   -nodepriority 3
Adding publication database...
Replicating publication schema...
Publication database added successfully. Publication database id:24