Documente Academic
Documente Profesional
Documente Cultură
Version 12c
Document ID 2395049.1
Tracy West
Consulting Solution Architect
Sourav Bhattacharya
Consulting Solution Architect
Proofread this sample code before using it! Due to the differences in the way text editors, e-mail
packages and operating systems handle text formatting (spaces, tabs and carriage returns), this
sample code may not be in an executable state when you first receive it. Check over the sample
code to ensure that errors of this type are corrected.
This document touches briefly on many important and complex concepts and does not provide a
detailed explanation of any one topic since the intent is to present the material in the most
expedient manner. The goal is simply to help the reader become familiar enough with the
product to successfully design and implement an Oracle GoldenGate environment. To that end, it
is important to note that the activities of design, unit testing and integration testing which are
crucial to a successful implementation have been intentionally left out of the guide. All the
sample scripts are provided as is. Oracle consulting service is highly recommended for any
customized implementation.
Introduction 1
Prerequisites 2
Overview 3
Instantiation Considerations 3
Set LOG_ARCHIVE_CONFIG 5
Set LOG_ARCHIVE_CONFIG 7
Set LOG_ARCHIVE_DEST_3 7
Set LOG_ARCHIVE_CONFIG 8
Set LOG_ARCHIVE_DEST_1 8
Set LOG_ARCHIVE_DEST_2 8
Instantiation Methods 14
ENABLE_INSTANTIATION_FILTERING 18
This paper provides guidance and examples for setting up downstream extraction from an Oracle DataGuard
Standby system that has been configured with cascading redo logs. We outline how to configure the cascade log
shipping from the standby to the mining database as well has how to configure the extract process on the mining
server to fetch necessary data from the DataGuard standby system. Instantiation of target systems from an
DataGuard standby has special considerations and will also be addressed in this document. This architecture
configuration using redo cascade is the most decoupled solution that can still provide realtime characteristics of
change data capture. The focus of the document is intended for Oracle Database Administrators (DBAs), and Oracle
Developers with basic knowledge of Oracle GoldenGate and Oracle DataGuard. The document is intended to be a
supplement to the existing series of documentation available from Oracle.
The following assumptions have been made during the writing of this document:
» The reader has basic knowledge of Oracle GoldenGate products and concepts
» Referencing Oracle GoldenGate Version 12.2 and above
» Referencing Oracle RDBMS Version 11.2.0.4 and above
» Referencing OS: All Oracle GoldenGate supported platforms for Oracle
Oracle GoldenGate is the market leading data integration tool, it provides data capture from transaction logs and
delivery for homogeneous/heterogeneous databases, big data and messaging systems. A key strength of Oracle
GoldenGate is that it provides a flexible, de-coupled architecture that can be used to implement virtually any
replication scenario.
The following table describes items that are referred to throughout the document. You will need to identify your
installation-specific values and substitute them as you go.
Unix Report Files /ggs/dirrpt Directory for output from GoldenGate programs.
Unix Definitions Files /ggs/dirdef Directory for generated Oracle DDL and definition files.
Oracle Logon userid, password User ID and password for the source or target database. When implementing
Integrated Extract or Replicat, this user must be granted admin privileges with the
DBMS_GOLDENGATE_AUTH procedure on the both source and target databases.
Unix System Network Target Server IP address/hostname of the target Unix system in network.
Address Source Server IP address/hostname of the source Unix system in network
OnPrem
Source & Standby RDBMS Mining RDBMS Pump/Apply Data DB /
DBCS / OnPrem (DIPC/GGCS/OnPrem) Big Data
DbaaS
ADG Downstream OEH +
ProdDB Cascaded REDO via SSL Connection GG Capture GG Replicat /
ADG Standby DB Mining GG Pump BDC
Server
Cloud
firewalls firewalls @Customer
Instantiation Considerations
» Instantiation has similar requirements whether it is done from the source system or the ADG Standby
System. There are certain steps that users need to be aware of to get a consistent copy of data from the
Standby that are slightly different. This paper will not cover to the extent of the Document 1276058.1
“Instantiation from an Oracle Source Database with Oracle GoldenGate 12c”. This paper will focus on the
unique requirements of the ADG Standby Server.
Notes on Command Syntax: Commands throughout the document make specific references to directories, file
names, checkpoint group names, begin times, etc. Unless otherwise noted, these items do not have to correspond
exactly in your environment; they are used to illustrated concrete examples. For exact syntax, consult the Oracle
GoldenGate Reference Guide.
At the source database, the database parameter LOG_ARCHIVE_CONFIG has to be set for both the Standby
Database and the mining database.
Set LOG_ARCHIVE_CONFIG
SQL> Alter system set LOG_ARCHIVE_CONFIG=’DG_CONFIG=(< Primary database DB_UNQUE_NAME>,
<Standby database DB_UNIQUE_NAME>, <Mining database DB_UNIQUE_NAME>)’;
Session altered.
SQL> exec
dbms_goldengate_auth.grant_admin_privilege('C##GGADMIN',container=>'ALL');
PL/SQL procedure successfully completed.
Set LOG_ARCHIVE_CONFIG
SQL> Alter system set LOG_ARCHIVE_CONFIG=’DG_CONFIG=(< Primary database DB_UNQUE_NAME>,
<Standby database DB_UNIQUE_NAME>, <Mining database DB_UNIQUE_NAME>)’;
Set LOG_ARCHIVE_DEST_3
SQL> Alter system set LOG_ARCHIVE_DEST_2=’SERVICE=<connect string for the mining database> ASYNC
NOREGISTER VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE) REOPEN=10 DB_UNIQUE_NAME=<db
unique name of the mining server>’;
Set LOG_ARCHIVE_CONFIG
SQL> Alter system set LOG_ARCHIVE_CONFIG=’DG_CONFIG=(< Primary database DB_UNQUE_NAME>,
<Standby database DB_UNIQUE_NAME>, <Mining database DB_UNIQUE_NAME>)’;
Set LOG_ARCHIVE_DEST_1
SQL>Alter system set LOG_ARCHIVE_DEST_1=’LOCATION=<location for local archives>
VALID_FOR=(ONLINE_LOGFILE, PRIMARY_ROLE) ‘
Set LOG_ARCHIVE_DEST_2
SQL>Alter system set LOG_ARCHIVE_DEST_2=’LOCATION=<landing path for foreign archives that are cascading
through standby db> VALID_FOR=(STANDBY_LOGFILES, ALL_ROLES)’
Copy the “sys” user password file (orapw<SID>) from the source database and copy it to the mining db.
At Mining Database:
» Source System tables are automatically prepared when issuing the command ADD TRANDATA / ADD
SCHEMATRANDATA with PREPARECSN
» A query against the “SOURCE” or “STANDBY” databases can also verify if individual tables have been
prepared for instantiation.
TABLE_NAME SCN
------------------------------ ----------
TCUSTMER 12454843
TCUSTORD 12454847
Note:. The scn is the smallest system change number (SCN) for which the table can be instantiated. It is
not the export SCN.
» Register the Extract with the SOURCE database. This will be the last time OGG will need a connection to
the source database. Registering the extract will dump the required data dictionary to the redo logs.
MANAGER RUNNING
EXTRACT STOPPED EAPPS 00:00:00 00:03:03
MANAGER RUNNING
EXTRACT RUNNING EAPPS 00:00:44 00:00:06
EXTRACT EAPPS
-- Not logging into Source Database. Must use NOUSERID
NOUSERID
-- When using NOUSERID, FETCHUSERID of standby must be specified
FETCHUSERID c##ggadmin@to_stby, password ggadmin
-- Extract will wait the default of 3 seconds between each check while
-- waiting for ADG to catch up
DBOPTIONS FETCHCHECKFREQ
It is highly recommended that a job be created on the source system that will dump the data dictionary periodically.
This will enable the extract to be repositioned in the event of an issue later on. The command to dump the
dictionary is as follows:
This is a guideline of how to Instantiate a target database from an ADG standby.. For more detailed steps for
instantiation of a target database, please refer to document Instantiation from an Oracle Source Document ID
1276058.1
In detailing these steps, it is assumed that all long running transactions that were active when the extract was added
have since committed. The extract could have been added in the middle of a long running transaction. Extract
would not know about the operations in the transaction that occurred before it was added. So in order to not miss
data, it is important to verify that all open transactions from the time when extract was added have since committed.
This section will address how to pull data from the ADG Standby via expdp or other data tools like ODI. Oracle’s
expdp requires write access to the database. So in order to use expdp, the ADG standby has to be temporarily
converted to a Flashback standby. Other data tools like ODI or Network Import, only require read access. In that
case, only the process applying the logs to the standby needs to be temporarily stopped. .
At Mining Database:
Cascade Redo Log shipping will continue even when the redo log apply process on the standby has stopped.
In order to avoid the extract failing because it requires data to be fetched from the ADG Standby, it is
recommended to stop the extract process before stopping the redo log apply process on the standby.
MANAGER RUNNING
EXTRACT RUNNING EAPPS 00:00:50 00:00:09
MANAGER RUNNING
EXTRACT STOPPED EAPPS 00:00:30 00:00:16
MANAGER RUNNING
REPLICAT RUNNING RAPPS 00:00:00 00:00:02
MANAGER RUNNING
REPLICAT STOPPED RAPPS 00:00:00 00:02:19
At ADG Standby:
Stop the redo apply process and Note the current_scn. That SCN will be used to set the apply process.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY WITH APPLY 13948988
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY 13949075
SQL> /
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY 13949075
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
MOUNTED 0
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ WRITE 13950137
Do the export that is required. Either multiple schema, a single schema, or a single table
>Username: system
Note: Any DB user with DBA privileges will do
>Password:
Note: The export log needs to be checked for errors.
Restore the database back to Standby Mode and Restart the Redo Apply Process
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount ;
ORACLE instance started.
Database altered.
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY WITH APPLY 13953343
Note: If the Open_Mode was READ ONLY, then you would need to issue the following
command to insure apply was enabled: >alter database recover managed standby
database disconnect ;
At Mining Database:
MANAGER RUNNING
EXTRACT STOPPED EAPPS 00:00:30 01:50:36
MANAGER RUNNING
EXTRACT RUNNING EAPPS 00:00:42 00:00:07
MANAGER RUNNING
REPLICAT RUNNING RAPPS 00:00:00 00:00:06
» Datapump import will populate system tables and views with instantiation SCNs
SQL> select source_database, source_object_name, instantiation_scn, ignore_scn
from dba_apply_instantiated_objects where source_object_owner = 'APPS' ;
Change the Instantiation SCN to the SCN of the Standby Database (13949075) before it was opened as a
SnapShot Standby. This is set for each table that was imported.
At Mining Database:
Cascade Redo Log shipping will continue even when the redo log apply process on the standby has stopped.
In order to avoid the extract failing because it requires data to be fetched from the ADG Standby, it is
recommended to stop the extract process before stopping the redo log apply process on the standby.
MANAGER RUNNING
EXTRACT RUNNING EAPPS 00:00:50 00:00:09
MANAGER RUNNING
EXTRACT STOPPED EAPPS 00:00:30 00:00:16
At Target Database:
MANAGER RUNNING
REPLICAT RUNNING RAPPS 00:00:00 00:00:02
MANAGER RUNNING
REPLICAT STOPPED RAPPS 00:00:00 00:02:19
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY WITH APPLY 13948988
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY 13949075
SQL> /
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY 13949075
Pull the required data for instantiation. Either multiple schemas, a single schema, or a single table
Any tool not requiring write access to the standby database can be used.
Database altered.
Database altered.
OPEN_MODE CURRENT_SCN
-------------------- -----------
READ ONLY WITH APPLY 13953343
At Mining Database:
MANAGER RUNNING
EXTRACT STOPPED EAPPS 00:00:30 01:50:36
MANAGER RUNNING
EXTRACT RUNNING EAPPS 00:00:42 00:00:07
Start the replicat using the SCN of the Standby Database (13949075) before it was opened as a SnapShot
Standby.
GGSCI > START REP rapps, AFTERCSN 13949075
MANAGER RUNNING
REPLICAT RUNNING RAPPS 00:00:00 00:00:06
Reference the Oracle Database 12.1 Documentation for additional information on the Oracle 12.1 RDBMS.
Reference the Data Guard Concepts and Administration Section of the Oracle 12c Documentation on High
Availability for more information on configuring redo log transport.
Reference the Oracle GoldenGate 12c Reference Guide and the Oracle GoldenGate 12c Administration Guide for
additional information on:
CONNECT W ITH US
blogs.oracle.com/oracle Copyright © 2014, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
facebook.com/oracle fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means,
twitter.com/oracle electronic or mechanical, for any purpose, without our prior written permission.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
oracle.com
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
A-Team Chronicles ateam-oracle.com trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0818