User tokens
User tokens are GoldenGate environment variables that are captured and stored in the trail record for replication. They can be accessed via the @GETENV
function, which we discussed in the Using and defining macros section. We can use token data in column maps, stored procedures called by SQLEXEC
, and, of course, in macros.
Using user tokens to populate a heartbeat table
A vast array of user tokens exist in GoldenGate. Let's start by looking at a common method of replicating system information to populate a heartbeat table that can be used to monitor performance. We can use the TOKENS
option of the Extract TABLE
parameter to define a user token and associate it with the GoldenGate environment data.
The following Extract configuration code shows the token declarations for the heartbeat table:
TABLE GGADMIN.GG_HB_OUT, & TOKENS ( EXTGROUP = @GETENV ("GGENVIRONMENT","GROUPNAME"), & EXTTIME = @DATE ("YYYY-MM-DD HH:MI:SS.FFFFFF","JTS",@GETENV ("JULIANTIMESTAMP")), & EXTLAG ...