Warm Standby Application for a Primary Database

Learn about warm standby applications for a primary database.

This figure illustrates an example of a warm standby application for a primary database. In the example, one Replication Server manages three databases:
Warm Standby Application for a Primary Database
Figure 3-6 illustrates a warm standby application for primary database. In this example, one Replication Server manages three databases, the active database for a logical primary database, the standby database for logical primary database, and a replicate database that has subscriptions for the data in the logical primary database. A single Replication Server manages both the primary and replicate databases. In other instances, different Replication Servers may manage the primary and replicate databases. The numbers in the figure indicates the flow of transactions from client applications through the replications system in a warm standby application for a primary database. The inbound queue is read by the standby D S I and the Distributor. The two threads do their work concurrently.

In this example, a single Replication Server manages both the primary and replicate databases. In other instances, different Replication Servers may manage the primary and replicate databases.

The numbers in the figure indicate the flow of transactions from client applications through the replication system in a warm standby application for a primary database.

From Client Applications to Inbound Queue

In the figure, numbers 1 through 3 represent transactions from clients to an inbound queue in the Replication Server:
  • Clients execute transactions in the active primary data server.

  • The active primary data server updates the active primary database.

  • The Replication Agent for the active primary database reads transactions for replicated data in the database log. It forwards the transactions to the Replication Server, which writes them into an inbound queue.

    All transactions for replicated data, including those executed by the maintenance user, are sent to the Replication Server for application in the standby database.

From Inbound Queue to Replicate Database

In the figure, numbers 4 through 8 trace transactions from the inbound queue to the replicate database:
  • The Distributor thread reads transactions from the inbound queue.

  • The Distributor thread processes transactions against subscriptions and writes replicated transactions into an outbound queue.

    Transactions executed by the maintenance user, which are always replicated into the standby database (because you set the send_warm_standby_xacts parameter when you configure RepAgent with sp_config_rep_agent), are not replicated to replicate databases unless you also set the send_maint_xacts_to_replicate parameter for RepAgent.

    Note: For Oracle, transactions executed by the maintenance user, are always replicated to the replicate database because the filter_maint_userid configuration parameter is invalid for Replication Agent for Oracle irrespective of whether the parameter is set to “true” or “false”.
  • A DSI thread reads transactions from the outbound queue.

  • The DSI thread executes the transactions in the replicate data server.

  • The replicate data server updates the replicate database.

    If the transactions are to be replicated to a database managed by a different Replication Server, they are written into an RSI outbound queue managed by an RSI thread instead of a DSI thread. The RSI thread delivers the transactions to the other Replication Server.

From Inbound Queue to Standby Database

In the figure, numbers 9 through 11 trace transactions from the inbound queue to the standby database for the logical primary database:
  • The standby DSI thread reads transactions from the inbound queue.

  • The standby DSI thread executes transactions in the standby data server.

  • The standby data server updates the standby database.

The inbound queue is read by the standby DSI and the Distributor. The two threads do their work concurrently. Messages cannot be truncated from the inbound queue until both threads have read them and delivered them to their destination. The messages remain in the queue until the DSI has applied them to the standby database and, if there are subscriptions or replicated stored procedure executions, the Distributor has written them to the outbound queue.

Depending on your replication system, the transactions may be replicated into the standby database before the replicate database. However, Replication Server guarantees that the standby primary database and replicate databases will be kept in sync with the active primary database.