Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Topic Coverage
2
Concepts and Basics
HSBC TECHNOLOGY AND SERVICES
4
HSBC TECHNOLOGY AND SERVICES
Online Redo Log files, Archive log files and Standby Redo Logfiles
Online redo log file (ORL)
- Contains persistently stored changed redo records.
- Redo records in the log files are stored in SCN sequential order—that is, the order in
which redo was written.
- When ORL are full, they become archived to the archive redo logs.
5
HSBC TECHNOLOGY AND SERVICES
6
Synchronous Asynchronous (default)
The user commits a transaction creating a redo record. The LGWR reads the redo record
from the log buffer, writes it to the online redo log file, and waits for confirmation from the
LNS.
The LNS reads the same redo record from the log buffer and transmits it to the standby
database using Oracle Net Services. The RFS receives the redo at the standby database
and writes it to a standby redo log file.
When the RFS receives a write-complete from the disk, it transmits an acknowledgment
back to the LNS process on the primary database, which in turn notifies the LGWR that
transmission is complete. The LGWR then sends a commit acknowledgment to the user.
8
HSBC TECHNOLOGY AND SERVICES
A common misconception is that the LGWR is the process that transmits data to a standby
database. This is not the case. The LNS process manages all synchronous and
asynchronous redo transmissions. Eliminating this perception is the reason why the Data
Guard 11g documentation simply refers to the redo transport methods as SYNC or
ASYNC, rather than LGWR SYNC or LGWR ASYNC as was done in previous releases.
LNS
The LogWriter Network Service (LNS) reads the redo being flushed from the redo buffers
by the LGWR and performs a network send of the redo to the standby site. The main
purpose of the LNS process is to alleviate the LGWR process from performing the redo
transport role.
9
HSBC TECHNOLOGY AND SERVICES
LGWR does not wait for acknowledgment from the LNS i.e. LGWR will continue to
acknowledge commit success even if the redo of previous transactions is delayed/not
sent (due to some reasons) to the standby database immediately .
If the LNS is unable to keep pace and the log buffer is recycled before the redo can be
transmitted to the standby, the LNS automatically transitions to reading and sending
from the ORL (Data Guard 11g onward). Once the LNS has caught up, it automatically
transitions back to reading/sending directly from the log buffer.
10
HSBC TECHNOLOGY AND SERVICES
VALID_FOR
VALID_FOR=(redo_log_type,database_role)
redo_log_type keyword can assume following values:
– ONLINE_LOGFILE—This destination is valid only when archiving ORL files.
– STANDBY_LOGFILE—This destination is valid only when archiving SRL files.
– ALL_LOGFILES— This destination is valid when archiving either online redo log
files or standby redo log files.
database_role keyword identifies the role in which this destination is valid for archiving:
– PRIMARY_ROLE—This destination is valid only when the database is running in
the primary role.
– STANDBY_ROLE—This destination is valid only when the database is running in
the standby role.
– ALL_ROLES—This destination is valid when the database is running in either the
primary or the standby role.
Default: (ALL_LOGFILE,ALL_ROLES)
11
HSBC TECHNOLOGY AND SERVICES
REOPEN
Specifies the minimum number of seconds before redo transport services should
try to reopen a failed destination.
COMPRESSION
Specifies whether redo data is transmitted to a redo transport destination in
compressed form or uncompressed form when resolving redo data gaps.
12
HSBC TECHNOLOGY AND SERVICES
Why Isn’t ARCH Redo Transport mentioned in the Data Guard 11g Documentation?
Three redo transport methods were documented prior to Data Guard 11g: SYNC, ASYNC,
and ARCH. ARCH refers to traditional archive log shipping, in which Data Guard would wait
for an ORL to be archived before the contents of the resulting archive log file where shipped
by an ARCH process.
Data Guard 11g ASYNC performance enhancements have led Oracle to deprecate ARCH as
a documented redo transport method. Though deprecated, the functionally still exists to use
ARCH for redo transport and provide backward compatibility for previous customer
installations.
The ARCH transport infrastructure also continues to be used transparently by Data Guard
11g when automatically resolving archive log gaps between primary and standby databases.
13
HSBC TECHNOLOGY AND SERVICES
Modes
Max Protection
Primary Standby
ORL SRL
COMMIT
14
HSBC TECHNOLOGY AND SERVICES
Max Availability
Primary Standby
ORL SRL
COMMIT
Fault preventing rdo to be written to standby
15
HSBC TECHNOLOGY AND SERVICES
Max Performance
Primary Standby
ORL SRL
COMMIT
16
HSBC TECHNOLOGY AND SERVICES
The protection modes in the order from highest (most data protection) to the
lowest (least data protection):
Yes
17
HSBC TECHNOLOGY AND SERVICES
18
HSBC TECHNOLOGY AND SERVICES
19
HSBC TECHNOLOGY AND SERVICES
20
HSBC TECHNOLOGY AND SERVICES
21
HSBC TECHNOLOGY AND SERVICES
22
Snapshot standby
HSBC TECHNOLOGY AND SERVICES
Snapshot standby
Features:
Fully updateable standby
24
HSBC TECHNOLOGY AND SERVICES
25
HSBC TECHNOLOGY AND SERVICES
26
HSBC TECHNOLOGY AND SERVICES
27
HSBC TECHNOLOGY AND SERVICES
Steps to convert the Snapshot Standby Database to the Physical Standby Database
Limitations
Flashback Database is used to convert a snapshot standby database back into a physical
standby database. Any operation that cannot be reversed using Flashback Database technology
will prevent a snapshot standby from being converted back to a physical standby.
28
HSBC TECHNOLOGY AND SERVICES
29
HSBC TECHNOLOGY AND SERVICES
Benefits
30
Active standby database
HSBC TECHNOLOGY AND SERVICES
Active Standby
Read Only - redo from primary
received and applied
Snapshot Standby
Read Write - redo from primary
received but not applied
Redo applied when snapshot
standby database is converted back
to physical standby
Note: Both Active Data Guard and Snapshot standby require a physical standby database in place
32
HSBC TECHNOLOGY AND SERVICES
Real time replica of a production database which is open in read only mode while
changes transmitted from the primary database are being simultaneously applied to it.
Can offload reporting, queries and fast incremental backups from the primary site to the
standby site improving the performance.
Performs its primary Data Guard objective of preventing data loss and downtime due to
data corruptions, database and site failures, human error, or natural disaster.
Automatically repair block corruptions online from Primary and for Primary
33
HSBC TECHNOLOGY AND SERVICES
34
HSBC TECHNOLOGY AND SERVICES
35
HSBC TECHNOLOGY AND SERVICES
36
HSBC TECHNOLOGY AND SERVICES
37
HSBC TECHNOLOGY AND SERVICES
ON ACTIVE STANDBY
SQL> select getsal('KING') from dual;
GETSAL('KING')
----------------
5000
SQL> select getsal_remote ('KING') from dual; -- getsal_remote is synonym for getsal@dblink
GETSAL_REMOTE('KING')
---------------------
5000
38
HSBC TECHNOLOGY AND SERVICES
DATABASE_ROLE
--------------------------
PHYSICAL STANDBY
OPEN_MODE
--------------------
READ ONLY WITH APPLY
1 row created.
SQL> commit;
Commit complete.
1 row updated.
39
HSBC TECHNOLOGY AND SERVICES
If the standby database is not running (note in 11g, STARTUP command will start standby in
read-only mode)
40
HSBC TECHNOLOGY AND SERVICES
Active Data Guard service level agreements (SLA) can be implemented using the
session parameter, STANDBY_MAX_DATA_DELAY (NONE, NON-ZERO, ZERO)
Specifies a limit for the amount of time (in seconds) allowed to elapse between when
changes are committed on the primary and when they can be queried on an active
standby database
The active standby will return an ORA-3172 error code if the limit is exceeded.
Applications can handle this error and redirect queries to the primary database
41
HSBC TECHNOLOGY AND SERVICES
42
HSBC TECHNOLOGY AND SERVICES
43
HSBC TECHNOLOGY AND SERVICES
44
HSBC TECHNOLOGY AND SERVICES
45