Creating a publication (createpub) v7

The createpub command creates a publication.

Synopsis

-createpub pubname 
-repsvrfile pubsvrfile 
-pubdbid dbid 
-reptype { s | t } 
[ { -tables schema_t1.table_1 [schema_t2.table_2] ... | -alltables   
    [ schema1 [ schema2 ] ... ] } ]
[ { -views schema_v1.view_1 [ schema_v2.view_2 ] ... | -allviews 
    [ schema_v1 [ schema_v2 ] ... ] } ]
[ -tablesfilterclause 
    "schema_t1.table_1:filtername_t1:filterclause_t1" 
  [ "schema_t2.table_2:filtername_t2:filterclause_t2" ] ...] 
[ -viewsfilterclause 
    "schema_v1.view_1:filtername_v1:filterclause_v1" 
  [ "schema_v2.view_2:filtername_v2:filterclause_v2" ] ...] 
[-defaultconflictresolution {E|L|N|M}]
[-defaultstandbyconflictresolution {E|L|N|M}]
[ -conflictresolution 
    schema_t1.table_1:{ E | L | N | M | C:customhandler_t1 } 
  [ schema_t2.table_2:{ E | L } N | M | C:customhandler_t2 } ] ...] 
[ -standbyconflictresolution 
    schema_t1.table_1:{ E | L | N | M | C:customhandler_t1 } 
  [ schema_t2.table_2:{ E | L } N | M | C:customhandler_t2 } ] ...] 

The createpub command adds a 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 Adding a publication for more information on creating a publication for a single-master replication system. See Adding a publication 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, you must enter Oracle names using uppercase letters (for example, EDB.DEPT) and EDB Postgres Advanced Server names in lowercase letters (for example edb.dept). See Quoted identifiers and default case translation for more information.

Parameters

pubname

The publication name to give to the new publication.

pubsvrfile

The file containing the publication server login information.

dbid

The publication database ID of the publication database definition the new publication is added as a subordinate. This createpub command is applied to a single-master replication (SMR) or multi-master replication (MMR) system according to the Replication Group Type of this database.

-reptype

Specify s for a snapshot-only publication. Specify t if the publication is transactional (to allow synchronization replications).

-tables or -alltables

Use these options to include tables into publication. If reptype is t (transactional), then you must include -tables or -alltables. Otherwise, these options are optional.

The -tables option includes tables from the tables list to the publication. The -alltables option allows you to include all tables of the database or only tables from the listed schemas (optional) to the publication.

-views or -allviews

For SMR and -reptype s (snapshot) only: Use these options to include views into publication.

The -views option includes views from the views list to the publication. The -allviews option allows you to include all views of the database or only views from the listed schemas (optional) to the publication.

schema_tn

The name of the schema containing the nth table of the tables parameter list or the name of the nth schema of the alltables parameter list . This value is case sensitive.

table_n

The table name of the nth table in the tables parameter list. This value is case sensitive.

schema_vn

For SMR only: The name of the schema containing the nth view of the views parameter list or the name of the nth schema of the allviews parameter list . This value is case sensitive.

view_n

For SMR only: View name of the nth view in the views parameter list. This value is case sensitive.

filtername_tn

The filter name to assign to the filter rule on the table.

filterclause_tn

The filter clause to apply to the table in the tables parameter list for the table indicated by schema_t1.table_tn.

filtername_vn

The filter name to assign to the filter rule on the view.

filterclause_vn

For SMR only: The filter clause to apply to the view in the views parameter list for the table indicated by schema_v1.table_vn.

-defaultconflictresolution

For MMR only: Default conflict resolution (E, L, N, or M), if the -conflictresolution option is omitted. The default is E.

-defaultstandbyconflictresolution

For MMR only: Default standby conflict resolution (E, L, N, or M), if the -standbyconflictresolution option is omitted. The default is M.

-conflictresolution

