Professional Documents
Culture Documents
This chapter describes how redo logs are applied to a standby database. It includes the
following topics:
The main difference between physical and logical standby databases is the manner in
which log apply services apply the archived redo logs. For physical standby databases,
log apply services maintain the standby database by performing managed recovery
operations. For logical standby databases, log apply services maintain the standby
database by executing SQL statements. The following list summarizes these operations:
In this mode, log transport services transmit redo data to the standby site, and log
apply services automatically apply the redo logs.
Caution:
You can also open a physical standby database for read-only operations
to allow users to query the standby database for reporting purposes.
However, while a standby database that is open for read-only access, it
is not kept transactionally current with the primary database, resulting
in prolonging a failover or switchover operation if one is required for
disaster recovery. See Section 8.2, "Using a Standby Database That Is
Open for Read-Only Access" for more information.
The sections in this chapter describe the managed recovery and SQL apply operations,
and log apply services in more detail.
The remote file server (RFS) process receives redo data from the primary
database either in the form of archived redo logs or standby redo logs.
• Archiver (ARCn)
If standby redo logs are being used, the ARCn process archives the standby redo
logs that are to be applied by the managed recovery process (MRP).
The managed recovery process (MRP) applies information from the archived redo
logs to the standby database. When performing managed recovery operations, log
apply services automatically apply archived redo logs to maintain transactional
synchronization with the primary database.
Log apply services can apply logs to a physical standby database when the database is
performing recovery, but not when it is open for read-only operations). A physical
standby database can be performing one of the following:
Table 6-1 summarizes the basic tasks for configuring and monitoring log apply services.
Table 6-1 Task List: Configuring Log Apply Services for Physical Standby Databases
After all necessary parameter and network files are configured, you can start the standby
instance. If the standby instance is not started and mounted, the standby database cannot
receive redo data from the primary database.
To start the physical standby database instance, perform the following steps:
Log apply services keep the standby database synchronized with the primary database by
automatically applying archived redo logs to the standby database, as shown in Figure 6-
1.
You can specify that log apply services run as a foreground session or as a background
process.
• To start a background process, you must use 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.
• If you did not start log apply services as a detached server process, you can stop
log apply services by the issuing the following SQL statement in another window:
• SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
•
See Also:
1. To verify that you have correctly initiated log apply services, query the
V$MANAGED_STANDBY fixed view on the standby database. This view monitors the
progress of a standby database in managed recovery mode. For example:
2. SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS
3. 2> FROM V$MANAGED_STANDBY;
4.
5. PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
6. ------- ------------ ---------- ---------- ---------- ----------
7. MRP0 APPLYING_LOG 1 946 10 1001
If you did not start a detached server process, you need to execute this query from
another SQL session.
See Also:
Section 6.5
Although this SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement
does not require any additional clauses, it provides many keywords to help you control
the redo apply process.
See Also:
To enable the automatic creation of new datafiles on a physical standby database when
datafiles are created on the primary database, you must define the
STANDBY_FILE_MANAGEMENT initialization parameter.
If the directory structures on the primary and standby databases are different, you must
also set the DB_FILE_NAME_CONVERT initialization parameter to convert the filenames of
one or more sets of datafiles on the primary database to filenames on the standby
database.
When a new datafile is added on the primary database, the same datafile is created on the
standby database. The DB_FILE_NAME_CONVERT parameter is used to convert the datafile
name on the primary database to a datafile name on the standby database. This parameter
works the same if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO
or MANUAL.
DB_FILE_NAME_CONVERT= "/disk1/oracle/oradata/payroll/df1", \
"/disk1/oracle/oradata/payroll/standby/df1", \
"/disk1/oracle/oradata/payroll",
"/disk1/oracle/oradata/payroll/standby/"
STANDBY_FILE_MANAGEMENT=AUTO
Note:
When you specify pairs of files, be sure to specify the most restrictive
path names before the least restrictive, as shown in the example.
You cannot rename the datafile on the standby site when the STANDBY_FILE_MANAGEMENT
initialization parameter is set to AUTO. When you set the STANDBY_FILE_MANAGEMENT
initialization parameter to AUTO, use of the following SQL statements is not allowed:
If you attempt to use any of these statements on the standby database, an error is returned.
For example: