Subscription Materialization

When you create a subscription for a table replication definition, rows that fit the subscription are copied from the primary to the replicate table in a process called materialization. After materialization is complete, Replication Server distributes row changes in the primary database through normal replication.

If a subscription involves many rows, materialization can hold locks for a long time and overload the network. Replication Server queues may also fill with data. To avoid these problems, Replication Server provides four different ways to materialize a subscription.

You can use any method for subscriptions to table replication definitions or to publications. Use nonmaterialization or bulk materialization for subscriptions to function replication definitions or database replication definitions.

For more information about subscription materialization methods, see the Replication Server Administration Guide Volume 1.

Atomic and Nonatomic Materialization Commands

Use these commands to create a subscription and initialize data at the replicate database:
  • create subscription – creates and materializes a subscription using atomic materialization.

  • create subscription ... without holdlock – creates and materializes a subscription using nonatomic materialization.

If you use nonatomic materialization, which selects primary data without a holdlock, you must also use:
  • set autocorrection – prevents failures caused by missing or duplicate rows in a replicate table. When primary data is selected without a holdlock, it might be updated before materialization is complete and before normal transaction replication begins.

Nonmaterialization Command

Use this command to create a subscription when data is already in sync at the replicate database:
  • create subscription ... without materialization – creates a subscription without materializing data at the replicate database.

Bulk Materialization Commands

Bulk materialization is used to manually coordinate subscription status and to transfer data for function replication definitions or database replication definitions.

Use these commands for bulk materialization:
  • define subscription – adds a subscription to the system tables at the primary and replicate Replication Server.

  • activate subscription – starts the distribution of updates from the primary database to the replicate database and sets the subscription status to ACTIVE.

    After you use this command and verify status, manually load initial data from media into the replicate database. Use the with suspension option to prevent data from being applied to the replicate database until the load from media is complete.

  • validate subscription – completes bulk materialization and changes the subscription status to VALID. Replication Server is notified that materialization is complete.