Adding custom fields for a replicated record using tokens
In this recipe we will look at how we use GoldenGate tokens to add additional information to an extracted record and map it to the table in the target environment.
Getting ready
For this recipe, we will use the following CUST
table. This table is created in the source and target databases under the SCOTT
schema. In the target database, the table has an additional column to denote the name of the source database from which this change originated.
Source CUST Table |
Target CUST Table |
---|---|
CUST_ID |
CUST_ID |
ACCOUNT_ID |
ACCOUNT_ID |
CUST_NAME |
CUST_NAME |
BALANCE |
BALANCE |
CHANGE_ORIGIN |
How to do it...
Steps to be performed in the source environment are as follows:
Create an Extract process parameter file as follows:
EXTRACT EGGTEST1 USERID GGATE_ADMIN@DBORATEST, PASSWORD GGATE_ADMIN EXTTRAIL /u01/app/ggate/dirdat/st TABLE scott.CUST, TOKENS (TK_ORIGIN = @GETENV("DBENVIRONMENT" , "DBNAME" ));
The Datapump process parameter file should be as follows...