Adding tables to a publication (addtablesintopub) v7
The addtablesintopub
command adds tables or views into an existing publication.
Synopsis
The addtablesintopub
command updates an existing publication identified by pubname
.
The views
parameter applies only for a snapshot-only publication. It's ignored if the publication isn't defined as snapshot-only. See Adding tables to a publication for more information.
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.
Note
Column mappings are applied when you create subscriptions. If you add a table which qualifies for column mapping to the related publication, then Replication Server applies the column mapping for the newly added table. For more information on column mappings, see Creating a subscription.
Parameters
pubname
The name of the publication to which to add tables or views.
pubsvrfile
The file containing the publication server login information.
-tables
or -alltables
Use these options to add tables into the publication. If the replication type of the publication is t
(transactional), then -tables
or -alltables
is required. Otherwise it's optional.
The -tables
option adds tables from the tables list to the publication. The -alltables
option allows you to add all tables of the database or only tables from the listed schemas (optional) to the publication.
-views or -allviews
For SMR only: If the replication type of the publication is s
(snapshot), then you can use -views
or -allviews
to include views into the publication.
The -views
option adds views from the views list to the publication. The -allviews
option allows you to add 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 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: The name of the schema containing the nth view of 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 at the position 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 at the position indicated by schema_v1.table_vn
.
-enablefilters
Enables filters for the list of subscriptions (SMR only) or non-MDN database IDs (MMR only). Enabled filters are applied during the snapshot operation of the tables added to the publication.
filtername_n
The filter name to enable for the list of subscriptions/db IDs. Use a name from the filter names specified with options -tablesfilterclause
and -viewsfilterclause
.
subscription_m,subscription_n,...
For SMR only: Comma-separated (no spaces allowed) list of the names of subscriptions for which to enable the filter filtername_n
.
dbid_m,dbid_n,...
For MMR only: Comma-separated (no spaces allowed) list of the database IDs for which to enable the filter filtername_n
.
-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 resolutionL
for latest timestamp conflict resolutionN
for node priority conflict resolutionM
for manual conflict resolutionC
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 resolutionL
for latest timestamp conflict resolutionN
for node priority conflict resolutionM
for manual conflict resolutionC
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
or standbyconflictresolution
option, specify customhandler_tn
as the function name. Use an optional schema prefix (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 customhandler
name option only if the conflict resolution option or the standby conflict resolution option is set for custom conflict handling with the C
value.
replicatetableschema
For SMR only: Applies to target subscriptions nodes. Set this option to true
if you want the publication table definitions replicated from the publication database to all target subscription nodes when adding new tables to the publication. Set this option to false
if you already created the table definitions in the target subscription nodes. The default is true
.
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 (MDN) when adding tables to the publication. Set this option to false
if you already created the table definitions in the non-MDN master node. The default is true
.
-initialsnapshot
If the value is true
, a snapshot replication of the new tables to target nodes is performed. The default value is false
.
For MMR only: Applies to non-MDN nodes. Specify this option if you want an initial snapshot replication of the new tables performed from the master definition node to every other master node when adding tables to the publication.
For SMR only: Applies to all target subscription nodes. Specify this option if you want an initial snapshot replication of the new tables performed from the publication node to all target subscription nodes when adding tables to the publication.
Note
Unless you intend to use the offline snapshot technique (see Loading tables from an external data source (offline snapshot)), we recommend that you specify this option. You must perform an initial snapshot replication of the new tables before performing synchronization replications on demand (see Performing a synchronization (dosynchronize)) or by a schedule (see Configuring a multi-master schedule (confschedulemmr)). If the newly added tables didn't undergo an initial snapshot to all target nodes, any later synchronization replication might not apply the transactions to that master node.
Examples
This example adds table edb.jobhist and view edb.salesemp
to an existing publication named analysts_managers
.
- On this page
- Synopsis
- Parameters
- Examples