Data Guard Physical Standby Database Best Practices – Part 1

Oracle Data Guard is one of the software solutions provided by Oracle Corporation to maximize high availability of Oracle databases. Oracle Data Guard maintains one or many secondary databases as alternatives to the primary production database.

Introduction

Oracle Data Guard is one of the software solutions provided by Oracle Corporation to maximize high availability of Oracle databases. Oracle Data Guard maintains one or many secondary databases as alternatives to the primary production database.

Data Guard Architecture

Oracle Data Guard supports both physical standby and logical standby sites.

Physical Standby: When the primary database transactions generate redo entries, a redo apply process keeps up the secondary databases with the exact block copies of the primary database.

Logical Standby: SQL apply processes read the redo and convert it to SQL transactions. These are then applied to the secondary database.

Data Guard Modes

Oracle Data Guard can operate in 3 different modes:

  • Maximum Protection: Transactions are not allowed to commit until all redo data are written to the online redo logs and propagated to at least one synchronized secondary database. If for any reason, the primary database cannot propagate its redo stream to one secondary database, the primary will shutdown to ensure maximum protection mode.
  • Maximum Performance: Transactions are not allowed to commit as soon as the redo are written to the online redo logs. The redo stream is asynchronously propagated to the secondary databases to ensure maximum performance mode.
  • Maximum Availability: Transactions are not allowed to commit until all redo data are written to the online redo logs and propagated to at least one synchronized secondary database. If for any reason, the primary database cannot propagate its redo stream to one secondary database, the primary will NOT shutdown and operates as it it were in maximum performance mode until issues are fixed.

Glossary

  • Role transition: Changing the role of each database component from primary database to the secondary database or from secondary database to the primary database.
  • Switchover: Planned role transition for testing. Manual intervention.
  • Fail Over: Unplanned failure. Manual or Automatic intervention. Automatic role transition is the recommended.
  • Primary database: Where the users are connected to access to the database.
  • Standby database: Exists in the the disaster recovery (DR) site. Where the users are connected in the case of planned role transition (Switchover) or in the case of unplanned failure (Fail Over).
  • Data Guard Observer: Process monitors both primary and standby databases and performs an automatic fail over when necessary.
  • The Broker: The management framework for Oracle Data Guard. It comes integrated into the oracle database enterprise edition.
  • Fast Start Fail Over (FSFO): Automatic fail over to the standby database occurs in case of failure. FSFO requires the broker.

The Environment

  • I have 3 VM with version of Oracle Enterprise Linux 5 installed.
  • I will use the Oracle Database 11g Enterprise Edition Release 2; 11.2.0.1.0 on the primary database and the standby database.
  • Oracle software is installed and a database is already created on the primary site.
  • Oracle software is installed and the database will be created during this demonstration for the standby site.
  • On the third host, I have installed a version of Oracle database 11g Client with administrator option; 11.2.0.1.0. This is the Data Guard Observer host.
  • The Oracle Home is on identical path on both nodes: primary database and the standby database.
  • Primary database server name is dg1 with a database name dg1.
  • Standby database server name is dg2 with a database name dg2.
  • The Data Guard Observer server name is dg3.

For the rest of the document, I am going to implement a physical Data Guard environment in maximum performance mode. The whole document will be split in 2 parts:

  1. Prepare the Data Guard environment.
  2. Create the standby database and verity the physical standby database. I will then Configure the Data Guard Broker, enable Fast Start Fail Over (FSFO) and run a Data Guard Observer.

Implementation notes

These are the steps to follow:

  1. Enable forced logging
  2. Create a password file
  3. Configure a standby redo log
  4. Enable archiving
  5. Set up the primary database initialization parameters
  6. Configure the listener and tnsnames to support the database on both nodes

Note: It is recommended to apply all patches on the primary and the standby before setting up the Data Guard environment.

Prepare the primary and the physical Standby Environments

Primary Server: Step 1

Oracle Data Guard requires the primary database to be run in FORCE LOGGING mode. This means that statements using the NOLOGGING option will still generate redo information to maintain the Data Guard standby databases.

The standby log files are required to store redo received from the primary database. Standby redo logs must be equal or larger to the largest redo log file in the primary database. The standby redo log must have at least one more redo log group than the redo log on the primary database. It is recommended that the standby redo log is created on the primary database and propagated to the standby for any switch over or fail over operations.

Next, set the LOG_ARCHIVE_CONFIG parameter. The LOG_ARCHIVE_CONFIG parameter enables or disables the sending of redo streams to the standby sites. The DB_UNIQUE_NAME of the primary database is dg1 and the DB_UNIQUE_NAME of the standby database is dg2. The primary database is configured to ship redo log stream to the standby database. In this example, the standby database service is dg2.

Next, STANDBY_FILE_MANAGEMENT is set to AUTO so that when Oracle files are added or dropped from the primary database, these changes are made to the standby databases automatically. The STANDBY_FILE_MANAGEMENT is only applicable to the physical standby databases.

Setting the STANDBY_FILE_MANAGEMENT parameter to AUTO is is recommended when using Oracle Managed Files (OMF) on the primary database. Next, the primary database must be running in ARCHIVELOG mode.

Ensure the Oracle Net Services aliases for both the primary database and standby database are added to the tnsnames.ora file.

Copy the updated tnsnames.ora file to the standby site (host).

Standby Server: Step 2

The Oracle database binaries have already been installed at this location ($ORACLE_HOME). The new standby database will have dg2 as the SID.

The listener on the standby site must be configured with a static service entry for the standby database. Restart the listener after modification.

Create audit directory files under $ORACLE_BASE/admin/$ORACLE_SID/adump. In my example, I will also create the Fast recover area and the oradata directories.

Next, create a simple parameter file on the standby hist with the DB_NAME value.

The primary database password file must be copied to the standby system for redo authentication.

In the next part of the document, we will create the standby database, verity the physical standby database. We will then configure the Broker, set up the Fast Start failover and the Data Guard Observer.

References:

en.wikipedia.org/wiki/Oracle_Data_Guard