You are on page 1of 66

Safe Harbor Statement

The following is intended to outline our general


product direction. It is intended for information
purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any
material, code, or functionality, and should not be
relied upon in making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracles
products remains at the sole discretion of Oracle.

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Oracle Training Materials Usage Agreement


Use of this Site (Site) or Materials constitutes agreement with the following terms and
conditions:

1. Oracle Corporation (Oracle) is pleased to allow its business partner (Partner) to download
and copy the information, documents, and the online training courses (collectively, Materials")
found on this Site. The use of the Materials is restricted to the non-commercial, internal training
of the Partners employees only. The Materials may not be used for training, promotion, or sales
to customers or other partners or third parties. <Insert Picture Here>
2. All the Materials are trademarks of Oracle and are proprietary information of Oracle. Partner or
other third party at no time has any right to resell, redistribute or create derivative works from
the Materials.

3. Oracle disclaims any warranties or representations as to the accuracy or completeness of any


Materials. Materials are provided "as is" without warranty of any kind, either express or implied,
including without limitation warranties of merchantability, fitness for a particular purpose, and
non-infringement.

4. Under no circumstances shall Oracle or the Oracle Authorized Delivery Partner be liable for Technical Implementation Boot Camp
any loss, damage, liability or expense incurred or suffered which is claimed to have resulted
from use of this Site of Materials. As a condition of use of the Materials, Partner agrees to
Title of Presentation
Oracle GoldenGate
indemnify Oracle from and against any and all actions, claims, losses, damages, liabilities and Presenters Name
Presenters Title
expenses (including reasonable attorneys' fees) arising out of Partners use of the Materials.

5. Reference materials including but not limited to those identified in the Boot Camp manifest
can not be redistributed in any format without Oracle written consent.

For Oracle employees and authorized partners only. Do not distribute to third parties. For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential 2008 Oracle Corporation Proprietary and Confidential

Implementation Bootcamp Agenda Implementation Bootcamp Agenda


Day 1 Day 2
Presentations Presentations
Oracle GoldenGate Overview <Insert Picture Here> Data Pumps <Insert Picture Here>
Solutions Extract Trails and Files
Products Parameters
Technology Overview
Data Mapping and Transformation
Oracle GoldenGate Architecture
Configuring Oracle GoldenGate:
1.Prepare the Environment
Student Labs
2.Change Capture
3.Initial Load
4.Change Delivery

Student Labs

For Oracle employees and authorized partners only. Do not distribute to third parties. For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential 2009 Oracle Corporation Proprietary and Confidential

1
Implementation Bootcamp Agenda
Day 3

Presentations <Insert Picture Here>


Data Mapping and Transformation (continued)
Configuration Options
Managing Oracle GoldenGate

GoldenGate
Student Labs
Questions and Answers Product Positioning and Differentiators

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential 8

GoldenGate is Strategic to Oracle Oracle GoldenGate


The Solution for Enterprise-wide Real Time Data Needs

Best-in-class leader in real-time data solutions


Complements existing Oracle products
Continuous Availability for heterogeneous
systems
Real-time data access for Reporting
Real-time data for BI, EPM, Exadata Database and
applications, Mixed
Zero-downtime migrations / upgrades to Oracle Real-time
sources, distributed
Database and Applications systems, legacy, information
OLTP, OLAP
Over 400 customers with 4,000+ implementations
across Fortune 500 companies: Financial Services,
Communications, Healthcare, Public Sector, Retail &
Utilities industries
Top 3 of 5 largest commercial banks
Top 3 of 3 busiest ATM networks
Top 7 of 10 financial data services companies
Top 4 of 5 telecommunications providers
Top 3 of 5 largest food & drug stores

9 10

Oracle GoldenGate Oracle GoldenGate


The Solution for Enterprise-wide Real Time Data Needs The Solution for Enterprise-wide Real Time Data Needs

Database and Mission Critical Database and Mission Critical


applications, Mixed Applications & Data, applications, Mixed Applications & Data,
sources, distributed Real-time Business Intelligence, sources, distributed Real-time Business Intelligence,
systems, legacy, information Reporting for systems, legacy, information Reporting for
OLTP, OLAP Customers, Partners OLTP, OLAP Customers, Partners
& Employees & Employees

Real-time Access

Oracle GoldenGate delivers real-time access of real-time information, enabling


companies to dramatically improve the availability, reliability, and performance of
critical data across enterprise systems.

11 12

2
Oracle GoldenGate Technology Differentiators Differentiator: Heterogeneity

Oracle GoldenGate provides low-impact capture, routing, transformation, and Core Infrastructure
delivery of database transactions across heterogeneous environments in real-time
Core product components are utilized for all databases
Canonical trail file format
Canonical metadata definitions
Key Differentiators:
Automatic mapping of common data types

Performance Non-intrusive, Low Impact, Sub-second latency Capture Methods


Log scraping (direct file access)
Extensible & Open, modular architecture - Heterogeneous Database built-in log interface (log API)
Flexible sources & Targets Intercepts/exits
Vendor-provided access modules
Maintains Transactional Integrity - Resilient
Reliable
against interruptions and failures Delivery utilizes native database interfaces

13
13

Differentiator: Heterogeneity Differentiator: Heterogeneity


Oracle Capture Microsoft SQL Server Capture

Capture Support for Oracle RAC Capture Ability to capture from native backups
Support for ASM Coexistence with SQL Server
Archived Log Online Log Backups Transaction Log Replication
Support for index-organized tables
(IOTs) with overflow SQL Server Replication components
Support for clustered tables are not required
Support for object tables Support tables with no unique key (not
Support for object types (UDTs) supported by SQL Server Replication)
Support for DDL operations Support for computed columns
Archived log only (ALO) mode Support for identity columns
Off-platform capture (LOGSOURCE)
Capture
Commit Ordered Multi-threaded capture Capture
Commit Ordered
Trail Trail
OCI/Oracle Net ODBC

Differentiator: Heterogeneity Differentiator: Heterogeneity


DB2 LUW Capture DB2 z/OS Capture

Capture Support for Multi Dimensional Capture Runs under Unix System Services
Clustered Tables (MDC) (USS)
Archived Log Online Log Support for Materialized Query Tables Archived Log Online Log Support for data sharing environments
(MQT) Automatic EBCDIC/ASCII translation
Support for data compression Support for EBCDIC, ASCII, and
(tablespace) Unicode encoded tables
DB2READLOG IFI IFCID 0306
Support for data compression
(tablespace)

Commit Ordered Commit Ordered


Capture Trail Capture Trail
DB2 CLI DB2 CLI

Unix System Services (USS)

3
Differentiator: Heterogeneity Differentiator: Heterogeneity
HP NonStop Capture (Enscribe and SQL/MP) HP NonStop Capture (SQL/MX)

Capture Logger used for non-TMF (non- Capture Runs under Open Systems Services
audited) enabled applications (OSS)
TMF Audit Dump TMF Audit Log ARLIB2 interface utilized by AUDSERV TMF Audit Dump TMF Audit Log ARLIB2 interface utilized by VAMSERV
process process
HP Blades Support Based on open systems core
Support for TCP/IP and EXPAND infrastructure
ARLIB2 networks ARLIB2
Fast block-based unload
Support for network distributed
transactions
AUDSERV
Support primary key updates from
Commit Ordered VAMSERV Commit Ordered
Capture Trail open systems Capture Trail
Logger
Embedded SQL Embedded SQL

Open Systems Services (OSS)

Differentiator: Heterogeneity Differentiator: Heterogeneity


Teradata Capture Delivery

Teradata-provided access module Delivery Native APIs


Replication Group
(TAM) Array operations
RSG RSG
vproc vproc TAM is a shared library dynamically Integration with load utilities
CDC CDC
linked at runtime
CDC runs on Relay Services Gateway Flat file integration for data
(RSG) vprocs warehousing appliances (Netezza and
Capture Max protection mode and max Native Interface Greenplum)
performance mode
T
Full Unicode support for Windows and Commit Ordered
Trail
Delivery
A
M
Linux Target Database

Capture
Unsorted Trail Commit Ordered
Sort/Pump Trail Support for DDL operations
ODBC Support for LOB and UDT data types
Support for identity data types
Maximum Protection Mode

Differentiator: Transactional Integrity Differentiator: Reliability

Decoupled architecture
Individual processes can be restarted automatically
Transaction boundaries
Tolerance to network outages (configurable)
Recorded in GoldenGate trail file
Transactions ordered in commit
sequence Recovery
Boundaries adjusted automatically Recovery ensures that no operations are skipped or
due to record filtering or trail splits duplicated after failure of any kind
Recovery of the Capture process is more involved than
Transaction integrity recovery the Delivery process
Checkpointing and recovery are Although GoldenGate processes are completely
based on transaction boundaries decoupled, the Delivery process must be aware of a
Original commit sequence is recovery performed by the Capture process or pump
maintained by the delivery process

23 24

4
Oracle GoldenGate Products and Services for
Windows, UNIX & Linux
Products
Oracle GoldenGate Transactional Data Management (TDM)
<Insert Picture Here>
Oracle GoldenGate Director
Oracle GoldenGate Veridata
Oracle GoldenGate Products TDM Integration Edition
TDM Netezza Integration
TDM Greenplum Integration
Services
Professional Services
Educational Services

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Oracle GoldenGate Products and Services for What is Oracle GoldenGate Veridata?
NonStop
Products Oracle GoldenGate Veridata is a high-speed, low-impact data comparison
solution that identifies and reports data discrepancies between two databases,
Transactional Data Management (TDM) Capture without interrupting those systems or the business processes they support.
Transactional Data Management (TDM) Delivery
Logger
Syncfile
Rollback
Base 24 Add-on Modules: T24, E24, N24, D24, M24
GoldenGate Director
GoldenGate Veridata

Services
Professional Services
Educational Services

Why Do You Need Veridata? Veridata 3.0 Component Overview

Data discrepancies are a reality of life

 User errors  Configuration errors


- Input errors - Applications
- Unintended use - Replication
- Malicious intent - Network

 Infrastructure errors  Migration Confirmation


- System failure - Database Upgrades
- Disk corruption - Database Migrations
- Network outage - Operating System Upgrades
- Application Upgrades
Existing product Homogeneous Version (Oracle/Tandem)
 Application errors  Real Time Data Integration
Verification Java agent is one executable for all supported databases. Supports heterogeneous cross
- Faulty logic
database comparisons. (Beta)
- Failed upgrades - Data Warehouse
C agent is required for NSK and can be used for Oracle like-to-like comparisons.
- Latent bugs - Query Offloading
- Marketing Databases

5
Oracle GoldenGate Director

What is GoldenGate Director?

Simplifies overall deployment and management of GoldenGate


Oracle GoldenGate TDM products

Management Pack
A centralized server-based graphical application that offers an
intuitive way to define, configure, manage, and report on
GoldenGate TDM processes.

An add-on product for new or existing GoldenGate customers.

31

Oracle GoldenGate Director: Architecture Director Client


Components
Director Server
Live connections to each Rich GUI Client
GoldenGate instance Customizable Diagrams
Database central repository GoldenGate Networks
for user and GoldenGate View
information Configure
Director Client Manage
GUI for creating custom Monitor
network views and accessing GGSCI Execution
the services provided by the Consolidated Logs
Director Server
Alert Functionality
Director Web Director Administrator Email
Browser-based UI that enables For configuring the Director Custom
remote monitoring and control Server Wizard Driven
of GoldenGate

Director Web Oracle GoldenGate Technology Differentiators


Oracle GoldenGate provides low-impact capture, routing, transformation, and
delivery of database transactions across heterogeneous environments in real-time
Browser Based
GoldenGate Instances PERFORMANCE EXTENSIBLE & FLEXIBLE RELIABLE
View
Non-intrusive Open Modular Maintains Transactional
Manage Architecture Integrity
Low Impact
Monitor Heterogeneous Sources Resilient against
Low Latency
GGSCI Execution & Targets interruptions and failures
Consolidated Logs
Email Alerts

Oracle Differentiator

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

6
Value Propositions for Oracle GoldenGate

Oracle GoldenGate

Delivers continuous operations for mission critical applications to


eliminate unplanned outages and reduce cost of planned outages.

Lowers IT costs through heterogeneous support for multiple


platforms to leverage lower cost infrastructure for query offloading.
Oracle GoldenGate
Improves efficiencies through improved performance, scalability of
real-time feeds, and data distribution. Architectural Overview

Reduces risk by ensuring data integrity and reliability between


source and target systems.

Improves business insight through real-time BI Data Warehousing


and report offloading.

Reduces barriers to sharing data because of no application impact


for real time data acquisition.

37 38

How Oracle GoldenGate Works How Oracle GoldenGate Works

Capture: committed transactions are captured (and can be Capture: committed transactions are captured (and can be
filtered) as they occur by reading the transaction logs. filtered) as they occur by reading the transaction logs.
Trail: stages and queues data for routing.

Trail
Capture Capture
LAN/WAN LAN/WAN
Internet Source Trail Internet
TCP/IP TCP/IP

Source Target Source Target


Oracle & Non-Oracle Oracle & Non-Oracle Oracle & Non-Oracle Oracle & Non-Oracle
Database(s) Database(s) Database(s) Database(s)

How Oracle GoldenGate Works How Oracle GoldenGate Works

Capture: committed transactions are captured (and can be Capture: committed transactions are captured (and can be
filtered) as they occur by reading the transaction logs. filtered) as they occur by reading the transaction logs.
Trail: stages and queues data for routing. Trail: stages and queues data for routing.
Pump: distributes data for routing to target(s). Pump: distributes data for routing to target(s).
Route: data is compressed,
encrypted for routing to target(s).

Trail Trail Trail


Capture Pump Capture Pump
LAN/WAN LAN/WAN
Internet Internet
TCP/IP TCP/IP

Source Target Source Target


Oracle & Non-Oracle Oracle & Non-Oracle Oracle & Non-Oracle Oracle & Non-Oracle
Database(s) Database(s) Database(s) Database(s)

7
How Oracle GoldenGate Works How Oracle GoldenGate Works

Capture: committed transactions are captured (and can be Capture: committed transactions are captured (and can be
filtered) as they occur by reading the transaction logs. filtered) as they occur by reading the transaction logs.
Trail: stages and queues data for routing. Trail: stages and queues data for routing.
Pump: distributes data for routing to target(s). Pump: distributes data for routing to target(s).
Route: data is compressed, Route: data is compressed,
encrypted for routing to target(s). encrypted for routing to target(s).
Delivery: applies data with transaction Delivery: applies data with transaction
integrity, transforming the data as required. integrity, transforming the data as required.

Trail Trail Trail Trail


Capture Pump Delivery Capture Pump Delivery
LAN/WAN LAN/WAN
Internet Internet
TCP/IP TCP/IP
Target Trail Source Trail
Source Target Source Delivery Pump Capture Target
Oracle & Non-Oracle Oracle & Non-Oracle Oracle & Non-Oracle Bi-directional Oracle & Non-Oracle
Database(s) Database(s) Database(s) Database(s)

Oracle GoldenGate Advantages Oracle GoldenGate Advantages


MOVEMENT MOVEMENT MANAGEMENT
Speed Subsecond Speed Subsecond Transaction Integrity
Latency Latency Transparent Capture
Volume Thousands of Volume Thousands of Guaranteed Delivery
TPS TPS
Conflict Detection,
Log-based Capture Log-based Capture
Resolution
Native, Local Apply Native, Local Apply
Dynamic Rollback
Efficient IO and Efficient IO and
Bandwidth Usage Bandwidth Usage Incremental TDM
Bidirectional Bidirectional Initial Data Load
Group Transactions Group Transactions GUI-based Monitoring
Bulk Operations Bulk Operations and Configuration
Compression Compression Proactive Alerts
One-to-Many, Many-to- One-to-Many, Many-to- Encryption
One One Real-Time Deferred or
Cascade Cascade Batch
Event Markers

45 46

Oracle GoldenGate Advantages Oracle GoldenGate Heterogeneous Platforms

MOVEMENT MANAGEMENT INTEGRATION Databases O/S and Platforms


Capture:
Speed Subsecond Transaction Integrity Heterogeneous Data Windows 2000, 2003, XP
Latency Sources  Oracle
Transparent Capture Linux
Volume Thousands of  DB2
Guaranteed Delivery Mapping Sun Solaris
TPS  Microsoft SQL Server
HP NonStop
Conflict Detection, Transformation  Sybase ASE
Log-based Capture HP-UX
Resolution Enrichment  Teradata HP TRU64
Native, Local Apply
Dynamic Rollback Decoupled Architecture  Enscribe HP OpenVMS
Efficient IO and  SQL/MP
Incremental TDM Table, Row, Column IBM AIX
Bandwidth Usage  SQL/MX IBM z/OS
Bidirectional Initial Data Load Filtering

Group Transactions GUI-based Monitoring XML, ASCII, SQL
Delivery:
and Configuration Formats
Bulk Operations  All listed above, plus:
Compression Proactive Alerts Queue Interface  HP Neoview, Netezza, Greenplum, and any
One-to-Many, Many-to- Encryption Stored Procedures ODBC compatible databases
One User Exits  ETL products
Real-Time Deferred or
 JMS message queues
Cascade Batch ETL Integration
 MySQL
Event Markers Java/JMS Integration TimesTen

47

8
ETL Integration Delivery to JMS (Java Message System)

GoldenGate captures new transactions from source systems and


publishes to:
Integration via: JMS Queue
Staging tables ETL
JMS Topic
Flat files Integration via Staging Tables Writes as:
Messaging Delivery
Transactions (with guaranteed integrity)
Individual DB Operations (insert, delete)
Integration via Files
Capture Trail File
Delivery
data
data
data
files
files
files ETL

OLTP
Integration via Messaging
Delivery

ETL

JMS / MoM
Queue or
Topic

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Extensibility and Customization

Extensible interface to capture change data <Insert Picture Here>


Vendor Access from custom data sources (message queues,
Module (VAM) flat files, POS systems)
API Used internally as well for transaction log
readers Market Positioning

Loadable custom module can be used for:


Complex transformations
Conflict resolution
User Exit API Writing custom output (flat files, message
queues)
Normalization/denormalization
Aggregation

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Real Time Data


Real-Time Data Integration Integration
Operational Reporting

Solution
Report on live data in transactional systems
Solution Real-time Data Integration No additional load on source system offload reporting
to a database instance that is synchronized in real time
Benefit
Operational Reporting OGG Enables tactical reports quickly for decision making
and business transparency
Real-time Business Intelligence
Removes impact from source systems
Avoids the political challenges of running reports on
Transactional Operational transactional systems
Applications Data Store
What products to position?
Oracle GoldenGate offload to replica. BI Publisher for
operational reporting
Accessing the data in real time using GoldenGate we can
immediately see if were profitable and if our business processes
are working. Qualifier?
- Sam Peterson, SVP Technology, Overstock.com Do you have adequate transparency into the data in your most sensitive
transactional systems?

54

9
Real Time Data
Real-Time Data Integration Integration Oracle Real Time Data Integration
Enables Real-time BI Oracles Unique Offering for Real Time Business Intelligence

Oracle GoldenGate Oracle Data Integrator EE


Real time extracts from High Performance E-LT on
Solution transactional systems target data warehouse
Source 1
Populate an operational data store for operational BI Non-invasive on sources Periodic mini-batches (15 min)
Real-time Integration + Bulk
Data Transformation with real-time data EMP DEPT Transform in the Database
ODI Run ELT from the ODS to load data warehouse with Continuous streaming load Never go back to sources
ODS transformed data
into ODS Schema of target
OGG Benefit Latency in seconds Oracle Data
Improves business insight Integrator
Enterprise Data Warehouse Combines intelligence on current business status with On-Disk Logs
Oracle Database, historical context Oracle
Oracle Exadata GoldenGate
Eliminates load on source systems
Data Mart DIM DIM
Reduces latencies and batch windows Source 2

What products to position? EMP DEPT FACT


Oracle GoldenGate and Data Integrator
Oracle EMP DEPT DIM DIM
Qualifer? GoldenGate
Do you need better business insight with the most current data and no
impact to your critical systems? On-Disk Logs
ODS Schema DW Schema

55 56

Real Time Data Real Time Data


Product Positioning Integration Product Positioning Integration
Data Integration for Business Intelligence Data Integration for Business Intelligence
Typical Data Warehouse Non-Invasive Operational BI
Data Warehouse Loading Operational BI
For Typical Data Warehouse, Position Position GoldenGate for Offloading,
Data Integrator Enterprise Edition BI Publisher for Reporting
ODI-EE has GUI design environment for ETL ODI-EE
Remove the concerns of transaction
developers
Sources: system operations teams about Sources: OGG
ODI-EE has basic changed data capture for Legacy, Target:
typical ETL situations Packaged Enterprise operational BI Legacy,
Packaged
Apps, OLTP Data Apps, OLTP
ODI-EE has rich transformations and ability Databases Warehouse Databases Target:
to add-on Data Quality or Data Mart ODS
Upsell to Add ODI-EE and DW:
Combine Operational and
Upsell to Add GoldenGate to ODI-EE or Real Time Data Warehouse Analytical BI Operational and Analytical BI
3rd Party ETL
Get combined benefits of insight into
When sensitivity about source system
current business state with the deeper
invasiveness is high
ODI-EE analysis and historical context of a
When very low latency is critical
traditional data warehouse
When transactional integrity in the data Sources: OGG OGG
warehouse is important Legacy, Target:
Load the data warehouse by running ELT Sources: OGG
Read Continuous Legacy,
Packaged EDW or off of the ODS to streamline processes Packaged
Apps, OLTP from DB Updates Data Apps, OLTP ODI
Databases Logs Mart and avoid load on transactional system Databases Target:
ODS and
DW

57 58

Summary: Key Opportunities

Focus Area Customer Need Products Installed Lead With

<Insert Picture Here>

Operational Reporting
Oracle Database Active Data Guard Technical Overview
Query Offloading Oracle Technology Active Data Guard
(Offloading Source)
Non-Oracle Database GoldenGate

Play for GoldenGate

For Oracle employees and authorized partners only. Do not distribute to third parties.
59 2009 Oracle Corporation Proprietary and Confidential

10
Online versus Batch Tasks Checkpointing - Capture
For change data capture, Extract and Replicat save checkpoints to a
A GoldenGate Online Process is designed to run indefinitely, and uses
checkpoint file so they can recover in case of failure
checkpoints for recovery
Extract maintains:
A GoldenGate Task is a batch job designed to run once, and is not 3 input checkpoints
recoverable 1 output checkpoint for each trail it writes to
Starting point in Start of oldest Last record read
Change data capture & delivery can be run either continuously (online) transaction log uncommitted from transaction log
transaction
or as a special run (task) to capture changes for a specific period of Input:
time. Transaction Log

Initial load is always a special run (task).


Checkpoints

Output: One or more


GoldenGate Trails
End of last committed
transaction written to trail

Checkpointing - Delivery Oracle GoldenGate Checkpointing (cont)


Capture, Pump, and Delivery save positions to a checkpoint file so they can
Best practice is to create a checkpoint table in the target database recover in case of failure
Checkpoints data are maintained in both the checkpoint table (if it Start of Oldest Open (Uncommitted)
Begin, TX 1 Transaction
exists) and a checkpoint file Insert, TX 1

Replicat maintains 2 input checkpoints: Begin, TX 2 Begin, TX 2


Update, TX 1 Insert, TX 2
Starting position in Last record
Insert, TX 2
trail read from trail Commit, TX 2
Commit, TX 2 Capture
Checkpoint Begin, TX 3

Input: Begin, TX 3 Insert, TX 3


GoldenGate Trail Insert, TX 3 Commit, TX 3
Current
Begin, TX 4 Write
Commit, TX 3 Position

Checkpoints Delete, TX 4
Current Read
Position

Commit Ordered
Capture Source Trail
Source
Database

64

Oracle GoldenGate Checkpointing (cont) Oracle GoldenGate Checkpointing (cont)


Capture, Pump, and Delivery save positions to a checkpoint file so they can Capture, Pump, and Delivery save positions to a checkpoint file so they can
recover in case of failure recover in case of failure
Start of Oldest Open (Uncommitted) Start of Oldest Open (Uncommitted)
Begin, TX 1 Transaction Begin, TX 1 Transaction
Insert, TX 1 Insert, TX 1
Begin, TX 2 Pump Begin, TX 2 Pump Delivery
Begin, TX 2 Begin, TX 2 Begin, TX 2 Begin, TX 2
Checkpoint Checkpoint Checkpoint
Update, TX 1 Insert, TX 2 Insert, TX 2 Update, TX 1 Insert, TX 2 Insert, TX 2
Insert, TX 2 Commit, TX 2 Commit, TX 2 Insert, TX 2 Commit, TX 2 Commit, TX 2
Commit, TX 2 Capture Current Current Commit, TX 2 Capture Current Current Current
Begin, TX 3 Read Write Begin, TX 3 Read Write Read
Checkpoint Checkpoint
Begin, TX 3 Insert, TX 3 Position Position Begin, TX 3 Insert, TX 3 Position Position Position

Insert, TX 3 Commit, TX 3 Insert, TX 3 Commit, TX 3


Current Current
Begin, TX 4 Write Begin, TX 4 Write
Commit, TX 3
Position Commit, TX 3
Position

Delete, TX 4 Delete, TX 4
Current Read Current Read
Position Position

Commit Ordered Commit Ordered Commit Ordered Commit Ordered Delivery


Capture Pump Target Trail Capture Pump Target Trail
Source Trail Source Trail
Source Source Target
Database Database Database

65 66

11
Parameters, Process Groups & Commands Solutions and Architecture Discussion Points

1. How does Oracle GoldenGate different from


simply replicating database operations?
GoldenGate processes are configured by ASCII parameter
files. 2. What are some use cases for Oracle GoldenGate
A process group consists of: TDM software?
An Extract or Replicat process 3. What is the purpose of checkpointing?
Associated parameter file
Associated checkpoint file
Any other files associated with that process
Each process group on a system must have a unique group name.
Processes are added and started using the GoldenGate
Software Command Interface (GGSCI) with the group name.
GGSCI commands also add trails, check process status, etc.

GoldenGate Instantiation
Start change data capture on Source Database
Current source Commit Sequence Number (CSN) is 222

Oracle GoldenGate
Instantiation Current CSN is
222 CSNs 222
through

Commit Ordered Commit Ordered


Capture Source Trail Pump Target Trail
Source Target
Database Database

69 70

Instantiation for GoldenGate GoldenGate Instantiation


Wait for any open transactions to close Start delivery at or after given backup CSN (245 in this case)
Current source Commit Sequence Number (CSN) is 356
Use a backup (or export/import) to copy source to target as of a
consistency point Once Delivery is current the source and target are in sync
Current source Commit Sequence Number (CSN) is 245

Consistent Consistent
Current CSN is as of CSN Current CSN is Deliver as of CSN
245 CSNs 222 245 356 CSNs 222 transactions 356
through through 356 after CSN
245 In Sync!

Commit Ordered Commit Ordered Commit Ordered Commit Ordered


Capture Source Trail Pump Target Trail Capture Source Trail Pump Target Trail Delivery
Source Target Source Target
Database Database Database Database

Take Backup Apply Take Backup Apply


as of CSN Backup as of as of CSN Backup as of
245 CSN 245 245 CSN 245

71 72

12
Zero Downtime Migration & Upgrade Operational BI
Zero Downtime OS and DB Migrations Real-time Data Integration to Support Reporting Demands
ADP Reporting = Consolidate Product Line
Business Challenges: Data to Off-load Real-Time Reporting
RIM BlackBerry has a very small monthly window to take 40+ Source Systems in ASP Environment:
downtime for upgrades, migrations, and planned Zero-Downtime OS and Database Business Challenges:
HR, Payroll, Benefits Products
maintenance Upgrade with Application Maintenance  Common real-time reporting functionality
Strict SLA limits with the major Telcos!
across ADP product suites
GoldenGate Solution:  Ability to do cross-product reporting
Zero-Downtime Upgrade and OS change for business-  Incremental revenue opportunity and Oracle Oracle Oracle SQL Server
critical Oracle databases improved customer service
GoldenGate Veridata to ensure that all data from source
 Reporting gets moved off from production
is in-synch with target and that migration has been Application Maintenance
successful databases
Provisioning Provisioning
GoldenGate Benefits: Database migration GoldenGate Solution:
Fail-back capability to reduce business risk and downtime with failback  Live Reporting for real-time data consolidation
No manual intervention to reduce possibility of errors from 40+ source systems into a centralized
Assurance of database consistency with Veridata. target
Reporting:
 Minimal footprint and data latency Oracle Data Mart
Oracle 10.2.0.3 Oracle 10.2.0.4 Business Objects,
HP-UX HP-UX  Maintains data integrity Crystal
Waterloo Slough, U.K.  Ability to support data transformations and
data security With GoldenGate it was boom, boom, boom full
speed ahead.
- Amit Mukherjee, Senior Director of Reporting
Services, ADP

73 74

Real Time Business Intelligence


Active Data Warehouse Improves Customer Service
Active Enterprise Intelligence
Business Challenges:
 Provide up-to-second data in centralized
enterprise data warehouse for business users Operational Systems
(customer claims processing for major incidents) DB2
<Insert Picture Here>
 Integrate data from multiple operational systems Mainframe DB2 LUW
(DB2 on z/OS and LUW)
 Leverage existing ETL investment to achieve
near real-time data feeds.
Oracle GoldenGate
GoldenGate Solution:
 Real-Time Data Warehousing captures ~40
million transactions per day from heterogeneous Customer Claims
Implementation and Configuration
operational sources. Dual Active Processing
(SAS BI)
 Real-Time CDC co-exists with Informatica ETL
for data requiring heavy transformations.
Results:
 Reduced claims litigation costs by 20% - Teradata Warehouse
enabled by faster and more responsive
Data is not a business problem! It is the foundation of
employee intelligence on claims data.
our ability to be profitable in a rapidly changing
 Improved resource utilization efficiency by 5% marketplace.
 Management team can now dynamically monitor - Eric Post, Director of Data Warehousing, Liberty
reserve threshold to increase profitability. Mutual

For Oracle employees and authorized partners only. Do not distribute to third parties.
75 2009 Oracle Corporation Proprietary and Confidential

Configuring Oracle GoldenGate Configuring Oracle GoldenGate


Oracle GoldenGate can be deployed quickly and
easily in four steps:
1. Prepare the Environment
Source
1. Prepare the Environment Database

2. Change Capture 3. Initial Load (various methods)


Target
Database

3. Initial Load
Capture Delivery

4. Change Delivery Trail


Target Trail
Transaction 2. Change Capture 4. Change Delivery
Logs

13
Prepare Environment: Installation - Windows

Download .zip file from Oracle GoldenGate Software


Download web site to <A Windows Directory exp: C:\GGS>

Unzip .zip file into <Windows Director exp: C:\GGS folder>


Configuring Oracle GoldenGate:
Configure a Windows Service Name for Manager process
Step 1. Prepare the Environment in a GLOBALS parameter file (required only if multiple
Managers on the server)

C:\GGS> INSTALL ADDSERVICE ADDEVENTS

GGSCI> CREATE SUBDIRS

June 9, 2010

Prepare Environment: Installation Prepare Environment: Installation -


Windows INSTALL Program Multiple Manager Services
On Windows, an INSTALL program performs the following functions:
Oracle GoldenGate supports running multiple Manager
Installs Oracle GoldenGate event messages into the system registry services on Windows
Installs the Manager as a Windows service For two or more Oracle GoldenGate instances, or
Oracle GoldenGate with a Veridata C Agent (which uses a
Syntax: Manager)
INSTALL <item> [<item> ]
Each Manager service must be assigned a unique name
Example: Before installing the service, you can specify the name
C:\GGS> INSTALL ADDEVENTS ADDSERVICE Create a GLOBALS parameter file for each Manager
Specify the one-word name of the service using the
MGRSERVNAME <name> parameter
Note: The uninstall command is:
INSTALL DELETESERVICE DELETEEVENTS INSTALL ADDSERVICE
Reads the GLOBALS MGRSERVNAME for the service name
If no GLOBALS setting, uses default service name GGSMGR

Prepare Environment: Installation - Prepare Environment: Installation


UNIX, Linux or z/OS NonStop SQL/MX
For a SQL/MX source, install Oracle GoldenGate on OSS running on
Download .gz file from Oracle GoldenGate Software Download the NonStop source system:
web site to <Directory exp: /ggs>
Download .gz file from GoldenGate Support web site to /ggs
gzip d {filename}.tar.gz
gzip d {filename}.tar.gz tar -xvf {filename}.tar
GGSCI> CREATE SUBDIRS
tar -xvof {filename}.tar Run the ggmxinstall script

For a SQL/MX target, install Oracle GoldenGate


GGSCI> CREATE SUBDIRS
Either on OSS running on the NonStop target system
(as described above)
Or on an intermediate Windows system(as described earlier)

14
Prepare Environment: Installation
Oracle GoldenGate Directories
DIRECTORY CONTENTS
Dirchk Oracle GoldenGate checkpoint files

Dirdat Oracle GoldenGate trail and extract files

Dirdef Data definitions produced by DEFGEN and used to translate


Workshop:
heterogeneous data
Dirpcs Process status files
Using Oracle GoldenGate Documentation
Dirprm Parameter files

Dirrpt Process report files

Dirsql SQL scripts

Dirtmp Temporary storage for transactions that exceed allocated


memory

Lab Exercise: Prepare the Environment:


Installation on Windows and/or UNIX Configure and Start Manager

Prepare Environment: Manager - Overview Prepare Environment: Manager - Configuration

Performs system management and monitoring tasks Create the parameter file using GGSCI

Starting Oracle GoldenGate processes GGSCI> EDIT PARAM MGR


Starting dynamic Server Collector, Replicat, or GGSCI
processes
Start the Manager using GGSCI
Error and lag reporting
Oracle GoldenGate trail management GGSCI> START MGR

Parameter file
mgr.prm file in GGS ./dirprm directory
Note: To determine which port Manager is using
Event information written to ggserr.log file
GGSCI> INFO MGR

15
Prepare Environment: Manager
Sample MGR Parameter File
PORT 7809
DYNAMICPORTLIST 8001, 8002, 95009520

PURGEOLDEXTRACTS /ggs/dirdat/aa*, USECHECKPOINTS Prepare the Environment:


PURGEOLDEXTRACTS /ggs/dirdat/bb*, &
USECHECKPOINTS, MINKEEPDAYS 5 Generate Source Definitions
(Heterogeneous Source/Target)
AUTOSTART ER *
AUTORESTART EXTRACT *, WAITMINUTES 2, RETRIES 5

LAGREPORTHOURS 1
LAGINFOMINUTES 3
LAGCRITICALMINUTES 5

Prepare Environment: Source Definitions - Prepare Environment: Source Definitions


Overview Run DEFGEN
The problem DEFGEN is initiated from the command prompt
Understanding source and target layouts across disparate systems and
databases
Syntax
defgen paramfile <paramfile> [ reportfile <reportfile> ]

The solution the DEFGEN utility program Example


DEFGEN produces a file containing layout definitions of the source files Unix:
and tables defgen paramfile /ggs/dirprm/defgen.prm
This source definition file is used to interpret layouts for data stored in reportfile /ggs/dirrpt/defgen.rpt
GoldenGate trails
At start up Replicat reads the definition file specified with the Windows:
SOURCEDEFS parameter defgen paramfile c:\ggs\dirprm\defgen.prm
Server Collector uses the d argument to specify which definition file reportfile c:\ggs\dirrpt\defgen.rpt
to read at startup
Results
Can also capture target definitions on target system and copy to Definitions are saved to the file specified in the parameter file
source system for Extract to use This file needs to be transferred to the target system as a text file

Prepare Environment: Source Definitions -


Sample DEFGEN Parameters

DEFSFILE /ggs/dirdef/source.def, PURGE


SOURCEDB mydb, USERID ggs, PASSWORD ggs
TABLE SALES.ACCOUNT;
TABLE SALES.PRODUCT;
Prepare the Environment:
Prepare Source Database
Parameter Specifies
DEFSFILE The output definitions file location and name

SOURCEDB The database name (if needed)

USERID The user ID and password (if needed) to access the database

TABLE The table(s) to be defined

16
Prepare Environment: Source Database Prepare Environment: Source Database
Overview SQL Server
To prepare the SQL Server source environment for Oracle
Set up the database to: GoldenGate:
Ensure access by Oracle GoldenGate
Enable transaction logging Create the ODBC data source
Oracle GoldenGate connects to a SQL Server database through an
ODBC connection
Note: the exact steps depend on the database
Extract and Replicat require an established data source name (dsn)

Set up transaction logging


Log truncation and non-logged bulk copy must be turned off
The SQL Server database must be set to full recovery mode
Before Oracle GoldenGate processes are started, at least one full
database backup must be done
ADD TRANDATA to mark tables for replication

Prepare Environment: Source Database Prepare Environment: Source Database


SQL Server 2005 Other Databases
Additional considerations for SQL Server 2005 database:
DB2
Either install Microsoft Cumulative Update package 6 for SQL Enter DATA CAPTURE CHANGES at the column for LOB data
Server 2005 Service Pack 2 (or later) type
Set TRANLOGOPTIONS to ADD TRANDATA to mark tables for replication
MANAGESECONDARYTRUNCATIONPOINT
Sybase
Set the secondary truncation point in the logs
Or install SQL Server replication components
ADD TRANDATA to mark tables for replication
Create a distribution database
Add a replication publication Oracle
Set transaction retention to zero Add minimal supplemental logging at database level
Disable replication alerts ADD TRANDATA to mark tables for replication
Log full before and after images (no compressed)
Set TRANLOGOPTIONS to NonStop SQL/MX
NOMANAGESECONDARYTRUNCATIONPOINT Special installation steps but no special database preparation

Prepare Environment Discussion Points

1. Where do you download Oracle GoldenGate software


from?
2. What are the roles and responsibilities of the Manager
Lab Exercise: process?
Prepare the Environment

17
GGSCI Starting and Help

Start the command interface from the GoldenGate install


directory:
Shell> cd <GoldenGate install location>
Shell> GGSCI

Configuring Oracle GoldenGate: For Help Summary page:


Oracle GoldenGate Command Interface GGSCI> HELP

For Help on a specific command:


GGSCI> HELP <command> <object>

For example: GGSCI> HELP ADD EXTRACT

Help returns overview, syntax and example

GGSCI Commands GGSCI Commands (contd)


MANAGER EXTRACT REPLICAT ER EXTTRAIL RMTTRAIL TRANDATA CHECKPOINT TRACE
TABLE TABLE Commands
ADD X X X X X X X Parameters SET EDITOR, EDIT PARAMS, VIEW PARAMS
ALTER X X X X Database DBLOGIN, ENCRYPT PASSWORD, LIST TABLES
CLEANUP X X X DUMPDDL [SHOW]
DDL
DELETE X X X X X X X X
Miscellaneous !command, CREATE SUBDIRS, FC, HELP, HISTORY,
INFO X X X X X X X X X INFO ALL, OBEY, SHELL, SHOW, VERSIONS, VIEW
KILL X X X GGSEVT, VIEW REPORT
LAG X X X
REFRESH X
SEND X X X X
START X X X X
STATS X X X
STATUS X X X X
STOP X X X X

GGSCI Examples Using Obey Files


Start a Manager process
You can use an Obey file to perform a reusable sequence
GGSCI> START MGR of commands

Add an Extract group Save the commands in a text file, for example:
START MGR
GGSCI> ADD EXTRACT myext, TRANLOG, BEGIN NOW ADD EXTRACT myext, TRANLOG, BEGIN NOW
ADD EXTTRAIL /ggs/dirdat/rt, EXTRACT myext
Add a local trail START EXTRACT myext

GGSCI> ADD EXTTRAIL /ggs/dirdat/rt, EXTRACT myext Then use the GGSCI OBEY command to run the file:

Start an Extract group GGSCI> OBEY <obey filename>.oby

GGSCI> START EXTRACT myext Note. An Obey file can have any file extension or none.

18
Running GoldenGate from OS Shell

You can also start GoldenGate processes from the OS command


shell when running a batch job or initial load, for example:

Shell> cd <GoldenGate install location>


Workshop:
Shell> extract paramfile <filepath> reportfile <filepath> Using Commands
[-p <port>]

Shell> replicat paramfile <filepath> reportfile <filepath>

This is especially useful to schedule GoldenGate batch jobs to


run during off-peak hours using a command-line capable
scheduler

GoldenGate Commands Discussion Points

1. What is GGSCI?
2. Where can you view GoldenGates command syntax?
3. What is an Obey file and why would you use one?
Configuring Oracle GoldenGate:
Step 2. Change Capture

June 9, 2010

Step 2. Change Capture Change Capture - Extract Overview

Extract can be configured to capture changed


data from database logs
1. Prepare the Environment
Source
Database
Extract can be configured for initial data load to
3. Initial Load (various methods) capture data directly from source tables
Target
Database

Extract can distribute data to other remote


Capture Delivery
systems directly from Oracle GoldenGate trails
Trail
Target Trail
Transaction 2. Change Capture 4. Change Delivery
Logs

19
Change Capture - Tasks Change Capture - ADD EXTRACT Command

On the source system: Add the initial Extract checkpoint with the GGSCI command ADD
EXTRACT:
Add an initial Extract checkpoint for your data
source ADD EXTRACT <group name>
, <data source>
Set up a parameter file for Extract , <starting point>
[, <processing options>]
Define Oracle GoldenGate trails or output files
The components of this command are discussed in
Start Extract subsequent slides.

Change Capture - ADD EXTRACT <data source> Change Capture - ADD EXTRACT <starting point>
<data source> Source (and when used) <starting point> Database
SOURCEISTABLE Database table (initial data load) BEGIN {NOW | <datetime> } Any

TRANLOG Transaction log (change capture) EXTSEQNO <seqno>, EXTRBA <relative byte address> Oracle, SQL/MX
[<bsds name>] [DB2 z/OS]
EXTRBA <relative byte address> DB2 z/OS
EXTFILESOURCE <file name> Extract file (data pump)
EOF | LSN <value> DB2 LUW
EXTTRAILSOURCE <trail name> Trail (data pump)
LSN <value> SQL Server, Ingres

LOGNUM <log number>, LOGPOS <byte offset> c-tree


PAGE <data page>, ROW <row> Sybase

Change Capture - ADD EXTRACT <processing


Change Capture - ADD EXTRACT Examples
options>
Create an Extract group named finance that extracts database
<processing options> Specifies changes from the transaction logs. Start extracting with records
generated at the time when you add the Extract group.
DESC <description> Description of Extract group ADD EXTRACT finance, TRANLOG, BEGIN NOW

Create an Extract group named finance that extracts database


THREADS <n> Number of redo threads when extracting changes from the transaction logs. Start extracting with records
from an Oracle RAC clustered database generated at 8:00 on January 31, 2006.

ADD EXTRACT finance, TRANLOG, BEGIN 2006-01-31 08:00


PARAMS <file name> Alternative parameter file name (fully
qualified) Create a data-pump Extract group named finance that reads
from the GoldenGate trail c:\ggs\dirdat\lt.
PASSTHRU Used only in Data Pumps. Passes the data
through without any transformation. ADD EXTRACT finance, EXTTRAILSOURCE c:\ggs\dirdat\lt

REPORT <file name> Alternative report file name (fully Create an initial-load Extract named load.
qualified) ADD EXTRACT load, SOURCEISTABLE

20
Change Capture - Edit Extract Parameters Change Capture - Add a Local/Remote Trail
Add a local or remote trail with the GGSCI command:
Create/edit an Extract parameter file with the GGSCI
command: ADD EXTTRAIL | RMTTRAIL <trail name>
, EXTRACT <group name>
EDIT PARAMS <group name> [, MEGABYTES <n>]

EXTRACT ODS If using a data pump:


USERID GoldenUser, PASSWORD password The primary extract needs a local trail (EXTTRAIL)
RMTHOST serverx, MGRPORT 7809 The data pump needs a remote trail (RMTTRAIL)
RMTTRAIL ./dirdat/rt
TABLE SALES.ORDERS;
Examples:
TABLE SALES.INVENTORY;
ADD EXTTRAIL .dirdat\aa, EXTRACT finance, MEGABYTES 10

ADD RMTTRAIL .dirdat\bb, EXTRACT parts, MEGABYTES 5

Change Capture - Start Extract Change Capture Sample Oracle Configuration

Start an Extract process with the GGSCI command: GGSCI> EDIT PARAMS ODS
Source
START EXTRACT <group name> Database
EXTRACT ODS
USERID GoldenUser, PASSWORD password
Normally this also triggers the target Manager process to RMTHOST 162.111.23.49, MGRPORT 7809
start a Server Collector process with default parameters Transaction RMTTRAIL /ggs/dirdat/rt
Log TABLE SALES.ORDERS;
TABLE SALES.INVENTORY;
Users can start Server Collector statically and modify the GGSCI> ADD EXTRACT ODS, TRANLOG, BEGIN NOW
parameters, though rarely used. See the GoldenGate for Capture GGSCI> ADD RMTTRAIL /ggs/dirdat/rt, EXTRACT ODS
Windows and Unix Reference Guide. GGSCI> START EXTRACT ODS
Note: The remote trail is created on the target system
Network
(TCP/IP)

/ggs/dirdat/rt000000
Trail /ggs/dirdat/rt000001

Change Capture Sample DB2 and SQL Server


Configuration
Source GGSCI> EDIT PARAMS ODS
Database
EXTRACT ODS
SOURCEDB dsn, USERID login, PASSWORD pw

Transaction
RMTHOST 162.111.23.49, MGRPORT 7809 Lab Exercise:
RMTTRAIL /ggs/dirdat/rt
Log TABLE SALES.ORDERS; Configure Change Capture
TABLE SALES.INVENTORY;

GGSCI> ADD EXTRACT ODS, TRANLOG, BEGIN NOW


Capture GGSCI> ADD RMTTRAIL ./dirdat/rt, EXTRACT ODS
GGSCI> START EXTRACT ODS

Network Note: The remote trail is created on the target system


(TCP/IP)

/ggs/dirdat/rt000000
Trail /ggs/dirdat/rt000001

21
Change Capture Discussion Points

1. What does Extract do?


2. Where does Extract capture transactional changes from?
3. What parameters tell Extract where to send data?
4. What parameter is used to identify the remote target Configuring Oracle GoldenGate:
system? Step 3. Initial Load
5. What commands are used to create and start an Extract
group?
6. What command option is used to set how large a
GoldenGate trail file may get before it rolls to the next file?

Step 3. Initial Load Initial Load: Resource Limitations

How close are your systems?

1. Prepare the Environment


Source How large are your tables?
Database

3. Initial Load (various methods) What are the outage time constraints?
Target
Database

How much disk space do you have to store


Capture Delivery
changes?
Trail
Target Trail
Transaction 2. Change Capture 4. Change Delivery
Logs

Initial Load: Advantages of GoldenGate Methods Initial Load: GoldenGate Methods - Queue Data
Work across heterogeneous database types and platforms
SQL*
File Loader
No application downtime required Manager

Source Target
Database Database
Read directly from source tables, without locking tables File BCP

File
Fetch data in arrays to speed performance Capture File
SSIS

Parallel processing using WHERE clauses or RANGE function

Distribute data over multiple network controllers Trails Delivery

ADD EXTRACT <name>


Flexible load alternatives, including native bulk load utilities Extract parameters:
SOURCEISTABLE
RMTFILE <name>
GoldenGate change delivery can handle collisions with initial load FORMATASCII BCP or SQLLOADER

22
Initial Load: GoldenGate Methods - Direct Load Initial Load: GoldenGate Methods - Direct Bulk
Load (to Oracle)

Manager
Manager Manager
Manager
Manager Manager
Source Target Source Oracle
Database Database Database Target

Extract Source SQL*


Loader
Database
Capture Delivery
Capture Delivery

ADD EXTRACT <name>, SOURCEISTABLE ADD REPLICAT <name>, SPECIALRUN


ADD EXTRACT <name>, SOURCEISTABLE ADD REPLICAT <name>, SPECIALRUN
Extract parameters: Replicat parameters:
Extract parameters:
RMTTASK REPLICAT, GROUP <name> BULKLOAD
RMTTASK REPLICAT, GROUP <name>

Initial Load Discussion Points

1. What are the three GoldenGate methods for initial


load?
2. What GoldenGate command arguments specify
Lab Exercise: that Extract and Replicat run as batch tasks (e.g.
Initial Data Load for initial load)?
3. What parameter manages conflicts between initial
load and change replication? Where is it specified?

Step 4. Change Delivery

1. Prepare the Environment


Source
Configuring Oracle GoldenGate: Database

Step 4. Change Delivery 3. Initial Load (various methods)


Target
Database

Capture Delivery

Trail

Target Trail
Transaction 2. Change Capture 4. Change Delivery
Logs

June 9, 2010

23
Change Delivery - Replicat Overview Change Delivery - Tasks

Replicat can: On the target system:


Create a checkpoint table in the target database (best practice)
Read data out of GoldenGate trails DBLOGIN
ADD CHECKPOINTTABLE
Perform data filtering Create a parameter file for Replicat
Table, row, operation EDIT PARAMS

Perform data transformation Add your initial Replicat checkpoint into GoldenGate trails
ADD REPLICAT
Perform database operations just as your application
performed them Start the Replicat process
START REPLICAT

Change Delivery Sample Oracle Configuration Change Delivery - Avoiding Collisions with
Initial Load
Trails If the source database remains active during an
GGSCI> DBLOGIN SOURCEDB mydb USERID login PASSWORD pw
initial load, you must either avoid or handle any
Trail
GGSCI> ADD CHECKPOINTTABLE ggs.checkpt collisions when updating the target with interim
GGSCI> EDIT PARAMS REPORD changes
REPLICAT REPORD
TARGETDB dsn USERID ggsuser PASSWORD ggspass Avoiding Collisions
-- USERID ggsuser, PASSWORD ggspass
Delivery
ASSUMETARGETDEFS If you can backup/restore or clone the database at a
DISCARDFILE /ggs/dirrpt/REPORT.dsc, APPEND
MAP SALES.ORDERS, TARGET SALES.ORDERS;
point in time, you can avoid collisions by starting
MAP SALES.INVENTORY, TARGET SALES.INVENTORY; Replicat to read trail records from a specific
transaction Commit Sequence Number (CSN):
GGSCI> ADD REPLICAT REPORD, EXTTRAIL /ggs/dirdat/rt
GGSCI> START REPLICAT REPORD
START REPLICAT <group> ATCSN | AFTERCSN <csn>
Target
Database

Change Delivery - Handling Collisions with


Initial Load
If you cannot avoid collisions by the prior method, you must
handle collisions

Use the Replicat HANDLECOLLISIONS parameter:


When Replicat encounters a duplicate-record error on an insert, it
Lab Exercise:
writes the change record over the initial data load record - Configure Change Delivery
When Replicat encounters a missing-record error for an update or - Generate Activity and View Results
delete, the change record is discarded

24
Change Delivery Discussion Points Day 1 Summary

1. What does Replicat do? Presentations


Oracle GoldenGate Overview
2. When is ASSUMETARGETDEFS valid?
Solutions <Insert Picture Here>
3. How does Replicat know the layout of the source Products
tables when source and target schemas differ? Technology Overview
4. What commands are used to create and start a Oracle GoldenGate Architecture
Replicat group? Configuring Oracle GoldenGate:
5. What GGSCI command creates a GoldenGate 1.Prepare the Environment
checkpoint table on the target database? 2.Change Capture
6. What is the purpose of the DISCARDFILE? 3.Initial Load
4.Change Delivery
7. Who can draw a flow chart of basic change
capture and delivery?
Student Labs

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Program Day 2

Presentations
Data Pumps
<Insert Picture Here> Extract Trails and Files <Insert Picture Here>

Parameters
Oracle GoldenGate Data Mapping and Transformation

Program Day 2 Student Labs

For Oracle employees and authorized partners only. Do not distribute to third parties. For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential 2009 Oracle Corporation Proprietary and Confidential

Data Pumps - Overview

Data is stored in a trail on the source system

A second Extract, the data pump:


Configuring Oracle GoldenGate:
Reads this trail and sends it to one or more targets
Data Pumps Manipulates the data or passes it through without change

Reasons for using


A safeguard against network and target failures
To break complex data filtering and transformation into phases
To consolidate data from many sources
To synchronize one source with multiple targets

25
Data Pumps One to Many Trails Data Pumps One to Many Target Systems

Data Pump 1

Primary Target Trail


Primary Data Pump
Capture Data Pump 2
Capture Target Trail

Target Trail Target Trail


Data Pump 3
Target Trail Target Trail

Target Trail
Target Trail

Data Pumps - Configuration

Primary Extract parameters specify a local trail:

EXTRACT <primary>
<login for your database>
EXTTRAIL ./dirdat/<trailid>
<table statements as required>; Workshop:
Data pumps are often configured for pass-through:
Configure a Data Pump

EXTRACT <datapump>
PASSTHRU
RMTHOST <target >, MGRPORT <port>
RMTTRAIL ./dirdat/<rmttrail>
<table statements as required>;

Add a data pump (source is the local trail from the primary
Extract )
ADD EXTRACT <datapump>, EXTTRAILSOURCE ./dirdat/<trailid>

Data Pumps Discussion Points

1. What is a data pump?


2. What is the advantage of using a data pump?
3. Why might you use multiple data pumps for one
source trail? Oracle GoldenGate
4. What parameter is commonly used on data Extract Trails and Files
pumps?
5. Who can draw a flow chart of change capture &
delivery using a data pump?

26
Extract Trails and Files Extract Trails and Files - Overview

Introduction Extract writes data to any of:


Remote trail (RMTTRAIL)
Remote file (RMTFILE)
Canonical data format Local trail (EXTTRAIL)
Local file (EXTFILE)
Alternative trail formats
Extract trails and files are unstructured, with variable length
records
Viewing in Logdump I/O performed using large block writes

Reversing the sequence Extract writes checkpoints for trails during change capture:
Guarantees no data lost during restart
Multiple Replicat processes may process the same trail

Extract does not write checkpoints for files

158

Extract Trails and Files - Distribution Extract Trails and Files - Contents

Each record in the trail contains an operation that has


Extract can write: been committed in the source database
 To local trails, then distribute over IP with a data pump to remote
trails
 To multiple trails Transactions are output in commit order
For distribution multiple systems/disk storage devices
For parallel processing by downstream processes Operations in a transaction are grouped together, in the
order they were applied
Trails and files can be transported online using TCP/IP
or sent in batch using any file transfer method By default, only the primary key and changed columns are
recorded

Flags indicate the first and last records in each


transaction

159

Extract Trails and Files - Cleanup

Trail files can be purged once consumed


Temporary storage requirement is small if processes keep pace
Configure Manager to purge used trail data (best practice)
Extract Trails and Files:
Canonical Data Format

27
Canonical Data Format Canonical Data Format - File Header
Each trail file has a file header that contains:
Trail file information
Compatibility level
By default, trails are formatted in the Canonical Character set
Data Format Creation time
File sequence number
File size
Each trail file has a trail file header and trail records
First and last record information
GoldenGate components only read Canonical Data Timestamp
Format Commit sequence number (CSN)

Extract information
GoldenGate version
Group name
Host name
Hardware type
OS type and version
DB type, version and character set

Canonical Data Format - Compatibility Canonical Data Format - Commit Sequence


Level Number (CSN)

Identifies the trail file format by GoldenGate Identifies the sequence in which transactions were
<major>.<minor> version numbers committed:

Allows customers to use different versions of More efficient for deciding which transaction
GoldenGate Extract, trail files and Replicat together completed first than using heterogeneous database-
supplied transaction identifiers
Set in Extract EXTFILE, EXTTRAIL, RMTFILE or
RMTTRAIL parameter; for example: The CSN is based on various database identifiers;
RMTTRAIL /ggs/dirdat/ex, FORMAT RELEASE 10.0
for example:
The input and output trails of a data pump must For Oracle, the system change number (SCN)
have the same compatibility level For Teradata, the sequence ID

Canonical Data Format - Records


Each trail record contains:
Eye-catchers for each section
GoldenGate record header (50 bytes plus length of table name)
Contains metadata of the change
Table or File name Extract Trails and Files:
I/O type
Before/After indicator Alternative Formats
Transaction information
Transaction time
Transaction group
Length of data area
Plus other information
Optional user token area
Token ID, token value
Data area
Column ID, column value

28
Extract Trails and Files - Alternative Formats Alternative Formats: FORMATASCII

Alternative output formats can be specified by Output is in external ASCII format


the Extract parameters:
Can format data for popular database load utilities
FORMATASCII
FORMATASCII, BCP
FORMATSQL
FORMATASCII, SQLLOADER
FORMATXML

Data cannot be processed by GoldenGate Replicat

Alternative Formats: FORMATASCII (contd) Alternative Formats: FORMATASCII Syntax

By default, the output includes: FORMATASCII


[, BCP]
Operation Type (I, U/V, D)
[, COLHDRS ]
Before/After Indicator (B/A) [, DATE | TIME | TS ]
Table name [, DELIMITER <delimiter> ]
[, EXTRACOLS ]
Field name, Field value, . [, NAMES ]
Field delimiter, defaults to Tab [, NONAMES ]
[, NOHDRFIELDS ]
New Line Indicator after each row
[, NOQUOTE ]
Additional information surrounds operations in a transaction [, NOTRANSSTMTS ]
Begin Indicator [, NULLISPACE ]
Transaction time [, PLACEHOLDERS ]
Sequence number and RBA [, SQLLOADER ]

Alternative Formats: FORMATASCII


Alternative Formats: FORMATSQL
Sample Output
The transaction that is the subject of the examples: Output is in external SQL DML format
INSERT INTO CUSTOMER VALUES ("Eric", "San Fran", 550);
UPDATE CUSTOMER SET BALANCE = 100 WHERE CUSTNAME = "Eric";
COMMIT;
Data cannot be processed by Replicat
Example 1. FORMATASCII without options produces the following:
B,1997-02-17:14:09:46.421335,8,1873474,
I,A,TEST.CUSTOMER,CUSTNAME,'Eric',LOCATION,
'San Fran',BALANCE,550,
Default output for each transaction includes:
V,A,TEST.CUSTOMER,CUSTNAME,'Eric',BALANCE,100,
C, Begin transaction indicator, B
Timestamp at which the transaction was committed
Example 2. FORMATASCII, NONAMES, DELIMITER '|' produces the following:
B|1997-02-17:14:09:46.421335|8|1873474| Sequence number of transaction log containing commit
I|A|CUSTOMER|'Eric'|'San Fran'|550|
V|A|CUSTOMER|CUSTNAME|'Eric'|BALANCE|100| RBA of commit record within transaction log
C|
SQL Statement
Note: The last record returns column names for the CUSTNAME and
BALANCE columns because the record is a compressed update and Commit indicator, C
PLACEHOLDERS was not used.
Newline indicator

29
Alternative Formats: FORMATSQL Syntax Alternative Formats: FORMATSQL
Sample Output
FORMATSQL B,2008-11-11:13:48:49.000000,1226440129,155,
DELETE FROM TEST.TCUSTMER WHERE CUST_CODE='JANE';
[, NONAMES ] DELETE FROM TEST.TCUSTMER WHERE CUST_CODE='WILL';
[, NOPKUPDATES ] DELETE FROM TEST.TCUSTORD WHERE CUST_CODE='JANE' AND
ORDER_DATE='1995-11-11:13:52:00' AND PRODUCT_CODE='PLANE' AND
[, ORACLE ] ORDER_ID='256';
DELETE FROM TEST.TCUSTORD WHERE CUST_CODE='WILL' AND
ORDER_DATE='1994-09-30:15:33:00' AND PRODUCT_CODE='CAR' AND
ORDER_ID='144';
INSERT INTO TEST.TCUSTMER (CUST_CODE,NAME,CITY,STATE) VALUES
('WILL','BG SOFTWARE CO.','SEATTLE','WA');
INSERT INTO TEST.TCUSTMER (CUST_CODE,NAME,CITY,STATE) VALUES
('JANE','ROCKY FLYER INC.','DENVER','CO');
INSERT INTO TEST.TCUSTORD
(CUST_CODE,ORDER_DATE,PRODUCT_CODE,ORDER_ID,PRODUCT_PRICE,P
RODUCT_AMOUNT,TRANSACTION_ID) VALUES ('WILL','1994-09-
30:15:33:00','CAR','144',17520.00,3,'100');
INSERT INTO TEST.TCUSTORD
(CUST_CODE,ORDER_DATE,PRODUCT_CODE,ORDER_ID,PRODUCT_PRICE,P
RODUCT_AMOUNT,TRANSACTION_ID) VALUES ('JANE','1995-11-
11:13:52:00','PLANE','256',133300.00,1,'100');
C,

Alternative Formats: FORMATXML Alternative Formats: FORMATXML


Sample Output
<transaction timestamp="2008-11-11:14:33:12.000000">
<dbupdate table="TEST.TCUSTMER" type="insert">
Output is in XML format <columns>
<column name="CUST_CODE" key="true">ZEKE</column>
<column name="NAME">ZEKE'S MOTION INC.</column>
<column name="CITY">ABERDEEN</column>
Data cannot be processed by Replicat <column name="STATE">WA</column>
</columns>
</dbupdate>
<dbupdate table="TEST.TCUSTMER" type="insert">
Syntax <columns>
<column name="CUST_CODE" key="true">ZOE</column>
<column name="NAME">ZOE'S USED BICYCLES</column>
FORMATXML <column name="CITY">ABERDEEN</column>
<column name="STATE">WA</column>
[, INLINEPROPERTIES | NOINLINEPROPERTIES ] </columns>
</dbupdate>
[, TRANS | NOTRANS ] <dbupdate table="TEST.TCUSTMER" type="insert">
<columns>
<column name="CUST_CODE" key="true">VAN</column>
<column name="NAME">VAN'S BICYCLESS</column>
<column name="CITY">ABERDEEN</column>
<column name="STATE">WA</column>
</columns>
</dbupdate>
</transaction>

Logdump

The Logdump utility allows you to:


Display or search for information that is stored in GoldenGate trails
or files
Extract Trails and Files: Save a portion of a GoldenGate trail to a separate trail file

Viewing in Logdump

30
Logdump Starting and Getting Online Help Logdump Opening a Trail

To start Logdump - from the GoldenGate installation directory:


Logdump> open dirdat/rt000000
Shell> logdump
Logdump responds with:
To get help:
Current LogTrail is /ggs/dirdat/rt000000
Logdump 1 > help

The Logdump utility is documented in the GoldenGate for


Windows and UNIX Troubleshooting and Performance Tuning
Guide.

Logdump Setting up a View Logdump Viewing the Trail File Header


fileheader [ on | detail ] displays the file header:
To view the trail file header:
Logdump 14662 >fileheader detail
Logdump 1> fileheader on Logdump 14663 >pos 0
Reading forward from RBA 0
To view the record header with the data: Logdump 14664 >n
Logdump 2> ghdr on TokenID x46 'F' Record Header Info x00 Length 587
TokenID x30 '0' TrailInfo Info x00 Length 303
TokenID x31 '1' MachineInfo Info x00 Length 103
To add column information: TokenID x32 '2' DatabaseInfo Info x00 Length 88
Logdump 3> detail on TokenID x33 '3' ProducerInfo Info x00 Length 85
TokenID x34 '4' ContinunityInfo Info x00 Length 4
TokenID x5a 'Z' Record Trailer Info x00 Length 587
To add hex and ASCII data values to the column list: 2008/07/18 13:40:26.034.631 FileHeader Len 587 RBA 0
Logdump 4> detail data Name: *FileHeader*
3000 012f 3000 0008 660d 0a71 3100 0006 0001 3200 | 0../0...f..q1.....2.
0008 0000 0016 3300 000c 02f1 7834 eac7 7f3f 3400 | ......3.....x4...?4.
To control how much record data is displayed: 0037 0031 7572 693a 7465 6c6c 7572 6961 6e3a 3a68 | .7.1uri:tellurian::h
6f6d 653a 6d63 6361 7267 6172 3a67 6773 3a67 6773 | ome:mccargar:ggs:ggs
Logdump 5> reclen 280 4f72 6163 6c65 3a73 6f75 7263 6536 0000 1700 112e | Oracle:source6......
2f64 6972 6461 742f 6572 3030 3030 3030 3700 0005 | /dirdat/er0000007...
0138 0000 0800 01e2 4039 0000 0c00 0000 0000 001d | .8......@9..........
GroupID x30 '0' TrailInfo Info x00 Length 303
3000 012f 3000 0008 660d 0a71 3100 0006 0001 3200 | 0../0...f..q1.....2. etc.

Logdump Viewing Trail Records Logdump Viewing Trail Records

To go to the first record, and to move from one record to Record header: contains transaction information.
I/O type Below the header is the data area.
another in sequence:

Operation
Logdump 6 > pos 0
type and
Logdump 7 > next (or just type n) time the
record was
To position at an approximate starting point and locate the written
next good header record:
Source
table
Logdump 8 > pos <approximate RBA>
Logdump 9 > scanforheader (or just type sfh) Image type:
could be a
before or Record Length of record and Record data,
after image Column data, its RBA position in the in ASCII
information in hex trail file

31
Logdump - Counting the Records in the Trail Logdump Counting Records in the Trail
(contd)
Logdump> count
TCUSTMER
Total Data Bytes 10562
LogTrail /ggs/dirdat/rt000000 has 4828 records Avg Bytes/Record 55
Total Data Bytes 334802 Delete 300
Avg Bytes/Record 69 Insert 1578
Delete 900 FieldComp 12
Insert 3902 Before Images 300
FieldComp 26 After Images 1590
Before Images 900
After Images 3928 TCUSTORD
Total Data Bytes 229178
Average of 25 Transactions Avg Bytes/Record 78
Bytes/Trans ..... 22661 Delete 600
Records/Trans ... 193
Insert 2324
Files/Trans ..... 8
Field Comp 14
Before Images 600
After Images 2338

Logdump Filtering on a Filename Logdump Locating a Hex Data Value


Logdump 7 >filter include filename TCUST* Logdump 27 >filter inc hex /68656C20/
Logdump 8 >filter match all Logdump 28 >pos 0
Logdump 9 >n Current position set to RBA
Logdump 29 >n
__________________________________________________________
_______________________________________________________________
_ Hdr-Ind : E (x45) Partition : . (x00)
Hdr-Ind : E (x45) Partition : . (x00) UndoFlag : . (x00) BeforeAfter: B (x42)
UndoFlag : . (x00) BeforeAfter: A (x41) RecLength : 56 (x0038) IO Time : 2002/04/30 16:22:14.205
RecLength : 56 (x0038) IO Time : 2002/04/30 15:56:40.814 IOType : 3 (x03) OrigNode : 108 (x6c)
IOType : 5 (x05) OrigNode : 108 (x6c) TransInd : . (x01) FormatType : F (x46)
TransInd : . (x01) FormatType : F (x46) SyskeyLen : 0 (x00) Incomplete : . (x00)
SyskeyLen : 0 (x00) Incomplete : . (x00) AuditRBA : 109406324
AuditRBA : 105974056
2002/04/30 16:22:14.205 Delete Len 56 Log RBA 64424
2002/04/30 15:56:40.814 Insert Len 56 Log RBA 1230 File: TCUSTMER Partition 0
File: TCUSTMER Partition 0 Before Image:
After Image: 3620 2020 4A61 6D65 7320 2020 2020 4A6F 686E 736F | 6 James Johnso
3220 2020 4A61 6D65 7320 2020 2020 4A6F 686E 736F | 2 James 6E20 2020 2020 2020 2020 2020 2020 4574 6865 6C20 | n Ethel
Johnso 2020 2020 2020 2020 2020 2020 2020 4C41 | LA
6E20 2020 2020 2020 2020 2020 2020 4368 6F75 6472 | n Choudr
616E 7420 2020 2020 2020 2020 2020 4C41 | LA Filtering suppressed 545 records

Filtering suppressed 18 records

Logdump Saving Records to a New Trail Logdump Keeping a Log of Your Session

Logdump> save newtrail 10 records Logdump> log to MySession.txt


When finished
The 10 records are taken forward from the current position in the file.
Logdump> log stop

32
Logdump Commands
Purpose Examples

Working with files CD, LOG, NEXTTRAIL, OPEN, POSITION, SAVE,


WRITELOG

Viewing information COUNT, FILES, ENV, NOTIFY, SHOW, TIME


Workshop:
Selecting data and DUMP, FILTER, NEXT, SCANFORENDTRANSACTION, Using Logdump
records SCANFORHEADER, SCANFORRBA, SCANFORTIME,
SCANFORTYPE, SKIP

Making conversions COMPUTETIMESTAMP, CTIME, DECRYPT, ENCRYPT,


INTERPRETINTERVAL, INTERPRETTIMESTAMP

Controlling the ASCIIDATA|EBCDICDATA, DETAIL, FILEHEADER,


environment GHDR, HEADERTOKEN, RECLEN, TIMEOFFSET,
TRAILFORMAT, USERTOKEN

Miscellaneous EXIT, FC, HELP, HISTORY, OBEY, X

Reverse - Overview

The Reverse utility reorders operations within GoldenGate


trails in reverse sequence:

Extract Trails and Files: Provides selective back out of operations


Reversing the Sequence
Selectively back out corrupt data or accidental delete operations
while keeping the rest of the application alive

Can be used to restore a database to a specific point in time

Use to back out all operations during regression testing to restore


the original test baseline

Reverse - Overall Process Reverse Sample Parameter Files


Extract Parameters (dirprm/ext1.prm)
SPECIALRUN, TRANLOG
Source Transaction Write to a SOURCDB dsn, USERID user, PASSWORD password
Log or single file or a Source BEGIN 2004-05-30 17:00
GoldenGate Trails Capture
series of files Reverse Delivery Database
END 2004-05-30 18:00
GETUPDATEBEFORES
NOCOMPRESSDELETES
input output RMTHOST target, MGRPORT 7809
RMTFILE /ggs/dirdat/input.dat
TABLE HR.SALES;
TABLE HR.ACCOUNTS;
SPECIALRUN TRANLOG
 Operation sequence is reversed
BEGIN
 Inserts become deletes
Replicat Parameters (dirprm/rep1.prm)
END SPECIALRUN
 Deletes become inserts
GETUPDATEBEFORES END RUNTIME
 Update Before Images become After Images
NOCOMPRESSDELETES TARGETDB dsn, USERID user, PASSWORD password
 Begin and end transaction indicators are
Filter criteria (if any)
reversed
EXTFILE /ggs/dirdat/output.dat
EXTFILE or RMTFILE ASSUMETARGETDEFS
 If input is a series of files, reverses file sequence
(Table statements) MAP HR.SALES, TARGET HR.SALES;
MAP HR.ACCOUNTS, TARGET HR.ACCOUNTS;

33
Reverse Overall Process Trails Discussion Points

1. Run Extract from either GoldenGate trails or the 1. What is a trail?


source database transaction logs 2. What formats are Extract trails and files written in?
3. What GoldenGate utility allows you to view trail
$ ggs/> extract paramfile dirprm/ext1.prm contents

2. Run Reverse to produce the reordered output

$ ggs/> reverse dirdat/input.dat dirdat/output.dat

3. Run Replicat to back out operations

$ ggs/> replicat paramfile dirprm/rep1.prm

Parameters - Overview

Editing parameter files

GLOBALS versus process parameters


Oracle GoldenGate
GLOBALS parameters
Parameters
Manager parameters

Extract parameters

Replicat parameters

June 9, 2010

Editing Parameter Files GLOBALS versus Process Parameters

Edit parameter files to configure GoldenGate processes GLOBALS parameters apply to all processes
Set when Manager starts
The GLOBALS parameter file is identified by its file path Reside in <GoldenGate install directory>/GLOBALS
GGSCI> EDIT PARAMS ./GLOBALS
Process parameters apply to a specific process
Manager and utility parameter files are identified by keywords (Manager, Extract, Server Collector, Replicat, Utilities)
GGSCI> EDIT PARAMS MGR
Set when the process starts
GGSCI> EDIT PARAMS DEFGEN
Override GLOBALS settings
Reside by default in the dirprm directory in files named
Extract and Replicat parameter files are identified by the
<processname>.prm
process group name
GGSCI> EDIT PARAMS <group name> Most apply to all tables processed but some can be specified at
the table level

34
GLOBALS Parameters Sample Manager Parameter File
Control things common to all processes in a GoldenGate
instance PORT 7809
DYNAMICPORTLIST 90019100
Can be overridden by parameters at the process level
AUTOSTART ER *
Must be created before any processes are started
AUTORESTART EXTRACT *, WAITMINUTES 2, RETRIES 5
Stored in <GoldenGate install directory>/GLOBALS
LAGREPORTHOURS 1
(GLOBALS is uppercase, no extension)
LAGINFOMINUTES 3
Must exit GGSCI to save
LAGCRITICALMINUTES 5
Once set, rarely changed
PURGEOLDEXTRACTS /ggs/dirdat/rt*, USECHECKPOINTS
Parameters most commonly used
MGRSERVNAME ggsmanager1
Defines a unique Manager service name on Windows systems
CHECKPOINTTABLE dbo.ggschkpt
Defines the table name used for Replicats checkpoint table

Manager Parameters Extract Parameter Overview

Purpose Examples Extract parameters specify:

General COMMENT Group name associates with a checkpoint file

Port PORT, DYNAMICPORTLIST Where to send the data


management Local system
Process Multiple remote systems
management AUTOSTART, AUTORESTART One to many GoldenGate trails

Event LAGREPORT, LAGINFO, LAGCRITICAL


What is being captured
management
Which tables
Database login SOURCEDB, USERID Which rows and columns
Maintenance PURGEOLDEXTRACTS Which operations

Which column mapping to apply

Which data transformations to apply

Extract Parameter Defaults Sample Extract Parameter File


All Extract parameters assume a default value:
EXTRACT ODS
Capture all insert, update and delete operations
USERID GoldenUser, PASSWORD password
Committed data only
Full image for inserts
RMTHOST manhattan, MGRPORT 7809
Only primary key and changed columns for updates RMTTRAIL /ggs/dirdat/rt
Only primary key for deletes TABLE SALES.ORDERS;
Only after-image of update TABLE SALES.INVENTORY;
Send data without transformation
Buffer transactions
Until a block is full or
Until time elapses
Based on average transaction volumes

35
Extract Parameters Extract TABLE Parameter
Purpose Examples TABLE <table spec>
General SETENV, GETENV, OBEY [, TARGET <table spec>]
[, DEF <definitions template>]
Processing method BEGIN, END, PASSTHRU [, TARGETDEF <definitions template>]
[, COLMAP (<column mapping expression>)]
Database login SOURCEDB, USERID
[, {COLS | COLSEXCEPT} (<column specification>)]
Selecting and [, EVENTACTIONS <action>]
mapping data IGNOREINSERTS, GETUPDATEBEFORES, TABLE [, EXITPARAM <parameter string>]
[, FETCHBEFOREFILTER]
Routing data EXTTRAIL, RMTHOST, RMTTRAIL [, {FETCHCOLS | FETCHCOLSEXCEPT} (column specification)]
[, {FETCHMODCOLS | FETCHMODCOLSEXCEPT} (<column spec>)]
Formatting data FORMATASCII, FORMATSQL, FORMATXML, NOHEADERS
[, FILTER (<filter specification>)]
Custom processing CUSEREXIT, INCLUDE, MACRO, SQLEXEC [, KEYCOLS (<column specification>)]
[, SQLEXEC (<SQL specification>)]
Reporting REPORT, REPORTCOUNT, STATOPTIONS [, SQLPREDICATE WHERE <where clause>]
Error handling DISCARDFILE, DDLERROR [, TOKENS (<token specification>)]
[, TRIMSPACES | NOTRIMSPACES]
Tuning ALLOCFILES, CHECKPOINTSECS, DBOPTIONS [, WHERE (<where clause>)]
Maintenance PURGEOLDEXTRACTS, REPORTROLLOVER ;
Note: You must use a semicolon to terminate the TABLE statement.
Security ENCRYPTTRAIL, DECRYPTTRAIL

Extract TRANLOGOPTIONS Parameter Extract TRANLOGOPTIONS Parameter


(contd)
Use the TRANLOGOPTIONS parameter to control Examples: Loop prevention
database-specific aspects of log-based extraction
TRANLOGOPTIONS EXCLUDEUSER ggsrep
Specifies the name of the Replicat database user so that those
Examples: Controlling the archive log transactions are not captured by Extract.

TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT TRANLOGOPTIONS EXCLUDETRANS ggs_repl


log_%t_%s_%r.arc Specifies the transaction name of the Replicat database user so that
Specifies an alternative archive log format. those transactions are not captured by Extract.

TRANLOGOPTIONS ALTARCHIVELOGDEST TRANLOGOPTIONS FILTERTABLE <table_name>


/oradata/archive/log2 Specifies the Replicat checkpoint table name. Operations on the
Specifies an alternative archive log location. checkpoint table will be ignored by the local Extract.

TRANLOGOPTIONS ARCHIVEDLOGONLY
Causes Extract to read from the archived logs exclusively.

Replicat Parameter Overview Replicat Parameter Defaults


Replicat parameters specify: All Replicat parameters assume a default value:

Group name associated with a checkpoint file


Apply all inserts, update, delete operations
List of source to target relationships
Smart transactional grouping
Optional row-level selection criteria
1000 source operations are grouped into a single target
Optional column mapping facilities
transaction
Optional transformation services
Optional stored procedure or SQL query execution
Process abends on any operational failure
Error handling Roll back transaction to last good checkpoint
Optional error handling
Various optional parameter settings Optional mapping to secondary table for exceptions

215 216

36
Sample Replicat Parameter File Replicat Parameters
Purpose Examples
REPLICAT SALESRPT
General SETENV, GETENV, OBEY
USERID ggsuser, PASSWORD ggspass
Processing method BEGIN, END, SPECIALRUN
ASSUMETARGETDEFS
Database login SOURCEDB, USERID
DISCARDFILE /ggs/dirrpt/SALESRPT.dsc, APPEND
Selecting, converting COLMATCH, IGNOREUPDATES, MAP, SOURCEDEFS,
MAP HR.STUDENT, TARGET HR.STUDENT and mapping data ASSUMETARGETDEFS
WHERE (STUDENT_NUMBER < 400000); Routing data EXTFILE, EXTTRAIL
MAP HR.CODES, TARGET HR.CODES; Custom processing CUSEREXIT, DEFERAPPLYINTERVAL, INCLUDE,
MAP SALES.ORDERS, TARGET SALES.ORDERS, MACRO, SQLEXEC
WHERE (STATE = CA AND OFFICE = LA); Reporting REPORT, REPORTCOUNT, STATOPTIONS
Error handling DISCARDFILE, OVERRIDEDUPS, HANDLECOLLISIONS
Tuning ALLOCFILES, BATCHSQL, GROUPTRANSOPS,
DBOPTIONS
Maintenance PURGEOLDEXTRACTS, REPORTROLLOVER
Security DECRYPTTRAIL

217

Replicat MAP Parameter


MAP <table spec>
, TARGET <table spec>
[, DEF <definitions template>]
[, TARGETDEF <definitions template>]
[, COLMAP (<column mapping expression>)]
[, EVENTACTIONS <action>]
[, EXCEPTIONSONLY]
Workshop:
[, EXITPARAM <parameter string>] Using Parameters
[, FILTER (<filter specification>)]
[, HANDLECOLLISIONS | NOHANDLECOLLISIONS]
[, INSERTALLRECORDS]
[, INSERTAPPEND | NOINSERTAPPEND]
[, KEYCOLS (<column specification>)]
[, REPERROR (<error> , <response>)]
[, SQLEXEC (<SQL specification>)]
[, TRIMSPACES | NOTRIMSPACES]
[, WHERE (<where clause>)]
;
Note: You must use a semicolon to terminate the MAP statement.

220

Parameters Discussion Points

1. What are some typical Manager parameters?


2. What are some typical Extract parameters?
3. What are some typical Replicat parameters?
4. Where are GoldenGate parameters documented? Oracle GoldenGate
Data Mapping and Transformation

37
Data Mapping and Transformation - Overview
Data selection and filtering
Column mapping
Functions
Data Mapping and Transformation:
SQLEXEC Data Selection and Filtering
Macros
User tokens
User exits
Sequences (Oracle only, else omitted)

Data Selection - Overview Data Selection WHERE Clause

GoldenGate provides the ability to select or filter out data The WHERE clause is the simplest form of selection
based on a variety of levels and conditions

Parameter / Clause Selects WHERE clause appears on either the MAP or TABLE
parameter and must be surrounded by parenthesis
TABLE or MAP Table
WHERE Row
FILTER Row, Operation, Range WHERE clause cannot:
TABLE COLS | COLSEXCEPT Columns perform arithmetic operations
refer to trail header and user token values

Use the FILTER clause for more complex selections with


built-in functions

Data Selection WHERE Clause Data Selection WHERE Clause Examples

WHERE can perform an evaluation for: Only rows where the state column has a value of CA are
returned.
WHERE (STATE = CA);
Element Description Example
Columns PRODUCT_AMT Only rows where the amount column has a value of NULL.
Note that if amount was not part of the update, the result is
Comparison operators =, <>, >, <, >=, <=
false.
Numeric values -123, 5500.123 WHERE (AMOUNT = @NULL);
Literal strings "AUTO", "Ca"
Field tests Only rows where the amount was part of the operation and it
@NULL,@PRESENT,@ABSENT has value that is not null.
Conjunctive operators AND, OR WHERE (AMOUNT @PRESENT AND AMOUNT <> @NULL);

Only rows where the account identifier is greater than CORP-


ABC.
WHERE (ACCOUNT_ID > CORP-ABC);

38
Selection FILTER Clause Data Selection FILTER Clause

The FILTER clause provides complex evaluations to include or Syntax


exclude data selection
FILTER (<option> [, <option]) ,
FILTER clause appears on either the MAP or TABLE
parameter and must be surrounded by parenthesis [FILTER (<option> [, <option]) ] [, ]

With FILTER you can: Where <option> is one of :


Deploy other GoldenGate built-in functions
Use multiple FILTERs on one statement <column specification>
If any filter fails, the entire filter clause fails <field conversion function>
Include multiple option clauses, for example (on insert/ update) <ON INSERT | UPDATE | DELETE >
Raise a user-defined Error for exception processing <IGNORE INSERT | UPDATE | DELETE>
<RAISEERROR <error number> >

Data Selection FILTER Clause Examples Data Selection RANGE Function


The following example includes rows where the price Divides workload into multiple, randomly distributed groups of data
multiplied by the amount exceeds 10,000: Guarantees the same row will always be processed by the same
process
FILTER ((PRODUCT_PRICE*PRODUCT_AMOUNT)>10000); Determines which group that range falls in by computing a hash
against the primary key or user defined columns
The following example includes rows containing a string
JOE:
Syntax
@RANGE (<my range>, <total ranges>
FILTER (@STRFIND(NAME, "JOE")>0);
[, <column> [, ...]])

Why is the example above not constructed like the one Example
below? The filter below will fail!
TABLE SALES.ACCOUNT, FILTER (@RANGE (1,3));

FILTER(NAME = JOE);

Data Selection RANGE Function Examples Data Selection RANGE Function Examples
For transaction volume beyond the capacity of a single Replicat, the
Two tables, REP and ACCOUNT, related by REP_ID, require three
example below shows three Replicat groups, each processing one- Replicats to handle the transaction volumes
third of the data
By hashing the REP_ID column, related rows will always be processed
Hashing each operation by primary key to a particular Replicat to the same Replicat
guarantees the original sequence of operations RMTTRAIL /ggs/dirdat/aa
TABLE SALES.REP, FILTER (@RANGE (1,3));
Replicat #1 TABLE SALES.ACCOUNT, FILTER (@RANGE (1,3,REP_ID));
MAP SALES.ACCOUNT,
TARGET SALES.ACCOUNT, FILTER (@RANGE (1,3));
RMTTRAIL /ggs/dirdat/bb
TABLE SALES.REP, FILTER (@RANGE (2,3));
Replicat #2
MAP SALES.ACCOUNT, TABLE SALES.ACCOUNT, FILTER (@RANGE (2,3,REP_ID));
TARGET SALES.ACCOUNT, FILTER (@RANGE (2,3));
RMTTRAIL /ggs/dirdat/cc
Replicat #3 TABLE SALES.REP, FILTER (@RANGE (3,3));
MAP SALES.ACCOUNT, TABLE SALES.ACCOUNT, FILTER (@RANGE (3,3,REP_ID));
TARGET SALES.ACCOUNT, FILTER (@RANGE (3,3));

39
Day 2 Summary

Presentations
Data Pumps
Extract Trails and Files <Insert Picture Here> <Insert Picture Here>

Parameters
Data Mapping and Transformation Oracle GoldenGate
Student Labs
Program Day 3

For Oracle employees and authorized partners only. Do not distribute to third parties. For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential 2009 Oracle Corporation Proprietary and Confidential

Program Day 3

Presentations
Data Mapping and Transformation (continued)
Configuration Options <Insert Picture Here>

Managing Oracle GoldenGate


Data Mapping and Transformation:
Student Labs
Column Mapping
Questions and Answers

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

Column Mapping - Overview Column Mapping - Syntax

Oracle GoldenGate provides the capability to map columns Syntax for the COLMAP clause:
from one table to another

Data can be transformed between dissimilar database tables MAP SOURCE.TABLE, TARGET TARGET.TABLE,
Using COLMAP to map target columns from your source columns COLMAP ( [USEDEFAULTS,]
<target field> = <source expression>
Oracle GoldenGate automatically matches source to target
column names with USEDEFAULTS [, <target field> = <source expression>]
[, ...]
Mapping can be applied either when extracting or replicating
data );

40
Column Mapping Example Column Mapping Building History

MAP HR.CONTACT, TARGET HR.PHONE, This example uses special values to build history of operations
data
COLMAP (USEDEFAULTS,
NAME = CUST_NAME, INSERTALLRECORDS
MAP SALES.ACCOUNT, TARGET REPORT.ACCTHISTORY,
PHONE_NUMBER = @STRCAT( (, AREA_CODE, ), COLMAP (USEDEFAULTS,
PH_PREFIX, -, PH_NUMBER ) ); TRAN_TIME =
@GETENV(GGHEADER,COMMITTIMESTAMP),
OP_TYPE = @GETENV(GGHEADER, OPTYPE),
BEFORE_AFTER_IND = @GETENV(GGHEADER,
BEFOREAFTERINDICATOR),
);

Functions - Data Transformation

Oracle GoldenGate provides the capability to


transform columns by using a set of built-in functions

Oracle GoldenGate Transformation functions can be applied either for


Functions Extract or Replicat

If you require more, you also have the ability to call


your own logic through user exits

Functions - Overview Functions Example

Using column conversion functions, you can: MAP SALES.ACCOUNT, TARGET REPORT.ACCOUNT,
COLMAP ( USEDEFAULTS,
Perform string and number conversion TRANSACTION_DATE = @DATE (YYYY-MM-DD,
Extract portions of strings or concatenate columns YY, YEAR,
Compare strings or numbers MM, MONTH,
Perform a variety of date mappings DD, DAY),
Use single or nested IF statements to evaluate numbers, AREA_CODE = @STREXT (PHONE-NO, 1, 3),
strings, and other column values to determine the PHONE_PREFIX = @STREXT (PHONE-NO, 4, 6),
appropriate value and format for target columns PHONE_NUMBER = @STREXT (PHONE-NO, 7, 10) );

Functions are identified with the @ prefix

41
Functions Performing Tests on Column Values Discussion Points: IF Function
Function Description
Syntax:
CASE Allows user to select a value depending on a series of value tests
@IF (<conditional expression>,
<value if expression is non-zero>,
EVAL Allows a user to select a value depending on a series of independent <value if expression is zero>)
tests
Non-zero is considered true, and zero (0) is considered false.
IF Selects one of two values depending on whether a conditional
statement returns TRUE or FALSE
1. What IF clause would you use to set the target column
COLSTAT Returns whether a column value is missing, NULL or invalid AMOUNT_COL to AMT only if AMT is greater than zero, and
otherwise return zero?
COLTEST Tests whether a column value is present, missing, NULL or invalid AMOUNT_COL = @IF (AMT > 0, AMT, 0)

VALONEOF Returns true if a column contains one of a list of values

Discussion Points: IF Function Functions Working with Dates

2. What IF clause would you use to set ORDER_TOTAL to Function Description


PRICE*QUANTITY if both PRICE and QUANTITY are greater
than zero, otherwise return zero? DATE Returns a date from a variety of sources in a variety of output
formats
ORDER_TOTAL = @IF (PRICE > 0 AND QUANTITY > 0,
PRICE * QUANTITY, 0)
DATEDIFF Returns the difference between two dates or times

DATENOW Returns the current date and time

Discussion Points: DATE Function Discussion Points: DATE Function


Syntax 2. What DATE expression would you use to convert a numeric
@DATE (<output format>, column stored as YYYYMMDDHHMISS to a Julian
<input format>, <source column> timestamp?
[, <input format>, <source column>]
julian_ts_col = @DATE ("JTS", "YYYYMMDDHHMISS",
[,...])
numeric_date)

Supported input and output formats are in the notes.

1. What DATE expression would you use to convert year,


month and day columns into a date?
date_col = @DATE ("YYYY-MM-DD", "YY", date1_yy, "MM",
date1_mm, "DD", date1_dd)

42
Functions Working with Strings and Numbers Functions Working with Strings and Numbers
Function Description Function Description
COMPUTE Returns the result of an arithmetic expression STRLTRIM Trims leading spaces in a column

NUMBIN Converts a binary string into a number STRNCAT Concatenates one or more strings up to a specified number of
characters per string
NUMSTR Converts a string into a number
STRNCMP Compares two strings up to a certain number of characters
STRCAT Concatenates two or more strings
STRNUM Converts a number into a string, with justification and zero-fill
STRCMP Compares two strings to determine if they are equal, or if the first is options
less or greater than the second

Trims trailing spaces in a column


STREQ Tests to see if two strings are equal. Returns 1 for equal and 0 if not STRRTRIM
equal
STRSUB Substitutes one string for another within a column
STREXT Extracts selected characters from a string
STRTRIM Trims both leading and trailing spaces in a column
STRFIND Finds the occurrence of a string within a string

STRLEN Returns the length of a string STRUP Changes a string to uppercase

Discussion Points: STRCAT Function Discussion Points: STRCAT Function

Syntax 2. What STRCAT expression would you use to concatenate a


@STRCAT (<string1>, <string2> [, ...]) country code, area code and local phone number into an
international phone number with hyphens between the
The strings can be column names or literal values in quotes. components?
INTL_PHONE = @STRCAT (COUNTRY_CODE, "-",
AREA_CODE, "-", LOCAL_PHONE)
1. What STRCAT expression would you use to concatenate the columns
LASTNAME and FIRSTNAME, separated by a semicolon?

NAME = @STRCAT (LASTNAME, ";, FIRSTNAME)

Discussion Point: STREXT Function Functions - Other


Function Description
Syntax
BINARY Keeps source data in its original binary format in the target when
@STREXT (<column or literal string>, source column is defined as character.
<begin position>, <end position>)
BINTOHEX Converts a binary string to a hexadecimal string.

GETENV Returns information on the GoldenGate environment, trail file header,


1. What STREXT expressions would you use to split a long-distance trail record header, last replicated operation and lag. Can retrieve the
phone number into three columns (area code, prefix, phone no)? commit timestamp in local time or GMT.
GETVAL Extracts parameters from a stored procedure as input to a FILTER or
COLMAP clause.
AREA_CODE = @STREXT (PHONE, 1, 3), HEXTOBIN Converts a hexadecimal string to a binary string.
PREFIX = @STREXT (PHONE, 4, 6), HIGHVAL, Emulate COBOL functions that allow you to set a numeric limit on string
PHONE_NO = @STREXT (PHONE, 7, 10) LOWVAL or binary datatypes.

RANGE Divides workload into multiple groups of data, while ensuring the same
row will always be sent to the same process. Range uses a hash against
primary key or user defined columns.
TOKEN Maps environmental values that are stored in the user token area to the
target column.

43
SQLEXEC - Overview

SQLEXEC advantages:

Extends GoldenGate capabilities by enabling Extract


Data Mapping and Transformation: and Replicat to communicate with the application
SQLEXEC database through SQL queries or run stored
procedures

Extends data integration beyond what can be done


with GoldenGate functions

SQLEXEC Basic Functionality SQLEXEC - DBMS and Data Type Support

Execute a stored procedure or SQL query using the SQLEXEC is available for the following databases:
SQLEXEC clause of the TABLE or MAP parameter Oracle SQL Server
Teradata Sybase
DB2 ODBC
Optionally extract output parameters from the stored
procedure or SQL query as input to a FILTER or The stored procedure interface supports the following data
types for input and output parameters:
COLMAP clause using the @GETVAL function
Oracle DB2 SQL Server / Sybase / Teradata
v12+
Use SQLEXEC at the root level (without CHAR CHAR CHAR
input/output parameters) to call a stored procedure, VARCHAR2 VARCHAR VARCHAR
run a SQL query or issue a database command DATE DATETIME DATE
All Numeric types All Numeric types All Numeric types
LOBS up to 200 bytes BLOB data types

SQLEXEC Using with Lookup Stored SQLEXEC Using with Lookup Stored
Procedure Procedure (contd)
The following stored procedure performs a query to return a The following parameter entry:
description given a code:
Maps data from the ACCOUNT table to the NEWACCT table
CREATE OR REPLACE PROCEDURE LOOKUP When processing any rows from ACCOUNT, Extract
(CODE_PARAM IN VARCHAR2, DESC_PARAM OUT VARCHAR2) performs the LOOKUP stored procedure prior to executing
BEGIN the column map
SELECT DESC_COL INTO DESC_PARAM Maps values returned in desc_param to the newacct_val
FROM LOOKUP_TABLE column using the @GETVAL function
WHERE CODE_COL = CODE_PARAM;
END;
MAP HR.ACCOUNT, TARGET HR.NEWACCT,
SQLEXEC (spname lookup,
params (code_param = account_code)),
COLMAP (USEDEFAULTS, newacct_id = account_id,
newacct_val = @GETVAL(lookup.desc_param));

44
SQLEXEC Using with SQL Query SQLEXEC - Syntax within a TABLE or MAP
Statement
The following example (for Oracle) performs a SQL query When the SQLEXEC parameter is used within a TABLE or MAP
statement, the syntax is:
directly to return the description. @GETVAL is used to
retrieve the return parameter: SQLEXEC (
{ SPNAME <sp name> | QUERY <sql query> }
MAP HR.ACCOUNT, TARGET HR.NEWACCT, [, ID <logical name>]
SQLEXEC (id lookup, { PARAMS <param spec> | NOPARAMS}
[, BEFOREFILTER | AFTERFILTER]
query select desc_param from lookup_table
[, DBOP]
where code_col = :code_param,
[, EXEC <frequency>]
params (code_param = account_code)),
[, ALLPARAMS <option>]
COLMAP (USEDEFAULTS, newacct_id = account_id, [, PARAMBUFSIZE <num bytes>]
newacct_val = @GETVAL(lookup.desc_param)); [, MAXVARCHARLEN <num bytes>]
[, TRACE <option>]
[, ERROR <action>]
)

SQLEXEC - Syntax as a Standalone Statement SQLEXEC Error Handling


When a SQLEXEC parameter is used at the root level, the syntax is:
There are two types of potential errors that must be considered
when implementing SQLEXEC:
SQLEXEC
{call <sp name> () | <sql query> | <database command>} 1. An error is raised by the database (either the query or stored
[EVERY <n> {SECONDS | MINUTES | HOURS | DAYS}] procedure)
[ONEXIT]
2. The procedure map requires a column that is missing from
Examples: the source database operation (likely in an update statement)

SQLEXEC call prc_job_count () When an error is raised by the database:


SQLEXEC select x from dual Error handling allows the error to be ignored or reported
SQLEXEC "call prc_job_count ()" EVERY 30 SECONDS These options are controlled with the ERROR option in the
SQLEXEC call prc_job_count () ONEXIT SQLEXEC clause
SQLEXEC SET TRIGGERS OFF

SQLEXEC Using the GETVAL Function to


Get Result
The GETVAL function supplies a mechanism to:
Extract stored procedure and query output parameters
Subsequently map them or use in a COLMAP or FILTER clause
Workshop:
Syntax Stored Procedures
@GETVAL (<name>.<parameter>)

Example

MAP schema.tab1, TARGET schema.tab2,


SQLEXEC (SPNAME lookup, PARAMS (param1 = srccol)),
COLMAP (USEDEFAULTS, targcol = @GETVAL (lookup.param1));

45
Macros - Overview

Macros enable easier and more efficient building of


parameters

Data Mapping and Transformation: Write once and use many times
Macros
Consolidate multiple statements

Eliminate the need for redundant column specifications

Use macros to invoke other macros

Create macro libraries and share across parameter files

Macros - Creating Macros - Invoking


Macros can be defined in any parameter file or library Reference the macro and parameters anywhere you want the macro
to be invoked
Macro statements include the following
Macro name EXTRACT EXSALES
Optional parameter list MACRO #make_date
Macro body PARAMS (#year, #month, #day)
BEGIN
@DATE(YYYY-MM-DD, CC, @IF(#year < 50, 20, 19),
Syntax YY, #year, MM, #month, DD, #day)
MACRO #<macro name> END;
PARAMS (#<param1>, #<param2>, )
BEGIN MAP SALES.ACCT, TARGET REPORT.ACCOUNT,
<macro body> COLMAP
END; (
TARGETCOL1 = SOURCECOL1,
Order_Date = #make_date(Order_YR,Order_MO,Order_DAY),
The macro and parameter identifier # can be changed to alternative value Ship_Date = #make_date(Ship_YR,Ship_MO,Ship_DAY)
MACROCHAR $ );

Macros - Example Macros Example (contd)


Consolidating Multiple Parameters The macro expands to the following:
Define the macro:
MACRO #option_defaults GETINSERTS
BEGIN GETUPDATES
GETINSERTS GETDELETES
GETUPDATES INSERTDELETES
GETDELETES IGNOREUPDATES
INSERTDELETES MAP SALES.SRCTAB, TARGET SALES.TARGTAB;
END;
Invoke the macro: GETINSERTS
#option_defaults () GETUPDATES
IGNOREUPDATES GETDELETES
MAP SALES.SRCTAB, TARGET SALES.TARGTAB;
INSERTDELETES
#option_defaults ()
MAP SALES.SRCTAB2, TARGET SALES.TARGTAB2; MAP SALES.SRCTAB2, TARGET SALES.TARGTAB2;

46
Macros Libraries Macros Expansion

Macros can be built in a library and referenced into Macro Processor enables tracing of macro expansion with the
CMDTRACE option
your parameter file
Syntax
EXTRACT EXTACCT
CMDTRACE [ ON | OFF | DETAIL ]
INCLUDE /ggs/dirprm/macro.lib
Default is OFF

Macros Listing can be suppressed Example

EXTRACT EXTACCT
NOLIST INCLUDE /ggs/dirprm/macro.lib
include /ggs/dirprm/large.lib CMDTRACE ON
LIST MAP SALES.ACCOUNT, TARGET REPORT.ACCOUNT_HISTORY,
COLMAP (USEDEFAULTS,
#maptranfields () );

User Tokens - Overview


Oracle GoldenGate provides the ability to store environmental
values in the
user token area of the GoldenGate record header.

Data Mapping and Transformation: Set token values through a TABLE TOKENS clause and
@GETENV functions, for example:
User Tokens
TABLE SALES.PRODUCT,
TOKENS (TKN1 =
@GETENV(GGENVIRONMENT",OSUSERNAME"),
TKN2 = @GETENV(GGHEADER",COMMITTIMESTAMP") );

Use token values to populate target columns through a MAP COLMAP


clause and @TOKEN functions, for example:

MAP SALES.PRODUCT, TARGET SALES.PRODUCT_HISTORY,


COLMAP (USEDEFAULTS, OSUSER = @TOKEN(TKN1"),
TRANSTIME = @TOKEN(TKN2") );

User Tokens - Environmental Values Available User Tokens - Setting


to @GETENV
Syntax: @GETENV (<option>, [<return value]) Values are stored in the GoldenGate record header using a TOKENS clause
Example: @GETENV (GGENVIRONMENT, HOSTNAME) and @GETENV functions:
Source Option Returns values for/from
EXTRACT EXTDEMO
General LAG Lag (in unit specified) TABLE SALES.PRODUCT, TOKENS (
LASTERR Last failed operation TKN-OSUSER = @GETENV (GGENVIRONMENT", OSUSERNAME"),
JULIANTIMESTAMP Julian timestamp TKN-DOMAIN = @GETENV (GGENVIRONMENT", DOMAINNAME"),
RECSOUTPUT Number of records written to trail TKN-COMMIT-TS = @GETENV (GGHEADER", COMMITTIMESTAMP"),
TKN-BA-IND = @GETENV (GGHEADER", BEFOREAFTERINDICATOR),
Oracle GGENVIRONMENT Oracle GoldenGate environment TKN-TABLE = @GETENV (GGHEADER", TABLENAME"),
GoldenGate GGFILEHEADER Trail file header TKN-OP-TYPE = @GETENV (GGHEADER", OPTYPE"),
GGHEADER Trail record header TKN-LENGTH = @GETENV (GGHEADER", RECORDLENGTH"),
TKN-DB-VER = @GETENV (DBENVIRONMENT", DBVERSION");
RECORD Trail record location
Database DBENVIRONMENT Database environment
TRANSACTION Source transaction
Operating OSVARIABLE OS environmental variable
System

47
User Tokens - Using User Tokens Viewing in Logdump
logdump 2> usertoken on
Tokens are retrieved through a MAP COLMAP clause and logdump 3> usertoken detail
logdump 4> next
@TOKEN functions:
User tokens:
TKN-HOST : jemhadar
MAP SALES.ORDER, TARGET REPORT.ORDER_HISTORY, TKN-GROUP : EXTORA
COLMAP (USEDEFAULTS, TKN-BA_IND : AFTER
TKN-COMMIT_TS : 2003-03-24 17:08:59.000000
TKN_NUMRECS = @TOKEN ("TKN-NUMRECS");
TKN-POS : 3604496
TKN-RBA : 4058
MAP SALES.CUSTOMER, TARGET REPORT.CUSTOMER_HISTORY, TKN-TABLE : SOURCE.CUSTOMER
COLMAP (USEDEFAULTS, TKN-OPTYPE : INSERT
TKN-LENGTH : 57
TRAN_TIME = @TOKEN ("TKN-COMMIT-TS"),
TKN-TRAN_IND : BEGIN
OP_TYPE = @TOKEN (TKN-OP-TYPE), TKN-LAG_SEC :1
BEFORE_AFTER_IND = @TOKEN (TKN-BA-IND), TKN-LAG_MIN :0
TKN_ROWID = @TOKEN ("TKN-ROWID")); TKN-LAG_MSEC : 1229
TKN-NUMRECS :8
TKN-DBNAME : ORA901
TKN-DB_USER : GGOODRIC
TKN-DB_VER : 9.0.1.0.0
TKN-INAME : ora901
TKN-ROWID : AAABBAAABAAAB0BAAF

User Exits What are they?

Custom logic written in C or C++ by the customer

Invoked at different points in Extract or Replicat


Data Mapping and Transformation: processing (through CUSEREXIT parameter)
User Exits
Allows you to extend or customize the
functionality of data movement and integration
beyond what is supported through mapping,
functions, or SQLEXEC

Can perform an unlimited number of functions

User Exits Applications User Exits High-Level Processing Logic


Perform arithmetic operations or data transformations beyond
those provided with GoldenGate built-in functions Accepts different events and information from
Extract or Replicat
Perform additional table lookups or clean up invalid data
Passes the information to the appropriate
Respond to events in custom ways, for example, by sending
a formatted e-mail message or paging a supervisor based on paragraph/routine for processing
some field value
Returns a response and information to the caller
Accumulate totals and gather statistics

Perform conflict detection, or custom handling of errors or


discards

Determine the net difference in a record before and after an


update (conflict resolution technique)

48
User Exits - Parameters User Exits Implementing
On Windows: create a DLL in C and create a routine to be
EXIT_CALL_TYPE indicates when, during processing, the called from Extract or Replicat
Extract or Replicat process calls the user exit: at start
processing, stop processing, begin transaction, end On UNIX: Create a shared object in C and create a routine to
transaction, process record, process marker, discard record, be called from Extract or Replicat
fatal error or call result
The routine must accept the following parameters:
EXIT_CALL_RESULT provides a response to the routine: EXIT_CALL_TYPE
OK, ignore, stop, abend or skip record EXIT_CALL_RESULT
EXIT_PARAMS
EXIT_PARAMS supplies information to the routine: calling
program path and name, function parameter, more records In the source for the DLL/shared object, include the usrdecs.h
indicator file (in the GoldenGate install directory)

Call the ERCALLBACK function from the shared object to


ERCALLBACK implements a callback routine. Callback retrieve record and application context information
routines retrieve record and GoldenGate context information
and modify the contents of data records

User Exits - Samples User Exits - Calling

You can call a user exit from Extract or Replicat by the CUSEREXIT
Sample user exit files are located in <GoldenGate parameter
installation directory>/ UserExitExamples
Syntax
CUSEREXIT <DLL or shared object name> <routine name>
Each directory contains the .c file as well as makefiles and [, PASSTHRU]
a readme.txt file. [, INCLUDEUPDATEBEFORES]
[, PARAMS "<startup string>]

Examples
CUSEREXIT userexit.dll MyUserExit
CUSEREXIT userexit.dll MyUserExit, INCLUDEUPDATEBEFORES, & PASSTHRU,
PARAMS "init.properties"

Oracle Sequences
Oracle GoldenGate supports the replication of Oracle sequence values

Use the Extract SEQUENCE parameter to extract sequence values from the
transaction log; for example:
SEQUENCE hr.employees_seq;
Data Mapping and Transformation:
Use the Replicat MAP parameter to apply sequence values to the target; for
Oracle Sequences example:
MAP hr.employees_seq, TARGET payroll.employees_seq;

The default Replicat CHECKSEQUENCEVALUE parameter ensures that target


sequence values are:
higher than the source values (if the increment interval is positive) or
lower than the source values (if the increment interval is negative)

Note: Change this default only if you know there will be no gaps in the
sequence updates (e.g. from a trail corruption or process failure) and you want
to improve the performance of GoldenGate

49
Configuration Options - Overview

BATCHSQL
Compression
Oracle GoldenGate Encryption
Configuration Options Bidirectional considerations
Event actions
DDL replication (Oracle, else omitted)

Options: BATCHSQL Overview


Supported for Oracle, DB2 LUW, DB2 on z/OS, Teradata,
SQL Server and Sybase

Batches similar SQL statements into arrays, as opposed to


Configuration Options: individual operations
BATCHSQL Operations containing the same table, operation type (I, U,
D), and column list are grouped into a batch

Each statement type is prepared once, cached, and executed


many times with different variables

Referential integrity is preserved

Can be used with change capture or initial loads

Options: BATCHSQL Results


Options: BATCHSQL Syntax Smaller row changes will show a higher gain in
Implemented with the Replicat BATCHSQL parameter performance than larger row changes.

Syntax At 100 bytes of data per row change, BATCHSQL


BATCHSQL has been known to improve Replicats performance
[BATCHERRORMODE | NOBATCHERRORMODE]
from 400 to 500 percent.
[BATCHESPERQUEUE <n>]
[BATCHTRANSOPS <n>]
[BYTESPERQUEUE <n>] Actual performance benefits will vary depending on
[OPSPERBATCH <n>] the mix of operations.
[OPSPERQUEUE <n>]
[TRACE]
At around 5,000 bytes of data per row change,
BATCHSQL benefits diminish.

50
Options: Compression

Oracle GoldenGate provides optional data


compression when sending data over TCP/IP

Configuration Options: Automatic decompression is performed by Server


Compression Collector on remote system

Compression threshold allows user to set minimum


block size for which to compress

Oracle GoldenGate uses the zlib compression.


More information can be found at www.zlib.net

Options: Compression - Example

Compression is specified on the Extract RMTHOST parameter:

RMTHOST <host> | <ip address>, MGRPORT <port>


[, COMPRESS ]
[, COMPRESSTHRESHOLD <byte size> ] Configuration Options:
COMPRESS specifies that outgoing blocks of captured changes are compressed.
Encryption

COMPRESSTHRESHOLD sets the minimum byte size for which compression will
occur. Default is 1000 bytes.

Example:

RMTHOST newyork, MGRPORT 7809, COMPRESS, COMPRESSTHRESHOLD 750

Options: Encryption Overview Options: Encryption - Overview


Message Encryption
Encrypts the messages sent over TCP/IP Capture Delivery

Uses Blowfish, a symmetric 64-bit block cipher from


CounterPane Internet Security Network
(TCP/IP)
The data is automatically decrypted by Server Collector Server Collector

before saving the data to the trail Target Trail

Message Encryption
(Blowfish)
Trail or Extract File Encryption
GoldenGate uses 256-key byte substitution Trail or Extract File Encryption
Encrypts only the record data in a trail or extract file (Oracle GoldenGate)

The data is decrypted by a downstream data pump or


Replicat Parameters Parameters

Database Password Encryption


Database Password Encryption
Encrypted password can be generated using a default key or
user-defined key

51
Options: Message Encryption Options: Message Encryption (contd)
1. Run the GoldenGate KEYGEN utility to generate random hex keys
C:\GGS> RUN KEYGEN <key length> <number of keys> KEYGEN
Blowfish accepts a variable-length key from 32 to 128 bits

2. Enter key names and values in an ASCII text file named ENCKEYS (upper ENCKEYS ENCKEYS
case, no file extension) in the GoldenGate install directory
Capture Delivery
##Key name Key value
superkey 0x420E61BE7002D63560929CCA17A4E1FB
TCP/IP
secretkey 0x027742185BBF232D7C664A5E1A76B040 Network
Server Collector
3. Copy the ENCKEYS file to the source and target GoldenGate install directory Target Trail

Extract Parameters: Startup command:


4. In the Extract parameter files, use the RMTHOST ENCRYPT and KEYNAME RMTHOST server -p <port>
parameters MGRPORT... -ENCRYPT BLOWFISH
RMTHOST West, MGRPORT 7809, ENCRYPT BLOWFISH, KEYNAME superkey ENCRYPT BLOWFISH, -KEYNAME <keyname>
KEYNAME <keyname>
5. Configure a static Server Collector and start it manually with the -ENCRYPT Message Encryption
and (Blowfish)
-KEYNAME parameters
server -p <port> -ENCRYPT BLOWFISH -KEYNAME <keyname>

Options: Trail or Extract File Encryption Options: Password Encryption Method 1


 GoldenGate uses 256-key byte substitution 1. Generate an encrypted password with a GoldenGate default key code:
 Only the data records are encrypted in the trail
GGSCI> ENCRYPT PASSWORD <password>
 Set Extract ENCRYPTTRAIL and Replicat DECRYPTTRAIL parameters
 Can set ENCRYPTTRAIL before tables you want encrypted and For example:
NOENCRYPTTRAIL before other tables
 Downstream data pumps can also decrypt the trail for transformation and pass GGSCI> ENCRYPT PASSWORD goldenpassword
it on either encrypted or decrypted No key specified, using default key...
Capture Delivery Encrypted password: AACAAAAAAAAAAAOARAQIDGEEXAFAQJ
TCP/IP
Network 2. Paste the encrypted password in the Extract or Replicat PASSWORD
Server Collector
parameter, for example:
Target Trail
Extract Parameters: Replicat
ENCRYPTTRAIL Parameters: SOURCEDB MySource, USERID joe, PASSWORD
<table statements> DECRYPTTRAIL
<map statements>
AACAAAAAAAAAAAOARAQIDGEEXAFAQJ, ENCRYPTKEY DEFAULT
Trail or Extract File
Encryption

Options: Password Encryption Method 2 Options: Password Encryption - Summary


1. Generate an encrypted password with a user-defined key:
ENCKEYS (user-defined key) (user-defined key) ENCKEYS
GGSCI> ENCRYPT PASSWORD <password>, ENCRYPTKEY <keyname>
Capture Delivery

For example:
TCP/IP
Network
GGSCI> ENCRYPT PASSWORD MyPass, ENCRYPTKEY DRKEY Server Collector
Encrypted password: AACAAAAAAAAAAAIAJFGBNEYGTGSBSHVB Target Trail

Extract Parameters: Replicat Parameters:


2. Enter the key name and value in the ENCKEYS file, for example: [ SOURCEDB ] , USERID [ TARGETDB ] , USERID
, PASSWORD <encrypted password> , PASSWORD <encrypted password>
##Key name Key value , ENCRYPTKEY DEFAULT | <keyname> , ENCRYPTKEY DEFAULT |
<keyname>
drkeyAACAAAAAAAAAAAIAJFGBNEYGTGSBSHVB

3. Paste the encrypted password in the Extract or Replicat PASSWORD Password Encryption
parameter, for example:

SOURCEDB MySource, USERID joe, PASSWORD


AACAAAAAAAAAAAIAJFGBNEYGTGSBSHVB, ENCRYPTKEY drkey

52
Workshop: Configuration Options:
Using Encryption Event Actions

Options: Event Actions - Event Records Options: Event Actions - Examples


Examples of actions you might take on detecting an event record
Oracle GoldenGate provides an event marker are:
system that enables the Oracle GoldenGate Stop the process
processes to take a defined action based on an Ignore or discard the current record
event record in the transaction log or trail Log an informational or warning message to the report file,
GoldenGate error log and system event log
The event record is: Generate a report file
Either a record in a data table that satisfies a filter condition Rollover the trail file
for which you want an action to occur Run a shell command for example, to switch an application,
Or a record that you write to a dedicated event table when start batch processes or start end-of-day reporting
you want an action to occur Activate tracing
Only implemented for change replication, not Write a checkpoint before and/or after writing the record to the
trail
initial loads

Options: Event Actions Examples (contd) Options: Event Actions - Implementing


Add an EVENTACTION option to a TABLE or MAP statement
INSERT / UPDATE / DELETE Values() in an event table
INSERT / UPDATE / DELETE Values() in a data table
EVENTACTION can specify one or multiple events

Reports Logs Discards Chkpts Example using a separate event table to manage events:
Reports Logs Discards Chkpts

TABLE source.event_table, EVENTACTION (ROLLOVER);

Whenever a record is written to the event table, the trail file is rolled over.
EVENT EVENT
PROCESSING Example using data values to trigger events:
PROCESSING

MAP source.account, TARGET target.account,


FILTER (account_no = 100), EVENTACTIONS (DISCARD, LOG);

TCP/IP
Any record where account_no = 100 is discarded and a log message
Network written.
Transaction Target Trail
Capture Delivery
Log

53
Options: Event Actions - EVENTACTIONS Options: Event Actions Heartbeat Example
Parameter
TABLE | MAP A heartbeat table is periodically updated with the current time in the
source database:
EVENTACTIONS (
MAP source.heartbeat, TARGET target.heartbeat,
[STOP | ABORT | FORCESTOP]
FILTER ((@DATEDIFF (SS, hb_timestamp, @DATENOW() > 60
[IGNORE [TRANSACTION [INCLUDEVENT]] AND @DATEDIFF (SS, HBTIMESTAMP, @DATENOW() < 120),
EVENTACTIONS (LOG);
[DISCARD]
MAP source.heartbeat, TARGET target.heartbeat,
[LOG [INFO | WARNING]] FILTER (@DATEDIFF (SS, hb_timestamp, @DATENOW() > 120),
[REPORT] EVENTACTIONS (LOG WARNING);

[ROLLOVER]
[SHELL <command>] Info
EVENT Log
[TRACE <trace file> [TRANSACTION] [PURGE | APPEND]]
PROCESSING
[CHECKPOINT [BEFORE | AFTER | BOTH]] Warning
[, ...]
TX1
)
TX2
Heartbeat
Note: You can also use a TABLE parameter in a Replicat to trigger actions without writing
data to target tables TX4 Target Trail
Delivery

Options: Event Actions - Automated Switchover Options: Event Actions - Automated


Example Synchronization Example
Switchover

Application Application Application 2. When Replicat reads the event record, it communicates Application
to the second ETL process to start at the right point and
2. When Replicat reads the event performs checkpoints before and after the record.
1. User writes an event record at the record, it triggers an event action ETL ETL
planned outage point. This is read by run a custom script to switch the 1. When a batch load is starting, the ETL process writes an
Extract through the transaction log. application to the target database. event record. Extract reads the record and performs a
checkpoint before and after the record.
Capture Delivery
Capture Delivery

TCP/IP TCP/IP
Network Network
Source Trans Log Target Source Trans Log Target
Target Trail Target Trail

TCP/IP TCP/IP
Network Trans Log Network Trans Log
Delivery Capture
Delivery Capture
Target Trail 3. The Extract on the target, Target Trail
already configured and running, 3. When the second ETL process is completed, it generates an event record that is read by
starts capturing transactions. Extract on the target. When Replicat on the source receives the event record, it triggers a
custom script to start the application based on the status of the batch process on the source.

Options: Bidirectional - Configuration

Transaction
Log Capture Delivery

Configuration Options: TCP/IP


Network

Bidirectional Considerations Target Trail

Source Target
Target Source

TCP/IP
Network
Delivery
Target Trail
Capture Transaction
Log

54
Options: Bidirectional - Capabilities Options: Bidirectional - Issues
Available for both homogeneous and heterogeneous Loop Detection
configurations
Detect if GoldenGate or the application performed the operation
Distributed processing
Conflict Avoidance, Detection and Resolution
Both sides are live Detect if an update occurred on both the source and target before
the changes were applied by GoldenGate
Oracle GoldenGates low latency reduces the risk of conflicts
Determine business rules on how to handle collisions

Oracle GoldenGate provides loop detection


Sequence numbers and identity data types
Truncate table operations

Options: Bidirectional - Loop Example 1 Options: Bidirectional - Loop Example 2

The following example demonstrates the problem that occurs Or


without loop-detection:
A row is inserted on system A
A row is updated on system A.
The insert is captured and sent to system B

The update operation is captured and sent to system B The row is inserted on system B
The row is updated on system B
The update operation is captured sent to system A The insert is captured and sent to system A
The row is updated on system A
The insert is attempted on system A, but the operation fails
with a conflict on the primary key causing synchronization
Without loop-detection, this loop continues endlessly. services to HALT

Options: Bidirectional - Loop Detection Options: Bidirectional - Loop Detection (contd)

Loop detection technique depends on the source database Oracle


Using EXCLUDEUSER or EXCLUDEUSERID (Oracle 10g and later)
Stop capture with Extract parameter:
SQL Server
TRANLOGOPTIONS EXCLUDEUSER <userid | username>
By default, SQL Server does not log the ggs_repl transactions Use @GETENV ("TRANSACTION", "USERID") or @GETENV ("TRANSACTION",
written by Replicat, so no loops arise. "USERNAME") to retrieve the Oracle userid or username on the Replicat database

DB2 and Ingres Using Trace Table (Oracle 9i and earlier)


Execute Replicat with unique User ID Add a trace table to detect GoldenGate operations with the GGSCI
command:
Stop capture with Extract parameter:
ADD TRACETABLE <owner>.<table name>
TRANLOGOPTIONS EXCLUDEUSER <user id>
The default <table name> is GGS_TRACE
If not using the default table name, add a parameter in both Extract and
Replicat:
TRACETABLE <owner>.<table name>

55
Options: Bidirectional - Loop Detection (contd) Options: Bidirectional - Loop Detection (contd)
Sybase NonStop SQL/MX
Do nothing and allow Replicat to use the default transaction name ggs_repl
Replicat transactions identified by the name of the checkpoint table
Or identify the Replicat transaction name in the Extract parameter: specified with TRANLOGOPTIONS option:
TRANLOGOPTIONS EXCLUDETRANS <trans name>
Or identify the Replicat user name in the Extract parameter:
TRANLOGOPTIONS FILTERTABLE <table>
TRANLOGOPTIONS EXCLUDEUSER <user name> Extract ignores transactions that include this checkpoint table
PURGEDATA operation is not supported

Teradata
You do not need to identify Replicat transactions that are applied to a
Teradata database.

c-tree
Extract automatically identifies Replicat transactions that are applied
to a c-tree database

Options: Bidirectional - Conflict Avoidance and Options: Bidirectional - Conflict Detection by


Detection Filter

Conflicts can be minimized by low latency REPERROR 9999, EXCEPTION


MAP SRCTAB, TARGET TARGTAB,
Conflicts can be avoided at the application level by SQLEXEC (ID CHECK, ON UPDATE, BEFOREFILTER,
assuring that records are always updated on one QUERY SELECT COUNTER FROM TARGTAB
system only WHERE PKCOL = :P1,
PARAMS (P1 = PKCOL)),
GoldenGate can capture both the before and after FILTER (ON UPDATE, BEFORE.COUNTER <>
CHECK.COUNTER,
image of updates so you can compare before
RAISEERROR 9999);
applying updates
INSERTALLRECORDS
You can write compare logic in a filter or user exit
MAP SRCTAB, TARGET TARGET_EXCEPT, EXCEPTIONSONLY,
COLMAP (USEDEFAULTS, ERRTYPE = Conflict Detected);

Options: Bidirectional - Conflict Resolution Options: Bidirectional - Conflict Resolution


Example
Depends on your business rules for example: Initial balance: $500

Trans A: Mr. Smith deposits $75 in LA: balance=$575


Apply the net difference instead of the after
value Trans B: Mrs. Smith withdraws $20 in NY: balance $480

Trans A replicated to NY: balance $575


Map the data to an exception table for manual
resolution
Trans B replicated to LA: balance $480

Accept or ignore the change based on


date/time
Time

At end of day, correct balance should be $500 + $75 - $20 = $555 !

56
Options: Bidirectional - Conflict Resolution by Options: Multi-master Oracle Sequence
Applying Net Differences Numbers
Initial balance: $500
Oracle sequence numbers are used for a variety of purposes,
Trans A: Mr. Smith deposits $75 in LA: end balance $575 such as to maintain a count, determine order of entry, or
generate a primary key value
Trans B: Mrs. Smith withdraws $20 in NY: end balance $480

Trans A replicated to NY: begin/end balance $500 / $575 GoldenGate does not support the replication of sequence
Conflict detected between trans A begin balance (500) and values in a bidirectional configuration
current NY balance (480), so apply net difference:
Trans A end balance (575) Trans A begin balance (500) = +75
In a bidirectional configuration, to ensure that the source and
resulting in NY end balance of $555
target sequence numbers are unique, assign odd and even
Trans B replicated to LA: begin/end balance $500 / $480 values
Conflict detected between trans B begin balance (500) and
current LA balance (575), so apply net difference: In a multidirectional configuration, each system must use a
Trans B end balance (480) Trans B begin balance (500) = -20
resulting in LA end balance of $555
starting value and increment based on the number of systems
Time

Options: Bidirectional - Sybase & SQL Server Options: Bidirectional - Truncate Table
Identity Data Types Operations

Similar issues to Oracle sequences Truncate Table operations cannot be detected for
loops
Set the seed and increment values so each system
is using a different range of identity values Make sure that GETTRUNCATES is ON for only one
direction
Use IGNORETRUNCATES (default) for the other
direction
Change database security so truncates can only be
issued on one system

Options: DDL Replication - Overview

Available for all Oracle versions supported by GoldenGate DML


synchronization

DDL in relation to DML:


Configuration Options: DDL can be active with/without DML synchronization
DDL Replication (Oracle) The same Extract/Replicat should be processing both DML
and DDL to avoid timing issues

DDL operations are recognized differently by Extract and


Replicat:
Source: DDL disabled by default; Extract must be configured
to enable.
Target: DDL enabled by default to maintain data integrity
Replicat must be configured to ignore or filter DDL

57
Options: DDL Replication Oracle GoldenGate Options: DDL Replication - Oracle
Requirements/Restrictions Requirements/Restrictions
Identical source and target data def: ASSUMETARGETDEFS
Schema names using Oracle reserved names are ignored
Data pumps must be configured in PASSTHRU mode
The GETTRUNCATES parameter should not be used with full
WILDCARDRESOLVE must remain set to DYNAMIC (default) DDL support
Data manipulation is not supported Table name cannot be longer than 16 characters plus quotation
Oracle GoldenGate user exits are not supported for DDL activity marks for ALTER TABLE RENAME
Restrictions exist for DDL operations that involve user defined types and LOB ALTER TABLE..MOVE TABLESPACE
data
Supported when tablespace all SMALLFILE or BIGFILE
DDL on objects in TABLE or MAP statements inherit the limitations in allowed
Stop Extract before issuing a MOVE TABLESPACE
characters of those parameters
The recycle bin must be turned off
Restrictions exist for DDL operations that involve stored procedures
ALTER DATABASE and ALTER SYSTEM not captured
Oracle GoldenGate does not support bidirectional replication of DDL allow
DDL changes on one system only
DDL statements > 2MB require special handling

Options: DDL Replication - Characteristics Options: DDL Replication - Oracle


Characteristics
New names must be specified in TABLE/MAP statements
A comment identifies each Extract/Replicat DDL
Extract sends all DDL to each trail when writing to multiple statement:
trails

Supported objects for Oracle /* GOLDENGATE_DDL_REPLICATION */


clusters tables
By default Extract ignores DDL identified with this comment
functions tablespaces
indexes triggers For Oracle, comments in middle of an object
packages types name appear at the end of the name in the target
procedures views
DDL statement
roles materialized views
sequences users
synonyms

Options: DDL Replication - Activating Oracle Options: DDL Replication - Scope


DDL Capture
Install database objects used for the replication of operations: Database objects fall into categories known as scopes :
DDL marker table: GGS_MARKER MAPPED
Stores DDL information Is specified in a TABLE or MAP statement
DDL history table: GGS_DDL_HIST Operations CREATE, ALTER, DROP, RENAME, GRANT*,
Stores object metadata history REVOKE*
Objects TABLE*, INDEX, TRIGGER, SEQUENCE*,
DDL trigger: GGS_DDL_TRIGGER_BEFORE MATERIALIZED VIW*
Activates when there is a DDL operation * Operations are only for objects with asterisk
Writes to the Marker and History table
UNMAPPED
User Role: GGS_GGSUSER_ROLE
Does not have a TABLE or MAP statement
Establishes the role needed for DDL replication
Should be the user that executes Extract OTHER
TABLE or MAP statements do not apply
Specify schema name in GLOBALS: GGSCHEMA <schema_name> DDL operations other than those listed above
Examples are CREATE USER, CREATE ROLE, ALTER
Note: These tables will grow over time, so cleanup should be specified in TABLESPACE
the Manager parameter file.

58
Options: DDL Replication - DDL Parameter Options: DDL Replication - String Substitution
DDL parameter enables DDL support and filters the DDLSUBST parameter substitutes strings in a DDL
operations operation
Valid for Extract and Replicat Multiple statements can be used
DDL [
{INCLUDE | EXCLUDE} DDLSUBST parameter syntax:
[, MAPPED | UNMAPPED | OTHER | ALL] DDLSUBST <search_string> WITH <replace_string>
[, OPTYPE <type>] [INCLUDE <clause> | EXCLUDE <clause>]
[, OBJTYPE <type>]
[, OBJNAME <name>] Where:
[, INSTR <string>] <search_string> is the string in the source DDL statement you
[, INSTRCOMMENTS <comment_string>] want to replace, in single quotes
] <replace_string> is the replacement string, in single quotes
[...] <clause> is an inclusion or exclusion clause using same syntax as
INCLUDE and EXCLUDE from DDL parameter

Options: DDL Replication - Error Handling Options: DDL Replication - DDLOPTIONS for
Oracle
DDLERROR parameter: default and specific error handling DDLOPTIONS parameter configures aspects of DDL
rules to handle full range of anticipated errors
processing other than filtering and string substitution
Extract syntax: DDLOPTIONS
DDLERROR [, MAPDERIVED | NOMAPDERIVED]
[, RESTARTSKIP <num skips>] [, NOCROSSRENAME]
[, REPORT | NOREPORT]
Replicat syntax:
[, ADDTRANDATA]
DDLERROR
[, DEFAULTUSERPASSWORD <password>
{<error> | DEFAULT} {<response>}
[ENCRYPTKEY DEFAULT | ENCRYPTKEY <keyname>]]
[RETRYOP MAXRETRIES <n> [RETRYDELAY <delay>]]
[, GETAPPLOPS | IGNOREAPPLOPS]
{INCLUDE <clause> | EXCLUDE <clause>}
[, GETREPLICATES | IGNOREREPLICATES]
[, IGNOREMISSINGTABLES | ABENDONMISSINGTABLES]
[, REMOVECOMMENTS {BEFORE | AFTER}]
[, RESTARTCOLLISIONS | NORESTARTCOLLISIONS]
[, REPLICATEPASSWORD | NOREPLICATEPASSWORD]
Where <response> can be IGNORE, ABEND, DISCARD

Workshop: Oracle GoldenGate


DDL Replication Managing Oracle GoldenGate

59
Managing GoldenGate - Overview

Command level security


Trail management
Process startup and TCP/IP errors Managing Oracle GoldenGate:
Command Level Security
Reporting and statistics
Monitoring
Troubleshooting

Managing: Command Level Security Overview Managing: Command Level Security - CMDSEC
File
Security rules established in the CMDSEC file Command security entries include:
Entry Examples
COMMAND NAME Such as INFO, ADD, START, STOP.
Controls which users have access to GGSCI May be any GGSCI command name or a wildcard.
commands OBJECT NAME Such as EXTRACT, REPLICAT.
May be any GGSCI command object or a wildcard.
GROUP NAME For a Windows or Unix group.
For example, certain users On Unix operating systems, you can specify:
- A numeric group ID instead of the group name
Allowed to view reports and collect status information - A wildcard to specify all groups
USER NAME For a Windows or Unix user.
Excluded from stop and delete commands On Unix operating systems, you can specify:
- A numeric user ID instead of the user name
- A wildcard to specify all users
ACCESS Granted or prohibited; YES or NO

Managing: Command Level Security - Sample


CMDSEC File
Sample CMDSEC File:

#Command Object Group User Access Allowed?

STATUS
STATUS
REPLICAT
*
ggsgroup
ggsgroup
ggsuser
*
NO
YES
Managing Oracle GoldenGate
START REPLICAT root * YES Trail Management
START REPLICAT * * NO
* EXTRACT 200 * NO
STOP * ggsgroup * NO
STOP * ggsgroup ggsuser YES
* * root root YES
* * * * NO

Can you see the error with the two STOP lines?

60
Managing: Trail Management Overview Managing: Trail Management Allocation of
Space
Trail files are created by Extract
Allocation of space for Oracle GoldenGate trails
Plan the initial allocation of space for the trail files
Manage the ongoing number and size of the files Initially set the number and size of the trail files
Using size and number parameters
based on
Purging old files Transaction log volume
Speed of your system
Maximum anticipated outage

With ADD EXTTRAIL, ADD RMTTRAIL commands


Use MEGABYTES to control the maximum size

Managing: Trail Management Managing: Trail Management


PURGEOLDEXTRACTS Parameter PURGEOLDEXTRACTS Parameter
Manager evaluation process for PURGEOLDEXTRACTS:
Add PURGEOLDEXTRACTS to clean up trail files
Parameter Explanation
In Extract or Replicat parameter file FREQUENCYMINUTES | If set, determines how often Manager purges old files.
FREQUENCYHOURS If not set, defaults to the maintenance frequency set in the Manager
Trail files are purged as soon as the Extract/Replicat finishes processing CHECKMINUTES parameter (default 10).
them
Do not use if more than one process uses the trail files
USECHECKPOINTS Checkpoints are considered unless NOUSECHECKPOINTS is set.
If processing complete, file will be purged unless it falls below
In Manager parameter file MINKEEP rules.
Set MINKEEP<hours, days, files> to define the minimums for keeping
files MINKEEPHOURS | Only one of the MINKEEP options should be set.
Specify USECHECKPOINTS to trigger checking to see if local processes MINKEEPDAYS | If both MINKEEPHOURS and MINKEEPDAYS are set, last setting is
MINKEEPFILES used.
have finished with the trail files If both a MINKEEP<hours or days> and MINKEEPFILES are set,
Specify a frequency to purge old files MINKEEP<hours or days> is used and MINKEEPFILES ignored.
If no MINKEEP rules are set, the default is MINKEEPFILES = 1.

Best Practices: All PURGEOLDEXTRACTS rules in the Manager parameter file

Managing: Trail Management Managing : Trail Management


PURGEOLDEXTRACTS Example GETPURGEOLDEXTRACTS Command

Manager parameter file: GETPURGEOLDEXTRACTS


PURGEOLDEXTRACTS /ggs/dirdat/AA*, USECHECKPOINTS, SEND MANAGER option
MINKEEPHOURS 2 Displays the rules set with PURGEOLDEXTRACTS

For example:
Syntax
Trail files AA000000, AA000001, and AA000002 exist. Replicat
has been down for four hours and has not completed
processing any of the files. SEND MANAGER
{CHILDSTATUS |
The result:
GETPORTINFO [DETAIL] |
The files have not been accessed for 4 hours so MINKEEP
GETPURGEOLDEXTRACTS |
rule allows purging, but checkpoints indicate the files have
not been processed so purge is not allowed. KILL <process name>}

61
Managing: Trail Management
GETPURGEOLDEXTRACTS Report
Example:
GGSCI > SEND MANAGER GETPURGEOLDEXTRACTS

PurgeOldExtracts Rules
Fileset MinHours MaxHours MinFiles MaxFiles UseCP
S:\GGS\DIRDAT\EXTTRAIL\P4\* 0 0 1 0 Y
S:\GGS\DIRDAT\EXTTRAIL\P2\* 0 0 1 0 Y Managing Oracle GoldenGate
S:\GGS\DIRDAT\EXTTRAIL\P1\* 0 0 1 0 Y
S:\GGS\DIRDAT\REPTRAIL\P4\* 0 0 1 0 Y Process Startup and TCP/IP Errors
S:\GGS\DIRDAT\REPTRAIL\P2\* 0 0 1 0 Y
S:\GGS\DIRDAT\REPTRAIL\P1\* 0 0 1 0 Y
OK
Extract Trails
Filename Oldest_Chkpt_Seqno IsTable IsVamTwoPhaseCommit
S:\GGS\8020\DIRDAT\RT 3 0 0
S:\GGS\8020\DIRDAT\REPTRAIL\P1\RT 13 0 0
S:\GGS\8020\DIRDAT\REPTRAIL\P2\RT 13 0 0
S:\GGS\8020\DIRDAT\REPTRAIL\P4\RT 13 0 0
S:\GGS\8020\GGSLOG 735275 1 0
S:\GGS\8020\DIRDAT\EXTTRAIL\P1\ET 14 0 0
S:\GGS\8020\DIRDAT\EXTTRAIL\P2\ET 14 0 0
S:\GGS\8020\DIRDAT\EXTTRAIL\P4\ET 14 0 0

Managing: Process Startup Managing: TCP/IP Errors

AUTOSTART Oracle GoldenGate automatically attempts handling of IP


AUTOSTART ER *
errors
AUTOSTART EXTRACT PROD*
Error handling defaults are stored in tcperrs file located in
Do not specify any batch task groups, such as one-time initial load the GoldenGate installation directory/folder
groups.
You may customize any of these settings to fit your
environment
AUTORESTART
AUTORESTART ER *, RETRIES 5, WAITMINUTES 3,
RESETMINUTES 90
Error handling includes:
Default maximum retries is 2 Error
Response (ABEND or RETRY)
Default wait minutes is 2
Delay (in centiseconds)
Default reset minutes is 20 Maximum Retries

Managing: TCP/IP Errors (contd)


Sample tcperrs file:

# TCP/IP error handling parameters


# Default error response is abend

# Error Response Delay (csecs) Max Retries Managing Oracle GoldenGate


ECONNABORTED RETRY 1000 10 Reporting and Statistics
#ECONNREFUSED ABEND 0 0
ECONNREFUSED RETRY 1000 12
ECONNRESET RETRY 500 10
ENETDOWN RETRY 3000 50
ENETRESET RETRY 1000 10
ENOBUFS RETRY 100 60
ENOTCONN RETRY 100 10
EPIPE RETRY 500 10
ESHUTDOWN RETRY 1000 10
ETIMEDOUT RETRY 1000 10
NODYNPORTS ABEND 0 0

62
Managing: Reporting - Overview Managing: Reporting Set up with Parameters
Generate interim runtime statistics using:
Set up hourly or daily interval reports via parameters
REPORT REPORT
REPORTCOUNT REPORT AT 14:00
REPORTROLLOVER
REPORT ON FRIDAY AT 23:00

Generate reports on demand via commands REPORTCOUNT


SEND [ EXTRACT | REPLICAT ] <group>, REPORT REPORTCOUNT EVERY 1000000 RECORDS
REPORTCOUNT EVERY 30 MINUTES, RATE
View process reports and history of reports REPORTCOUNT EVERY 2 HOURS
VIEW REPORT <group>
VIEW REPORT <group>[n]
VIEW REPORT <filename> REPORTROLLOVER
REPORTROLLOVER AT 01:00

Managing: Reporting SEND and VIEW Managing: Statistics - Overview


REPORT Commands Generate statistics on demand
Report on demand using commands STATS [ EXTRACT | REPLICAT ] {group}
SEND [ EXTRACT | REPLICAT ] {group}, REPORT
View latest statistics
SEND ER *, REPORT STATS <group>, LATEST
SEND DB2INIT, REPORT
Display daily statistics
SEND REPLICAT ACCT*, REPORT STATS <group>, DAILY

VIEW REPORT <group> Other statistics options


VIEW REPORT FINANCE By table
Totals only
Hourly
VIEW REPORT <group>[<n>] Reset statistics
Report rate
VIEW REPORT FINANCE 5
Report fetch statistics (Extract)
Report collisions (Replicat)
VIEW REPORT <filename> STATOPTIONS parameter
(report fetch statistics or collisions, reset statistics on report rollover)
VIEW REPORT /usr/ggs/reportarchives/finance999.rpt

Managing: Statistics STATS Command Managing: Statistics STATS Command


Example
STATS [ EXTRACT | REPLICAT ] {group}
or STATS {group} GGSCI > STATS EXTRACT GGSEXT, LATEST, REPORTFETCH
Sending STATS request to EXTRACT GGSEXT...
Start of Statistics at 2006-06-08 11:45:05.
STATS <group>, <statistic> DDL replication statistics (for all trails):
TOTAL *** Total statistics since extract started ***
DAILY Operations 3.00
HOURLY Mapped operations 3.00
LATEST Unmapped operations 0.00
RESET Default operations 0.00
Excluded operations 0.00
Output to ./dirdat/aa:
STATS <group>, <option> Extracting from JDADD.EMPLOYEES to JDADD.EMPLOYEES:
TABLE {owner.tablename} *** Latest statistics since 2006-06-08 11:36:55 ***
TOTALSONLY Total inserts 176.00
REPORTRATE Total updates 0.00
REPORTFETCH | NOREPORTFETCH (Extract only) Total deletes 40.00
REPORTDETAIL | NOREPORTDETAIL (Replicat only) Total discards 0.00
Total operations 216.00
Extracting from JDADD.DEPARTMENTS to JDADD.DEPARTMENTS:
*** Latest statistics since 2006-06-08 11:36:55 ***
No database operations have been performed.

63
Managing: Statistics STATOPTIONS
Parameter

REPORTDETAIL | NOREPORTDETAIL
Report statistics for collisions (Replicat)

REPORTFETCH | NOREPORTFETCH
Managing Oracle GoldenGate
Monitoring
Report statistics on row fetching (Extract)

RESETREPORTSTATS |
NORESETREPORTSTATS
Resets statistics when a new report file is create by the
REPORTROLLOVER parameter

Managing: Monitoring - Overview Managing: Monitoring Processes


Can set Manager parameters for:
Setting up operator log alerts for processes stopping and starting
DOWNREPORT
DOWNREPORT, DOWNCRITICAL, UPREPORT
Setting up operator log alerts when lag thresholds are exceeded Frequency to report down processes
LAGREPORT, LAGINFO, LAGCRITICAL DOWNREPORTHOURS 1
Setting up email alerts for messaging DOWNREPORTMINUTES 15
Event text in error log generates email notification
DOWNCRITICAL
Setting up email alerts for latency
Include abended processes in DOWNREPORT (default is not to)
Use a lag alert to notify you when a process has exceeded the threshold
UPREPORT
Frequency to report running processes
UPREPORTHOURS 1
UPREPORTMINUTES 10

Managing: Monitoring Lag Managing: Monitoring Lag (contd)

Can set Manager parameters for:


Source
Database LAGREPORT
Frequency to check for lags
Manager Manager LAGREPORTMINUTES <minutes>
Target
Capture Data Pump Delivery Database LAGREPORTHOURS <hours>
LAGINFO
TCP/IP
Network Frequency to report lags to the error log
Server Collector
LAGINFOSECONDS <seconds>
Trans Logs Target Trail
Source Trail
LAGINFOMINUTES <minutes>
Source Commit Timestamp

System Time
Write to Trail

Target Commit Timestamp

LAGINFOHOURS <hours>
System Time
Write to Trail

LAGCRITICAL
Extract lag Set lag threshold to force a warning message to the error log
LAGCRITICALSECONDS <seconds>
Pump lag LAGCRITICALMINUTES <minutes>
LAGCRITICALHOURS <hours>
Replicat lag
end-to-end latency

64
Managing: Monitoring - Setting Email Alerts in
Director
Within Director, you can configure email alerts:
when specific messages appear in the Oracle GoldenGate error log
when a specific lag threshold has been exceeded
Oracle GoldenGate
Troubleshooting
Troubleshooting

Troubleshooting - Resources Troubleshooting Show Status, Events and


Errors
GGSCI commands to view: These commands display basic processing status, events and errors
Processing status
Events SEND <group>, STATUS shows current processing status
Errors
Checkpoints STATS <group> shows statistics about operations processed

INFO ALL shows status and lag for all Manager, Extract, and Replicat
GoldenGate reports and logs
processes on the system
Process reports
Event/Error log
INFO <group>, DETAIL shows process status, datasource,
Discard file checkpoints, lag, working directory, files containing processing
System logs information

Troubleshooting Show Checkpoints Troubleshooting Recovery

Both Extract and Replicat restart after a failure at their last read
INFO <group>, SHOWCH provides detailed checkpoint information
checkpoint
SEND EXTRACT STATUS command reports when Extract is
Extract maintains the following read checkpoints:
recovering
Startup starting position in data source (transaction log or trail)
Checkpoint information is updated during the recovery stage allowing
Recovery position of oldest unprocessed transaction in data you to monitor the progress with the INFO command
source
If an error prevents Replicat from moving forward in the trail, you can
Current position of last record read in data source restart Replicat after the bad transaction:
and one write checkpoint:
Current - current write position in trail START REPLICAT <group>
SKIPTRANSACTION | ATCSN <csn> |AFTERCSN <csn>
Replicat maintains the following read checkpoints:
Startup starting position in trail To determine the CSN to use, view the Replicat report file with the
Current position of last record read in trail VIEW REPORT <group> command or view the trail with the
Logdump utility

65
Troubleshooting - Process Report Troubleshooting - Event Log (ggserr.log)

Each Extract, Replicat, and Manager has its own report file that Oracle GoldenGate Event Log provides:
shows: History of GGSCI commands
Banner with startup time Processes that started and stopped
Parameters in use Errors that occurred
Table and column mapping Informational messages
Database and Environmental information
Runtime messages and errors Shows events leading to an error. For example, you might discover:
Someone stopped a process
The report provides initial clues, such as invalid parameter, A process failed to make a TCP/IP or database connection
data mapping errors, or database error messages. A process could not open a file

View with: View with:


VIEW REPORT <group> in GGSCI Standard text editor or shell command
Director provides single click to next or previous historical reports GGSCI command VIEW GGSEVT
GoldenGate Director

Troubleshooting - Discard File Day 3 Summary

Oracle GoldenGate Discard file:


Presentations
Data Mapping and Transformation (continued)
Contains column-level details for operations that the
Configuration Options <Insert Picture Here>
process could not handle.
Created when Extract or Replicat has a problem with the Managing Oracle GoldenGate
record it is processing, and if the DISCARDFILE <filename>
parameter is used in the Extract or Replicat parameter file. Student Labs
Usually used for Replicat to log operations that could not
be reconstructed or applied. Questions and Answers
Can help you resolve data mapping issues.

For Oracle employees and authorized partners only. Do not distribute to third parties.
2009 Oracle Corporation Proprietary and Confidential

66

You might also like