Search notes:

Oracle Data Guard

Used for

Database roles

In a data guard environment, one database is a primary database, the others are standby databases. These roles are mutually exclusive.
The role of a database can be queried in the column database_role in v$database.
See also changing roles.

Primary database

The primary db is the »real« production database.
The primary db must run in archivelog mode and with forced logging.

Standby databases

Standby databases are (transactionally consistent) copies of the primary database.
Up to 30 standby databases are supported.

Physical and logical standby databases

A standby DB is either a physical or logical standby database. (A standby database can also become a snapshot standby database).
A physical database is an exact byte-wise copy of the primary database.
A logical database has the same data as the primary database, but is not necessarily stored in the same database blocks.
The physical database is kept synchronized with redo apply, the logical database with SQL apply.

Cascading standby database

A physical standby database might be configured to receive redo from a primary database and relay it to a another standby database.
In this case, the relaying database is (also) called a cascading standby database. The receiveing standby databases are also known as a terminal destination.
With such a configuration, the load on the primary database can be reduced.

SQL*Plus

Some SQL*Plus statements come with the standby keyword which indicates that the statement should be applied on the standby databases.

Role of redo

Data Guard basically works as follows:

Preventing physical errors

A standby database validates the redo it receives from the primary DB.
Thus, physical errors (such as data corruption) on the primary DB are not propagated to standby databases.

Changing roles of databases

The role (primary vs standby) of a database can be changed by either a
A switchover is a planned role transition. In a switchover, the primary database becomes a standby database while (one of) the standby databases becomes the primary database.
A switchover is performed in two steps: 1) the primary DB becomes a standby DB 2) a standby DB becomes a primary DB.
A failover occurs when the primary database becomes unavailable. In this case, one of the standby databases becomes the new primary database.

RAC

The primary db and the standby databases can be run as single instance or real application clusters (RAC).

Active Data Guard

Active data guard offers the same features as data guard plus that it standby databases are opened read only while the copying of data takes place
Thus, it allows to query the standby databases without impacting the performance of the production database (for example to create resource-intensive reports).
The standby database is called physical standby database.
The buzzword is real time query.
Active data guard must be licenced separately.

Data protection modes

Data Guard runs in one of three data protection modes. This allows to balance data availability against system performance requirements.
These protection modes are:

Automatic gap detection

If connectivity is lost between the primary and one or more standby databases …k

Configuration

Each primary and standby database needs its own control file.
Primary DB Standby DB
db_name MY_ORA MY_ORA
db_unique_name DB_PRIM DB_STBY
fal_client db_prim db_stby
fal_server db_stby db_prim
log_archive_config dg_config=(db_prim,db_stby) dg_config=(db_prim,db_stby)
log_archive_dest_1 LOCATION=/path/to/archive-dir VALID_FOR=(all_logfiles,all_roles) db_unique_name=DB_PRIM LOCATION=/path/to/archive-dir VALID_FOR=(all_logfiles,all_roles) db_unique_name=DB_STBY
log_archive_dest_2 SERVICE=DB_STBY LGWR ASYNC VALID_FOR=(online_logfile,primary_role) db_unique_name=DB_STBY SERVICE=MASTER LGWR ASYNC VALID_FOR=(online_logfile,primary_role) db_unique_name=DB_PRIM
Other parameters:

v$ Queries

select
  protection_mode,
  protection_level,
  database_role,
  switchover_status,
  --
  -- Columns related to fast-start failover status
  --
  fs_failover_status,
  fs_failover_current_target,
  fs_failover_threshold,
  fs_failover_observer_present
from
  v$database;
Redo apply and transport status on a physical standby database:
select
  process,
  status,
  thread#,
  sequence#,
  block#,
  blocks
from
  v$managed_standby;
Archived redo log files that have been received by a physical or snapshot standby database:
select
  thread#,
  sequence#,
  first_change#,
  next_change#
from
  v$archived_log;
v$log_history
Data guard messages:
select
  message,
  …
from
  v$dataguard_status;

TODO

Transportation of REDO (Redo Transport Services)
DGMGRL is the Data Guard broker command-line interface.
Far Sync. It requires the Active Data Guard option.
SRL: Standby Redo Log.
dba_logstdby_parameters
dba_logstdby_plsql_supoort

See also

apply services
Data Guard vs. Golden Gate
Active Data Guard
Real-time apply

Index