Adding a Publication Database (addpubdb) v6.2

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

See Adding a Publication Database 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 Adding the Primary definition node and Creating Additional Primary nodes for a multi-master replication system.

Parameters

pubsvrfile

The file containing the publication server login information.

-dbtype

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.

host

The IP address of the host on which 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 for directions on using the encrypt command to generate an encrypted password.

pwdfile

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

-oraconnectiontype

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.

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 Section 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 obtain the filter IDs for the available filter rules in the publication (see Printing a List of Filters in a Publication). Note: There must be no 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. If omitted, 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 have already created the table definitions in the new primary node. If omitted, the default is true. Do not specify this parameter when creating the primary definition node.

Note

(For MMR only): Unless you intend to use the offline snapshot technique (see Loading Tables From an External Data Source (Offline Snapshot), it is suggested that you specify this option. An initial snapshot replication must be performed 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 did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that primary node. The initial snapshot can also be taken 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 to be performed when creating the primary node. Omit this option if you do not want an initial snapshot replication to be performed when creating the primary node.

Note

(For MMR only) Unless you intend to use the offline snapshot technique (see Loading Tables From an External Data Source (Offline Snapshot)), it is suggested that you specify this option. An initial snapshot replication must be performed 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 did not undergo an initial snapshot, any subsequent synchronization replication may fail to apply the transactions to that primary node. The initial snapshot can also be taken by performing an on demand snapshot (see Section Take a Multi-Master Snapshot) or by a schedule (see Configuring a Multi-Master Schedule).

-verboseSnapshotOutput

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.

priority_level

For MMR only: Integer value from 1 through 10 assigning the priority level to a primary node with 1 having the highest priority and 10 having 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. If omitted, the default is T.

Examples

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.

$ 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

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.

$ 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

The following 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

The following example adds a publication database definition for a primary node (other than the primary 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 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