Creates a publication for tables or stored procedures that are to be replicated as a group to one or more subscribing replicate databases.
create publication pubs2_pub with primary at TOKYO_DS.pubs2
Use create publication to create a publication, an object that makes it easy to set up replication for multiple tables or stored procedures in a database. You create a publication, add articles, which specify replication definitions, and then create a single subscription for the publication.
Execute create publication at the Replication Server that manages the database where the primary data is stored.
For more information about working with replication definitions, articles, and publications, see the Replication Server Administration Guide Volume 1.
For more information about subscribing to publications, see Replication Server Administration Guide Volume 1 > Managing Subscriptions.
Replication Server distributes information about a new publication to a replicate site only when you create or refresh a subscription for the publication.
Requirements for Using create publication
Preparing Publications for Subscription
After you create a publication, you use create article to create articles and assign them to the publication. An article specifies a table replication definition or function replication definition and includes optional where clauses according to the needs of the subscribing replicate site. See create article for more information.
Because a replicate table cannot subscribe to two or more replication definitions for the same primary object, a publication cannot contain two or more articles for different replication definitions for the same primary table and the same replicate table.
When all of the articles have been assigned, you must validate the publication using validate publication before a replicate site can subscribe to it. Validating a publication verifies that the publication contains at least one article and marks the publication ready for subscription. See validate publication for more information.
To check publication status, use check publication. This command displays the number of articles the publication contains and indicates if the publication is valid. See check publication for more information.
Subscribing to Publications
When a publication is valid, you can create a subscription for the publication in order to begin replication to a replicate database. All forms of subscription materialization are supported. See create subscription or define subscription for more information.
When you create a publication subscription, Replication Server creates a separate underlying subscription for each article that the publication contains. Each article subscription uses the name of the parent publication subscription.
A subscription to a publication cannot include a where clause. Instead, you can customize replication to replicate sites by including one or more where clauses in each article the publication contains.
Articles for Table Replication Definitions
Articles for Function Replication Definitions
When data already exists at the replicate database, use create subscription with the without materialization clause. See create subscription for more information.
When you must manually transfer subscription data, use define subscription, activate subscription, and validate subscription to subscribe to the publication using bulk materialization. See define subscription for more information.
Articles for Both Table and Function Replication Definitions
If a publication contains articles for both table replication definitions and function replication definitions, you can use the same subscription command even though each type of replication definition requires a different materialization method.
Subscriptions for articles for table replication definitions are materialized using atomic or non-atomic materialization—unless you use the without materialization clause.
Subscriptions for articles for function replication definitions are materialized without materialization.
In cases where the stored procedure for a function replication definition operates on a table for which there is also a table replication definition, no separate data transfer is necessary.
Refreshing Publication Subscriptions
When data already exists at the replicate database, use create subscription with the without materialization clause.
Re-create the subscription using define subscription, activate subscription, and validate subscription and transfer subscription data manually as necessary. See define subscription for more information.
Dropping Subscriptions, Articles, and Publications
You can drop a subscription to a publication and, optionally, purge the subscription data for the component subscriptions to articles for table replication definitions. See drop subscription.
If there is no subscription, you can drop an article that a publication contains and, optionally, drop the associated replication definition if it is not used elsewhere. After you drop an article, the publication is invalid. See drop article.
You can drop a publication if there are no subscriptions for the publication. When you drop a publication, its articles are also dropped. Optionally, you can also drop all of the replication definitions for the publication’s articles, if they are not used elsewhere. See drop publication for more information.
Publications in Warm Standby Applications