• Non ci sono risultati.

Using the Log Writer Process (LGWR) to Archive Redo Data

Creating a Logical Standby Database

Step 2 Add a disabled primary-key RELY constraint

5.3 How to Send Redo Data

5.3.2 Using the Log Writer Process (LGWR) to Archive Redo Data

You can optionally enable redo transport services to use the LGWR process to transmit redo data to remote destinations.

Using the LGWR process differs from ARCn processing (described in Section 5.3.1), because instead of waiting for the online redo log to switch at the primary database and then writing the entire archived redo log at the remote destination all at once, the LGWR process selects a standby redo log file at the standby site that reflects the log sequence number (and size) of the current online redo log file of the primary database.

Then, as redo is generated at the primary database, it is also transmitted to the remote destination. The transmission to the remote destination will either be synchronous or asynchronous, based on whether the SYNC or the ASYNC attribute is set on the LOG_

ARCHIVE_DEST_n parameter. Synchronous LGWR processing is required for the maximum protection and maximum availability modes of data protection in Data Guard configurations. (See Section 5.6 for information about the Data Guard data protection modes.)

This section contains the following topics:

LOG_ARCHIVE_DEST_n Attributes for LGWR Archival Processing

LGWR SYNC Archival Processing

LGWR ASYNC Archival Processing

5.3.2.1 LOG_ARCHIVE_DEST_n Attributes for LGWR Archival Processing

The following sections describe the LGWR, SYNC, and ASYNC attributes.

Enabling Redo Transport Services to Use the LGWR Process

You must specify the LGWR and SERVICE attributes on the LOG_ARCHIVE_DEST_n parameter to enable redo transport services to use the LGWR process to transmit redo data to remote archival destinations.

Specifying Synchronous or Asynchronous Network Transmission

The LGWR process synchronously writes to the local online redo log files at the same time it transmits redo data to the remote destination:

The SYNC attribute performs all network I/O synchronously, in conjunction with each write operation to the online redo log file, and waits for the network I/O to complete. Section 5.3.2.2 shows an example of synchronous network transmission in a Data Guard configuration. This is the default network transmission setting.

The ASYNC attribute performs all network I/O asynchronously and control is returned to the executing application or user immediately, without waiting for the network I/O to complete. Section 5.3.2.3 shows an example of asynchronous network transmission in a Data Guard configuration.

Note: If you configure a destination to use the LGWR process, but for some reason the LGWR process becomes unable to archive to the destination, then redo transport will revert to using the ARCn process to complete archival operations.

How to Send Redo Data

5.3.2.2 LGWR SYNC Archival Processing

Example 5–5 shows the primary role LOG_ARCHIVE_DEST_n parameters that configure the LGWR process for synchronous network transmission.

Example 5–5 Initialization Parameters for LGWR Synchronous Archival LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago'

LOG_ARCHIVE_DEST_2='SERVICE=boston LGWR SYNC NET_TIMEOUT=30' LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

Specifying the SYNC attribute on the LOG_ARCHIVE_DEST_n parameter is optional, because this is the default for LGWR archival processing. The NET_TIMEOUT attribute is recommended, because it controls the amount of time that the LGWR process waits for status from the network server process before terminating the network connection.

If there is no reply within NET_TIMEOUT seconds, then the LGWR process returns an error message.

Figure 5–4 shows a Data Guard configuration that uses the LGWR process to

synchronously transmit redo data to the standby system at the same time it is writing redo data to the online redo log file on the primary database:

On the primary database, the LGWR process submits the redo data to one or more network server (LNSn) processes, which then initiate the network I/O in parallel to multiple remote destinations. Transactions are not committed on the primary database until the redo data necessary to recover the transaction is received by all LGWR SYNC destinations.

On the standby system, the remote file server (RFS) receives redo data over the network from the LGWR process and writes the redo data to the standby redo log files.

A log switch on the primary database triggers a log switch on the standby database, causing ARCn processes on the standby database to archive the standby redo log files to archived redo log files on the standby database. Then, Redo Apply (MRP process) or SQL Apply (LSP process) applies the redo data to the standby database. If real-time apply is enabled, Data Guard recovers redo data directly from the current standby redo log file as it is being filled up by the RFS process.

How to Send Redo Data

Figure 5–4 LGWR SYNC Archival to a Remote Destination with Standby Redo Log Files

5.3.2.3 LGWR ASYNC Archival Processing

Example 5–6 shows the primary role LOG_ARCHIVE_DEST_n parameters that configure the LGWR process for asynchronous network transmission.

Example 5–6 Initialization Parameters for LGWR Asynchronous Archiving LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago'

LOG_ARCHIVE_DEST_2='SERVICE=boston LGWR ASYNC' LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

Figure 5–5 shows the LNSn process collecting redo data from the online redo log files and transmitting it over Oracle Net to the RFS process on the standby database.

When the LGWR and ASYNC attributes are specified, the log writer process writes to the local online redo log file, while the network server (LNSn) processes (one for each destination) asynchronously transmit the redo to remote destinations. The LGWR process continues processing the next request without waiting for the LNS network I/O to complete.

If redo transport services transmit redo data to multiple remote destinations, the LNSn processes (one for each destination) initiate the network I/O to all of the destinations in parallel.

When an online redo log file fills up, a log switch occurs and an archiver process archives the log file locally, as usual.

Primary Database Transactions

LGWR

ARCn Online Redo Log Files

Oracle Net RFS

ARCn Standby

Redo Log Files

Archived Redo Log File Archived

Redo Log File

Primary Site Standby Site

LNSn

Standby Database MRP

or LSP Synchronous

(Real Time Apply)

How to Send Redo Data

Figure 5–5 LGWR ASYNC Archival with Network Server (LNSn) Processes