Overview of Oracle GoldenGate Tokens

GoldenGateTokens
Oracle

Share Post Now :

HOW TO GET HIGH PAYING JOBS IN AWS CLOUD

Even as a beginner with NO Experience Coding Language

Explore Free course Now

Table of Contents

Loading

This post covers the Oracle GoldenGate Tokens.

Oracle GoldenGate tokens are attributes to store environment variable values, which are available on the header of trail record header. Using Oracle GoldenGate built-in function @token within the parameter files retrieves the token value.

Types of Tokens:

There are two types of tokens. They are:

  1. Pre-defined token
  2. User Tokens

1. Pre-defined Tokens:

Below lists pre-defined Oracle GoldenGate tokens.

TK_HOST Stores the hostname
TK_GROUP Stores the operating system group name
TK_OSUSER Stores the operating system user name
TK_DOMAIN Stores the hostname domain
TK_COMMIT_TS Stores the current commit transaction sequence number
TK_POS Stores the current read position
TK_RBA Stores the relative byte address (RBA)
TK_TABLE Stores the table name
TK_OPTYPE Stores the operation types (INSERT, UPDATE, DELETE or DDL)

The replicat rep2202 parameter file illustrates a basic implementation of the token by associating each row with Oracle GoldenGate environment pre-defined tokens values that can be used by other applications such as auditing.

T1C1>DESC dept

Name                            Null?    Type

———————————- ——– ———

DEPT_NO                          NOT NULL NUMBER

Loc                                       NOT NULL VARCHAR2(128)

 HOST                              VARCHAR2(100)

 GG_GROUP                  VARCHAR2(100)

 OSUSER                         VARCHAR2(100)

 DOMAIN                        VARCHAR2(100)

 BA_IND                          VARCHAR2(100)

 COMMIT_TS                 VARCHAR2(100)

 POS                                   VARCHAR2(100)

 RBA                                   VARCHAR2(100)

 TABLENAME                 VARCHAR2(100)

 OPTYPE                           VARCHAR2(100)

 

REPLICAT rep2202

USERID ***, PASSWORD ***

MAP ggtraining1.dept, TARGET ggtraining2.dept, &

COLMAP (USEDEFAULTS,

Dept_no = dept_no,

Loc     = Loc

        host      = @TOKEN (‘TK_HOST’),

        gg_group  = @TOKEN (‘TK_GROUP’),

        osuser    = @TOKEN (‘TK_OSUSER’),

        domain    = @TOKEN (‘TK_DOMAIN’),

        ba_ind    = @TOKEN (‘TK_BA_IND’),

        commit_ts = @TOKEN (‘TK_COMMIT_TS’),

        pos       = @TOKEN (‘TK_POS’),

        rba       = @TOKEN (‘TK_RBA’),

        tablename = @TOKEN (‘TK_TABLE’),

        optype    = @TOKEN (‘TK_OPTYPE’));

2. User Defined Tokens:

These are defined on the source system and moved to the target system for event handling, providing an extendibility for attributes that are not pre-defined by Oracle GoldenGate. Tokens are a way to capture and store data in the header of the trail file.  Once a token has been defined, captured and stored in the header, it can be retrieved, on the apply side, and used in many ways to customize what information is delivered by Oracle GoldenGate.

Follow the below steps to define the token:

  1. You define the token and the associated data.
  2. The token header in the trail file header permits up to a total of 2,000 bytes (token name, associated data, and length of data)
  3. Use the TOKEN option of the TABLE parameter in Extracts

Token data may be used in the COLMAP clause of a Replicat MAP statement, within an SQLEXEC, a UserExit, or a Macro. To retrieve the token data from the Oracle GoldenGate Trail, use the Column Conversion Function @TOKEN as input to any of the previously mentioned parameters.

Check out this post which covers Overview & Components of Oracle GoldenGate (software for real-time data integration and replication in heterogeneous IT Systems).

In order to define a token in an extract, the definition should follow this basic syntax:

Extract ext2202

Userid ***,password ***

TRANLOGOPTIONS INTEGRATEDPARAMS(MAX_SGA_SIZE 1024)

Exttrail /ogg/dirdat/lt

TABLE ggtraining1.dept, TOKENS( SRC_CSN_TS = @GETENV(‘GGHEADER’,’COMMITTIMESTAMP’));

In the example above, the token will be populated with the timestamp of the last commit on the table it is defined against.  After restarting the extract, the token (SRC_CSN_TS) will be included in the header of the trail file.

Once the trail file is shipped to the target side and read by the replicat, the token is mapped to a column in the target table.

MAP ggtraining1.dept, target ggtraining2.dept,

COLMAP (USEDEFAULTS,

SRC_CSN_TS=@token(’SRC_CSN_TS’)

);

Tokens are simple to create, use, and are a powerful feature for mapping data between environments.

Related/Further Reading:

Next Task For You

Want to move ahead in your career and want to get a higher Earning Job?
Get 7+ Courses for DBAs & Apps DBA in a bundle program and learn from the Industry’s best Experts.

Oracle Bundle Training

Picture of mike

mike

I started my IT career in 2000 as an Oracle DBA/Apps DBA. The first few years were tough (<$100/month), with very little growth. In 2004, I moved to the UK. After working really hard, I landed a job that paid me £2700 per month. In February 2005, I saw a job that was £450 per day, which was nearly 4 times of my then salary.