For MMR only: For the conflictresolution option, specify one of these values:

  • E for earliest timestamp conflict resolution
  • L for latest timestamp conflict resolution
  • N for node priority conflict resolution
  • M for manual conflict resolution
  • C for custom conflict handling

The specified conflict resolution applies to the table schema_tn.table_n from the tables parameter list. The default is E.

-standbyconflictresolution

For MMR only: For the standbyconflictresolution option, specify one of these values:

  • E for earliest timestamp conflict resolution
  • L for latest timestamp conflict resolution
  • N for node priority conflict resolution
  • M for manual conflict resolution
  • C for custom conflict handling

The specified conflict resolution applies to the table schema_tn.table_n from the tables parameter list. The default is M.

customhandler_tn

For MMR only: For the conflictresolution option or the standbyconflictresolution option, specify customhandler_tn as the function name. Include 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 schema_tn.table_n from the tables parameter list. You must add the custom conflict handling function to the primary definition node. See Adding a custom conflict handling function for an example of adding the custom conflict handling function using PSQL. You must specify the custom handler name option only if you set the conflictresolution or standbyconflictresolution option for custom conflict handling by using the C value.

Examples

This example creates a publication named dept_emp that contains the EDB.DEPT and EDB.EMP tables of an Oracle database. The replication method is synchronization.

$ java -jar edb-repcli.jar -createpub dept_emp \
>   -repsvrfile ~/pubsvrfile.prop \
>   -pubdbid 1 \
>   -reptype t \
>   -tables EDB.DEPT EDB.EMP
Creating publication...
Tables:[[EDB.DEPT, TABLE], [EDB.EMP, TABLE]]
Filter clause:[]
Publication created.

This example creates a publication named salesemp that contains the EDB.SALESEMP view of an Oracle database. The replication method is snapshot-only.

$ java -jar edb-repcli.jar -createpub salesemp \
>   -repsvrfile ~/pubsvrfile.prop \
>   -pubdbid 1 \
>   -reptype s \
>   -views EDB.SALESEMP
Creating publication...
Tables:[[EDB.SALESEMP, VIEW]]
Filter clause:[]
Publication created.

This example creates a publication named analysts_managers that contains the edb.dept table and employees from the edb.emp table who are analysts or managers. The tables are in an EDB Postgres Advanced Server database. The replication method is snapshot-only.

$ java -jar edb-repcli.jar -createpub analysts_managers \
>   -repsvrfile ~/pubsvrfile.prop \
>   -pubdbid 2 \
>   -reptype s \
>   -tables edb.dept edb.emp \
>   -tablesfilterclause "2:jobgrade_11:job IN ('ANALYST', 'MANAGER')"
Creating publication...
Tables:[[edb.dept, TABLE], [edb.emp, TABLE]]
Filter clause:[FilterName:jobgrade_11   FilterClause:job IN ('ANALYST', 'MANAGER')      ]
Publication created.

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

$ java -jar edb-repcli.jar -createpub emp_pub \
>   -repsvrfile ~/pubsvrfile.prop \
>   -pubdbid 3 \
>   -reptype t \
>   -tables edb.dept edb.emp \
>   -tablesfilterclause "1:dept_10_20_30:deptno in (10, 20, 30)" \
>     "2:dept_10:deptno = 10" \
>     "2:dept_20:deptno = 20" \
>     "2:dept_30:deptno = 30" \
>   -conflictresolution 1:N 2:E \
>   -standbyconflictresolution 1:L 2:M \

Creating publication...
Tables:[[edb.dept, TABLE], [edb.emp, TABLE]]
Filter clause:[FilterName:dept_10_20_30 FilterClause:deptno in (10, 20, 30)     , FilterName:dept_10   FilterClause:deptno = 10 , FilterName:dept_20    FilterClause:deptno = 20        , FilterName:dept_30   FilterClause:deptno = 30 ]
Conflict Resolution Option:[ Node Priority, Earliest Timestamp ]
Standby Conflict Resolution Option:[ Latest Timestamp, Manual ]
Publication created.