Usage
Required to identify a shared database table and specify the servers where it exists on the network.
The CREATE SHARED TABLE statement queries the system catalog for the detailed information about the table’s columns.
Once you define a shared table and columns for a sending table (with a CREATE SHARED TABLE statement) and for a receiving table and columns (with another CREATE SHARED TABLE statement), you can map the tables to each other in one of three ways:
-
Explicitly, specifying the mappings with the CREATE TABLE MAPPING statement.
-
Automatically, by default to same-named target tables and columns at connecting servers using the CREATE DEFAULT TABLE MAPPINGS statement. See Create a default table mapping.
-
Automatically, by creating a reference mapping that duplicates an existing mapping from the sending table to another receiving table. See Create a reference mapping.
CREATE SHARED TABLE database-name.schema-name.table-name
AT [ SERVER | SERVERS ] server-name, ...
{ NOT PROTECTED| PROTECTED [ BY shadow-table-name ]{ COLUMNS ( column-name, ... )|ALL COLUMNS}
Parameters
Parameter |
Description |
---|---|
AT |
Name of the server(s) where this shared table exists. |
NOT PROTECTED |
No Connect CDC automated collision resolution is in effect. A data collision at the receiving table is treated as an error, and the Distributor does not attempt to resolve whether the incoming replicated data or the encountered target data is preferred. |
PROTECTED[ BY shadow-table-name] |
Connect CDC automated collision resolution by shadow tables is in effect. Designed for sending servers in bidirectional configurations, all collisions are resolved using the default algorithm (most recent update is preferred). Connect CDC Director generates a unique shadow table name by default. If you choose to change this generated name using the BY shadow-table-name clause, it must be unique. |
COLUMNS (vertical partitioning) |
Names of the columns to map. Use one of the following ways to identify the names:
|
Example
- workdb.qadba.claims90 at server i10hp4
proddb.emp at server axq4 and server prod2
- testdb.qadba.clients at saixd1
CREATE SHARED TABLE workdb.qadba.claims90 AT i10hp4 PROTECTED ALL COLUMNS ; CREATE SHARED TABLE proddb.emp AT axq4, prod2 PROTECTED COLUMNS (empid, empname, state, sal) ; CREATE SHARED TABLE testdb.qadba.clients AT saixd1 PROTECTED COLUMNS (driver_id, city, zip, address) ;