6 Configuring Oracle GoldenGate to Maintain a Live Standby Database
Topics:
6.1 Overview of a Live Standby Configuration
Oracle GoldenGate supports an active-passive bi-directional configuration, where Oracle GoldenGate replicates data from an active primary database to a full replica database on a live standby system that is ready for failover during planned and unplanned outages.
In this configuration, there is an inactive Oracle GoldenGate Extract group and an inactive data pump on the live standby system. Both of those groups remain stopped until just before user applications are switched to the live standby system in a switchover or failover. When user activity moves to the standby, those groups begin capturing transactions to a local trail, where the data is stored on disk until the primary database can be used again.
In the case of a failure of the primary system, the Oracle GoldenGate Manager and Replicat processes work in conjunction with a database instantiation taken from the standby to restore parity between the two systems after the primary system is recovered. At the appropriate time, users are moved back to the primary system, and Oracle GoldenGate is configured in ready mode again, in preparation for future failovers.
6.2 Considerations for a Live Standby Configuration
These sections describe considerations for a live standby configuration.
6.2.1 Trusted Source
The primary database is the trusted source. This is the database that is the active source during normal operating mode, and it is the one from which the other database is derived in the initial synchronization phase and in any subsequent resynchronizations. Maintain frequent backups of the trusted source data.
Parent topic: Considerations for a Live Standby Configuration
6.2.2 Duplicate Standby
In most implementations of a live standby, the source and target databases are identical in content and structure. Data mapping, conversion, and filtering typically are not appropriate practices in this kind of configuration, but Oracle GoldenGate does support such functionality if required by your business model. To support these functions, use the options of the TABLE
and MAP
parameters.
Parent topic: Considerations for a Live Standby Configuration
6.2.3 DML on the Standby System
If your applications permit, you can use the live standby system for reporting and queries, but not DML. If there will be active transactional applications on the live standby system that affect objects in the Oracle GoldenGate configuration, you should configure this as an active-active configuration. See Configuring Oracle GoldenGate for Active-Active Configuration for more information.
Parent topic: Considerations for a Live Standby Configuration
6.2.4 Oracle GoldenGate Processes
During normal operating mode, leave the primary Extract and the data pump on the live standby system stopped, and leave the Replicat on the active source stopped. This prevents any DML that occurs accidentally on the standby system from being propagated to the active source. Only the Extract, data pump, and Replicat that move data from the active source to the standby system can be active.
Parent topic: Considerations for a Live Standby Configuration
6.2.5 Backup Files
Make regular backups of the Oracle GoldenGate working directories on the primary and standby systems. This backup must include all of the files that are installed at the root level of the Oracle GoldenGate installation directory and all of the sub-directories within that directory. Having a backup of the Oracle GoldenGate environment means that you will not have to recreate your process groups and parameter files.
Parent topic: Considerations for a Live Standby Configuration
6.2.6 Failover Preparedness
Make certain that the primary and live standby systems are ready for immediate user access in the event of a planned switchover or an unplanned source failure. The following components of a high-availability plan should be made easily available for use on each system:
-
Scripts that grant insert, update, and delete privileges.
-
Scripts that enable triggers and cascaded delete constraints on the live standby system. (These may have been disabled during the setup procedures that were outlined in the Oracle GoldenGate installation and configuration document for your database type.)
-
Scripts that switch over the application server, start applications, and copy essential files that are not part of the replication environment.
-
A failover procedure for moving users to the live standby if the source system fails.
Parent topic: Considerations for a Live Standby Configuration
6.2.7 Sequential Values that are Generated by the Database
If database-generated values, such as Oracle sequences, are used as part of a key, the range of values must be different on each system, with no chance of overlap. If the application permits, you can add a location identifier to the value to enforce uniqueness.
For Oracle databases, Oracle GoldenGate can be configured to replicate sequences in
a manner that ensures uniqueness on each database. To replicate sequences, use the
SEQUENCE
and MAP
parameters. .
Parent topic: Considerations for a Live Standby Configuration
6.2.8 Additional Information
The following documentation provides additional information of relevance to configuring Oracle GoldenGate.
-
For additional system requirements, process configuration, and database setup requirements, see the Oracle GoldenGate installation and configuration document for your database type. These guides are listed in the Preface of this book.
-
For detailed instructions on configuring Oracle GoldenGate change capture and delivery groups, see Configuring Online Change Synchronization.
-
For additional tuning options for Oracle GoldenGate, see Tuning the Performance of Oracle GoldenGate.
-
For complete syntax and descriptions of the Oracle GoldenGate commands and parameters, see Reference for Oracle GoldenGate for Windows and UNIX.
Parent topic: Considerations for a Live Standby Configuration
6.3 Creating a Live Standby Configuration
Refer to Figure 6-1 for a visual representation of the objects you will be creating.
Figure 6-1 Oracle GoldenGate configuration elements for live standby
Description of "Figure 6-1 Oracle GoldenGate configuration elements for live standby"
6.3.1 Prerequisites on Both Systems
Perform the following prerequisites on both systems.
- Create a Replicat checkpoint table (unless using Oracle integrated Replicat). For instructions, see Creating a Checkpoint Table.
- Configure the Manager process according to the instructions in Configuring Manager and Network Communications.
Parent topic: Creating a Live Standby Configuration
6.3.2 Configuration from Active Source to Standby
These steps configure Oracle GoldenGate to capture data from the primary database and replicate it to the standby database.
To Configure the Primary Extract Group
Perform these steps on the active source.
-
On the source, use the
ADD EXTRACT
command to create an Extract group. For documentation purposes, this group is called ext_1.ADD EXTRACT
ext_1
, {TRANLOG | INTEGRATED TRANLOG}, BEGINtime
[option
[, ...]]See Reference for Oracle GoldenGate for detailed information about these and other
ADD EXTRACT
options that may be required for your installation. -
Use the
ADD EXTTRAIL
command to add a local trail. For documentation purposes, this trail is called local_trail_1.ADD EXTTRAIL
local_trail_1
, EXTRACText_1
For
EXTRACT
, specify the ext_1 group to write to this trail. -
Use the
EDIT PARAMS
command to create a parameter file for the ext_1 group. Include the following parameters plus any others that apply to your database environment. For possible additional required parameters, see the Oracle GoldenGate installation and setup guide for your database.-- Identify the Extract group: EXTRACT
ext_1
-- Specify database login information as needed for the database: [SOURCEDBdsn_1
][, USERIDALIASalias
] -- Log all scheduling columns if using integrated Replicat LOGALLSUPCOLS -- Specify the local trail that this Extract writes to -- and the encryption algorithm: ENCRYPTTRAILalgorithm
EXTTRAILlocal_trail_1
-- Specify sequences to be captured: SEQUENCE [container
.]owner
.sequence
; -- Specify tables to be captured: TABLE [container
.]owner
.*;
To Configure the Data Pump
Perform these steps on the active source.
-
Use the
ADD EXTRACT
command to create a data pump group. For documentation purposes, this group is called pump_1.ADD EXTRACT
pump_1
, EXTTRAILSOURCElocal_trail_1
, BEGINtime
For
EXTTRAILSOURCE
, specify local_trail_1 as the data source. -
Use the
ADD RMTTRAIL
command to specify a remote trail that will be created on the standby system.ADD RMTTRAIL
remote_trail_1
, EXTRACTpump_1
For
EXTRACT
, specify the pump_1 data pump to write to this trail.See Reference for Oracle GoldenGate for additional
ADD RMTTRAIL
options. -
Use the
EDIT PARAMS
command to create a parameter file for the pump_1 group. Include the following parameters plus any others that apply to your database environment.-- Identify the data pump group: EXTRACT
pump_1
-- Specify database login information as needed for the database: [SOURCEDBdsn_1
][, USERIDALIASalias
] -- Decrypt the data only if the data pump must process it. -- DECRYPTTRAIL -- Specify the name or IP address of the standby system -- and optional encryption of data over TCP/IP: RMTHOSTOPTIONSsystem_2
, MGRPORTport_number
, ENCRYPTencryption_options
-- Specify the remote trail and encryption algorithm on the standby system: ENCRYPTTRAILalgorithm
RMTTRAILremote_trail_1
-- Specify sequences to be captured: SEQUENCE [container
.]owner
.sequence
; -- Specify tables to be captured: TABLE [container
.]owner
.*;
To Configure the Replicat Group
Perform these steps on the live standby system.
Parent topic: Creating a Live Standby Configuration
6.4 Configuration from Standby to Active Source
These steps configure Oracle GoldenGate in passive mode. In this mode, the Oracle GoldenGate processes are ready, but not started, to capture data from the secondary database and replicate it to the primary database after a switchover of transaction activity to the secondary system.
Note:
This is a reverse image of the configuration that you just created.
To Configure the Primary Extract Group
Perform these steps on the live standby system.
-
On the source, use the
ADD EXTRACT
command to create an Extract group. For documentation purposes, this group is called ext_2.ADD EXTRACT
ext_2
, {TRANLOG | INTEGRATED TRANLOG}, BEGINtime
[option
[, ...]]See Reference for Oracle GoldenGate for detailed information about these and other
ADD EXTRACT
options that may be required for your installation. -
Use the
ADD EXTTRAIL
command to add a local trail. For documentation purposes, this trail is called local_trail_2.ADD EXTTRAIL
local_trail_2
, EXTRACText_2
For
EXTRACT
, specify the ext_2 group to write to this trail. -
Use the
EDIT PARAMS
command to create a parameter file for the ext_2 group. Include the following parameters plus any others that apply to your database environment. For possible additional required parameters, see the Oracle GoldenGate installation and setup guide for your database.-- Identify the Extract group: EXTRACT
ext_2
-- Specify database login information as needed for the database: [SOURCEDBdsn_2
][, USERIDALIASalias
] -- Log all scheduling columns if using integrated Replicat LOGALLSUPCOLS -- Specify the local trail this Extract writes to and the encryption algorithm: ENCRYPTTRAILalgorithm
EXTTRAILlocal_trail_2
-- Specify sequences to be captured: SEQUENCE [container
.]owner
.sequence
; -- Specify tables to be captured: TABLE [container
.]owner
.*;
To Configure the Data Pump
Perform these steps on the live standby system.
-
Use the
ADD EXTRACT
command to create a data pump group. For documentation purposes, this group is called pump_2.ADD EXTRACT
pump_2
, EXTTRAILSOURCElocal_trail_2
, BEGINtime
For
EXTTRAILSOURCE
, specify local_trail_2 as the data source. -
Use the
ADD RMTTRAIL
command to add a remote trail remote_trail_2 that will be created on the active source system.ADD RMTTRAIL
remote_trail_2
, EXTRACTpump_2
For
EXTRACT
, specify the pump_2 data pump to write to this trail.See Reference for Oracle GoldenGate for additional
ADD RMTTRAIL
options. -
Use the
EDIT PARAMS
command to create a parameter file for the pump_2 group. Include the following parameters plus any others that apply to your database environment.-- Identify the data pump group: EXTRACT
pump_2
-- Specify database login information as needed for the database: [SOURCEDBdsn_2
][, USERIDALIASalias
] -- Decrypt the data only if the data pump must process it. -- DECRYPTTRAIL -- Specify the name or IP address of the active source system -- and optional encryption of data over TCP/IP: RMTHOSTOPTIONSsystem_1
, MGRPORTport_number
, ENCRYPTencryption_options
-- Specify remote trail and encryption algorithm on active source system: ENCRYPTTRAILalgorithm
RMTTRAILremote_trail_2
-- Specify sequences to be captured: SEQUENCE [container
.]owner
.sequence
; -- Specify tables to be captured: TABLE [container
.]owner
.*;
To Configure the Replicat Group
Perform these steps on the active source.
6.5 Moving User Activity in a Planned Switchover
This procedure moves user application activity from a primary database to a live standby system in a planned, graceful manner so that system maintenance and other procedures that do not affect the databases can be performed on the primary system.
6.5.1 Moving User Activity to the Live Standby
To move user activity to the live standby:
Parent topic: Moving User Activity in a Planned Switchover
6.5.2 Moving User Activity Back to the Primary System
To move user activity back to the primary system:
Parent topic: Moving User Activity in a Planned Switchover
6.6 Moving User Activity in an Unplanned Failover
These sections describe how to move user activity in an unplanned failover.
6.6.1 Moving User Activity to the Live Standby
This procedure does the following:
-
Prepares the live standby for user activity.
-
Ensures that all transactions from the primary system are applied to the live standby.
-
Activates Oracle GoldenGate to capture transactional changes on the live standby.
-
Moves users to the live standby system.
Perform these steps on the live standby system
To move users to the live standby
Parent topic: Moving User Activity in an Unplanned Failover
6.6.2 Moving User Activity Back to the Primary System
This procedure does the following:
-
Recovers the Oracle GoldenGate environment.
-
Makes a copy of the live standby data to the restored primary system.
-
Propagates user transactions that occurred while the copy was being made.
-
Reconciles the results of the copy with the propagated changes.
-
Moves users from the standby system to the restored primary system.
-
Prepares replication to maintain the live standby again.
Perform these steps after the recovery of the primary system is complete.
To Recover the Source Oracle GoldenGate Environment
-
On the primary system, recover the Oracle GoldenGate directory from your backups.
-
On the primary system, run GGSCI.
-
On the primary system, delete the primary Extract group.
DELETE EXTRACT
ext_1
-
On the primary system, delete the local trail.
DELETE EXTTRAIL
local_trail_1
-
On the primary system, add the primary Extract group again, using the same name so that it matches the parameter file that you restored from backup. For documentation purposes, this group is called ext_1. This step initializes the Extract checkpoint from its state before the failure to a clean state.
ADD EXTRACT
ext_1
, {TRANLOG | INTEGRATED TRANLOG}, BEGINtime
[, THREADSn
]-
For
TRANLOG
andINTEGRATED TRANLOG
, see Reference for Oracle GoldenGate.INTEGRATED TRANLOG
enables integrated capture for an Oracle database.
-
-
On the primary system, add the local trail again, using the same name as before. For documentation purposes, this trail is called local_trail_1.
ADD EXTTRAIL
local_trail_1
, EXTRACText_1
-
For
EXTRACT
, specify the ext_1 group to write to this trail.
-
-
On the primary system, start the Manager process.
START MANAGER
To Copy the Database from Standby to Primary System
-
On the primary system, run scripts to disable triggers and cascade delete constraints.
-
On the standby system, start making a hot copy of the database.
-
On the standby system, record the time at which the copy finishes.
-
On the standby system, stop user access to the applications. Allow all open transactions to be completed.
To Propagate Data Changes Made During the Copy
-
On the primary system, start Replicat.
START REPLICAT
rep_2
-
On the live standby system, start the data pump. This begins transmission of the accumulated user transactions from the standby to the trail on the primary system.
START EXTRACT
pump_2
-
On the primary system, issue the
INFO REPLICAT
command until you see that it posted all of the data changes that users generated on the standby system during the initial load. Refer to the time that you recorded previously. For example, if the copy stopped at 12:05, make sure that change replication has posted data up to that point.INFO REPLICAT
rep_2
-
On the primary system, issue the following command to turn off the
HANDLECOLLISIONS
parameter and disable the initial-load error handling.SEND REPLICAT
rep_2
, NOHANDLECOLLISIONS -
On the primary system, issue the
STATUS REPLICAT
command until it returns"At EOF (end of file)
" to confirm that Replicat applied all of the data from the trail to the database.STATUS REPLICAT
rep_2
-
On the live standby system, stop the data pump. This stops transmission of any user transactions from the standby to the trail on the primary system.
STOP EXTRACT
pump_2
-
On the primary system, stop the Replicat process.
STOP REPLICAT
rep_2
At this point in time, the primary and standby databases should be in a state of synchronization again.
(Optional) To Verify Synchronization
-
Use a compare tool, such as Oracle GoldenGate Veridata, to compare the source and standby databases for parity.
-
Use a repair tool, such as Oracle GoldenGate Veridata, to repair any out-of-sync conditions.
To Switch Users to the Primary System
Parent topic: Moving User Activity in an Unplanned Failover