learn-oracle

Oracle DBA






Oracle Data Guard - Log Apply Services


PREVIOUS CHAPTER  |  NEXT CHAPTER



This chapter describes how redo data is applied to a standby database.Log apply services automatically apply redo to standby databases to maintain synchronization with the primary database and allow transactionally consistent access to the data. By default, log apply services wait for the full archived redo log file to arrive on the standby database before applying it to the standby database.

Log apply services use the following methods to maintain physical and logical standby databases:

  • Redo apply (physical standby databases only) Uses media recovery to keep the primary and physical standby databases synchronized.
  • SQL Apply (logical standby databases only) Reconstitutes SQL statements from the redo received from the primary database and executes the SQL statements against the logical standby database.
SQL Apply enables Oracle DBA to use the logical standby database for reporting activities, even while SQL statements are being applied.

The sections in this chapter describe Redo Apply, SQL Apply, real-time apply, and delayed apply in more detail.

1) Oracle DBA - Applying Redo Data to Physical Standby Databases
By default, the redo data is applied from archived redo log files. When performing Redo Apply, a physical standby database can use the real-time apply feature to apply redo directly from the standby redo log files as they are being written by the RFS process. Note that log apply services cannot apply redo data to a physical standby database when it is opened in read-only mode.

Starting Redo Apply

To start log apply services on a physical standby database, ensure the physical standby database is started and mounted and then start Redo Apply using the SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement.

Oracle DBA can specify that Redo Apply runs as a foreground session or as a background process.

To start Redo Apply in the foreground, issue the following SQL statement:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

If Oracle DBA start a foreground session, control is not returned to the command prompt until recovery is canceled by another session.

To start Redo Apply in the background, include the DISCONNECT keyword on the SQL statement. For example:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

This statement starts a detached server process and immediately returns control to the user. While the managed recovery process is performing recovery in the background, the foreground process that issued the RECOVER statement can continue performing other tasks. This does not disconnect the current SQL session.

Starting Real-Time Apply

To start real-time apply, include the USING CURRENT LOGFILE clause on the SQL statement. For example:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;

Stopping Log Apply Services

To stop Redo Apply or real-time apply, issue the following SQL statement in another window:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

2) Oracle DBA - Applying Redo Data to Logical Standby Databases(SQL Apply)
Log apply services convert the data from the archived redo log or standby redo log in to SQL statements and then executes these SQL statements on the logical standby database. Because the logical standby database remains open, tables that are maintained can be used simultaneously for other tasks such as reporting, summations, and queries.

Starting SQL Apply

To start SQL Apply, start the logical standby database and issue the following statement to recover redo data from archived redo log files on the logical standby database:

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;

Starting Real-time Apply

To start real-time apply on the logical standby database to immediately recover redo data from the standby redo log files on the logical standby database, include the IMMEDIATE keyword as shown in the following statement:

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Stopping Log Apply Services on a Logical Standby Database

To stop SQL Apply, issue the following statement on the logical standby database:

SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;

When Oracle DBA issue this statement, SQL Apply waits until it has committed all complete transactions that were in the process of being applied. Thus, this command may not stop the SQL Apply processes immediately.

If you want to stop SQL Apply immediately, issue the following statement:

SQL> ALTER DATABASE ABORT LOGICAL STANDBY APPLY;

3) Oracle DBA - Using Real-Time Apply to Apply Redo Data Immediately
If the real-time apply feature is enabled, log apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. This results in faster switchover and failover times because the standby redo log files have been applied already to the standby database by the time the failover or switchover begins.

Use the ALTER DATABASE statement to enable the real-time apply feature, as follows:

For physical standby databases, issue the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement.

For logical standby databases, issue the ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE statement.

Standby redo log files are required to use real-time apply.

Oracle DBa

The Above figure shows a Data Guard configuration with a local destination and a standby destination. As the remote file server (RFS) process writes the redo data to standby redo log files on the standby database, log apply services can recover redo from standby redo log files as they are being filled.

4) Oracle DBA - Specifying a Time Delay for the Application of Archived Redo Log Files
In some cases, you may want to create a time lag between the time when redo data is received from the primary site and when it is applied to the standby database. You can specify a time interval (in minutes) to protect against the application of corrupted or erroneous data to the standby database. When Oracle DBA set a DELAY interval, it does not delay the transport of the redo data to the standby database. Instead, the time lag Oracle DBA specify begins when the redo data is completely archived at the standby destination.

Specifying a Time Delay

Oracle DBA can set a time delay on primary and standby databases, as follows:

For physical standby databases, use the DELAY=minutes attribute of the LOG_ARCHIVE_DEST_n initialization parameter to delay applying archived redo log files to the standby database. The default setting for this attribute is NODELAY. If you specify the DELAY attribute without specifying a value, then the default delay interval is 30 minutes.

For logical standby databases, use the DBMS_LOGSTDBY.APPLY_SET procedure.

In a configuration with multiple standby databases, setting a time lag on more than one standby database can be very useful. For example, you can set up a configuration where each standby database is maintained in varying degrees of synchronization with the primary database.

Canceling a Time Delay

Oracle DBA can cancel a specified delay interval as follows:

For physical standby databases, use the NODELAY keyword of the RECOVER MANAGED STANDBY DATABASE clause:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE NODELAY;

For logical standby databases, specify the following SQL statement:

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NODELAY;

PREVIOUS CHAPTER  |  NEXT CHAPTER



Want to see more FAQ..SEE TOP MENU

More Tutorials on Oracle dba ...


Liked it ? Want to share it ? Social Bookmarking

Add to: Mr. Wong Add to: BoniTrust Add to: Newsider Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Jumptags Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Blinklist Add to: Technorati Add to: Newsvine Information


Source : Oracle Documentation | Oracle DBA

Want to share or request Oracle Tutorial articles to become a Oracle DBA. Direct your requests to webmaster@oracleonline.info