Creating a Publication (createpub) v6.2

The createpub command creates a new publication.

Synopsis

-createpub pubname
  -repsvrfile pubsvrfile
  -pubdbid dbid
  -reptype { s | t }
  -tables schema_t1.table_1 [ schema_t2.table_2 ] ...
[ -views schema_v1.view_1 [ schema_v2.view_2 ] ...]
[ -tablesfilterclause
    "ordinal_t1:filtername_t1:filterclause_t1"
  [ "ordinal_t2:filtername_t2:filterclause_t2" ] ...]
[ -viewsfilterclause
    "ordinal_v1:filtername_v1:filterclause_v1"
  [ "ordinal_v2:filtername_v2:filterclause_v2" ] ...]
[ -conflictresolution
    ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
  [ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
[ -standbyconflictresolution
    ordinal_t1:{ E | L | N | M | C:customhandler_t1 }
  [ ordinal_t2:{ E | L } N | M | C:customhandler_t2 } ] ...]
[ -repgrouptype { m | s } ]

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 Adding a Publication for additional 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, 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 Quoted Identifiers and Default Case Translation for additional information on quoted identifiers and case translation.

Parameters

pubname

The publication name to be given to the new publication.

pubsvrfile

The file containing the publication server login information.

dbid

The publication database ID of the publication database definition subordinate to which the new publication is to be added.

-reptype

Specify s if the publication is to be a snapshot-only publication. Specify t if the publication is to allow synchronization replications.

schema_tn

The name of the schema containing the nth table of the tables 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. 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.

ordinal_tn

The ordinal number (that is, the position in the list counting from left to right starting with 1) of a table in the tables parameter list to which an attribute is to be applied.

filtername_tn

The filter name to be assigned to the filter rule on the table.

filterclause_tn

The filter clause to be applied to the table in the tables parameter list at the position indicated by ordinal_tn.

ordinal_vn

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.

filtername_vn

The filter name to be assigned to the filter rule on the view.

filterclause_vn

For SMR only: The filter clause to be applied to the view in the views parameter list at the position indicated by ordinal_vn.

-conflictresolution

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.

-standbyconflictresolution

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.

customhandler_tn

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 primary definition node. See Adding a Custom Conflict Handling Function 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.

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

Examples

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.

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

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.

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

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.

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

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.

$ 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 \
>   -repgrouptype 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.