Configure Oracle Data Guard
This playbook provides scripts to help you configure your Oracle Data Guard environment. These scripts setup a standby database for an existing primary
database using the restore from service
feature and
Oracle Data Guard Broker.
The dg-setup-scripts
use a
DG_properties.ini
file to define the primary and
standby environments.
The scripts create 2 tar files, a tar of the primary password file and a tar of the primary Transparent Data Encryption (TDE) wallet, that you'll copy to the standby database node.
The scripts do not make changes to the operating system, such as
net.core.rmem_max
and
net.core.wmem_max
, or maximum transmission unit
(MTU). It is a best practice to adjust the
net.core.rmem_max
and
net.core.wmem_max
for optimal redo transport.
The following tasks describe how to run the scripts to configure Oracle Data Guard for your database.
Define the Environment Variables for Oracle Data Guard
Use a DG_properties.ini
file to prepare the primary
system for an Oracle Data Guard configuration. The scripts use the parameters in the DG_properties.ini
to configure the primary and standby systems. The file contains all the input parameters
required by the scripts. See Examples of DG_properties.ini
Files in Explore
More.
A sample DG_properties.ini
file is available in the
dg-setup-scripts
zip file. You can customize the file with your
environment's values.
Prepare the Oracle Data Guard Parameters for the Primary Database
Set the Oracle Maximum Availability Architecture (MAA) recommended Oracle Data Guard parameters on the primary database before configuring Oracle Data Guard. The 1_prepare_primary_maa_parameters.sh
script configures the
recommended MAA parameters for Oracle Data Guard and creates the standby log files.
Script name: |
|
Where to run: |
In PRIMARY db host1 (regardless of whether the primary is an Oracle Real Application Clusters (Oracle RAC) or a single instance) |
Run with user: |
oracle |
MAA provides architecture, configuration, and lifecycle best practices for Oracle Databases, enabling high-availability service levels for databases residing in on-premises, cloud, or hybrid configurations.
- export DB_FLASHBACK_RETENTION_TARGET=1440
- export DB_BLOCK_CHECKSUM=FULL
- export DB_BLOCK_CHECKING=FULL
- export DB_LOST_WRITE_PROTECT=TYPICAL
- export LOG_BUFFER=256M
- export STANDBY_FILE_MANAGEMENT=AUTO
Note:
Per MAA best practices, the parameterDB_BLOCK_CHECKING
should be set to
MEDIUM
or FULL
in the primary database. The
script sets it to FULL
. If the performance overhead of enabling
DB_BLOCK_CHECKING
to MEDIUM
or
FULL
is unacceptable on your primary database, then set
DB_BLOCK_CHECKING
to MEDIUM
or
FULL
for your standby database only.
Run the script to set the parameters before configuring Oracle Data Guard. Run this script only once, whether the primary is an Oracle Real Application Clusters (Oracle RAC) or a single instance database.
After the MAA parameters are set, the script creates standby logs in the
ONLINE_LOG_DEST1
directory. The standby logs are the same
size as the online logs (REDOLOG_SIZE
). They have one more group
than the online logs, but the same number of threads.
Prepare the Primary System for Oracle Data Guard
Prepare the primary hosts for an Oracle Data Guard configuration and create output files that are needed later in the standby database hosts.
Script name: |
|
Where to run: |
In PRIMARY db hosts. If Oracle Real Application Clusters (Oracle RAC): run it first in the primary db host 1, and then in the primary db host 2. |
Run with user: |
oracle |
2_dataguardit_primary.sh
script creates the following
output files:
- TAR file containing the password file
- TAR file containing the TDE wallet (only if TDE encryption is used).
Copy the Output Files
Ensure that you place the tar files in the locations indicated by the properties
INPUT_PASWORD_TAR
and
INPUT_WALLET_TAR
(when TDE is used) that are
defined in the DG_properties.ini
file.
Prepare the Secondary System for Oracle Data Guard
Prepare the new secondary (standby) host, create the standby database, and configure Oracle Data Guard broker in the secondary database node.
Script name: |
|
Where to run: |
In new STANDBY db hosts. If Oracle Real Application Clusters (Oracle RAC): run first in the standby db host 1, and then in standby db host 2. |
Run with user: |
root |
The 3_dataguardit_standby_root.sh
script prepares the
new standby database hosts by deleting the existing database and configuring the
required artifacts (TNS aliases, NET encryption, password file, and Transparent Data Encryption (TDE) wallet). Then it creates and configures the standby database using the Oracle Recovery Manager (RMAN)
restore from service
feature, and configures the Oracle Data Guard broker.
The 3_dataguardit_standby_root.sh
script uses the
environment variables that you defined in the DG_properties.ini
file. If the secondary is an Oracle RAC database, then run the script in both nodes. Most of the actions are performed
when the script runs in Node1 and a subset of the steps are performed when it runs
in Node2. Don't run the script in Node2 before the script completes in Node1.
Add a TNS Entry for a New Standby Database
ADDITIONAL_STANDBY=YES
), then add the TNS entry that
points to the previously existing standby database, in the new standby database
tnsnames.ora
file, and conversely. Ensure that the
standby databases are able to connect each other to the listener port.