oracle-golden-gate

Is it possible to find source database info from exttrail files


For both homogeneous (oracle to oracle) and heterogeneous (db2 to oracle) GoldenGate replication, is there any way to know the source database name/pdb from the exttrail files being consumed at replication. On my target i.e. replica I want to know the name of the database/pdb from where the exttrail files got generated? Is it possible?


Solution

  • Yes, it is possible, please define a token in the source and attach the name of the source database as a separate field to DML.

    Extract:

    TABLE tab, TOKENS (
      DB-NAME = @GETENV ('DBENVIRONMENT', {'DBNAME'}),
      SERVER-NAME = @GETENV ('DBENVIRONMENT', {'SERVERNAME'})
    );
    

    Replicat:

    MAP tab, TARGET tab,
    COLMAP (
      DB_NAME = @TOKEN('DB-NAME'),
      SERVER_NAME = @TOKEN('SERVER-NAME')
    );