GoldenGate Add Schematrandata (Part 2- Rest API Series)

The WEB UI is quite easy to manually add schematrandata to your replication, but if you want to automate the process the best way is with the REST API.

Below is simple demonstration how to add schematrandata for HR schema, but same is valid for all schema you need to replicat. Note that in this case I wanted to add an additional parameter “ALLCOLS”, for bi-directional.

Note connection to the CDB.

/services/{version}/connections/{connection}/trandata/schema

-bash-4.2$ curl -u oggadmin:"xxxxx" \
> -H 'cache-control: no-cache' \
> -d '{ "operation":"add", "schemaName":"trgpdb.hr", "allColumns": true }' \
> -X POST http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_CDB/trandata/schema | json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1420  100  1353  100    67   1070     53  0:00:01  0:00:01 --:--:--  1071
{
    "$schema": "api:standardResponse",
    "links": [
        {
            "rel": "canonical",
            "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_CDB/trandata/schema",
            "mediaType": "application/json"
        },
        {
            "rel": "self",
            "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_CDB/trandata/schema",
            "mediaType": "application/json"
        }
    ],
    "messages": [
        {
            "$schema": "ogg:message",
            "title": "SCHEMATRANDATA has been added on schema \"hr\".",
            "code": "OGG-01788",
            "severity": "INFO",
            "issued": "2021-10-02T03:22:26Z",
            "type": "http://docs.oracle.com/goldengate/c2130/gg-winux/GMESG/oggus.htm#OGG-01788"
        },
        {
            "$schema": "ogg:message",
            "title": "SCHEMATRANDATA for scheduling columns has been added on schema \"hr\".",
            "code": "OGG-01976",
            "severity": "INFO",
            "issued": "2021-10-02T03:22:26Z",
            "type": "http://docs.oracle.com/goldengate/c2130/gg-winux/GMESG/oggus.htm#OGG-01976"
        },
        {
            "$schema": "ogg:message",
            "title": "SCHEMATRANDATA for all columns has been added on schema \"hr\".",
            "code": "OGG-01977",
            "severity": "INFO",
            "issued": "2021-10-02T03:22:26Z",
            "type": "http://docs.oracle.com/goldengate/c2130/gg-winux/GMESG/oggus.htm#OGG-01977"
        },
        {
            "$schema": "ogg:message",
            "title": "Schema level PREPARECSN set to mode NOWAIT on schema \"hr\"",
            "code": "OGG-10154",
            "severity": "INFO",
            "issued": "2021-10-02T03:22:26Z",
            "type": "http://docs.oracle.com/goldengate/c2130/gg-winux/GMESG/oggus.htm#OGG-10154"
        }
    ]
}

Connection Info:

https://docs.oracle.com/en/middleware/goldengate/core/21.1/oggra/op-services-version-connections-connection-trandata-schema-post.html

Next up, create an extract.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.