Cascading Topology Data Replication
Copy and use the following cURL script to set up Oracle GoldenGate data replication environment on a pre-installed database.
Note: The given sample script uses names and values of database server, parameter values, Extract, Replicat, and other processes. You must change these values according to your environment for this script to work.
#!/bin/bash
# Clean up environment
/home/oracle/scripts/misc/cleanup.sh > /dev/null
# ----------------------------------------------------------------------------------------------------
# --
# -- Create USERIDALIAS to connection from GoldenGate to the Databases
# --
# ----------------------------------------------------------------------------------------------------
# Add UserIdAlias GGNORTH to connect to the Database instance DBNORTH
curl -s -k -X POST https://north:9001/services/v2/credentials/OracleGoldenGate/ggnorth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"userid":"ggadmin@dbnorth","password":"ggadmin"}' | jq '.messages'
curl -s -k -X GET https://north:9001/services/v2/credentials/OracleGoldenGate/ggnorth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# Add UserIdAlias GGSOUTH to connect to the Database instance DBSOUTH
curl -s -k -X POST https://south:9101/services/v2/credentials/OracleGoldenGate/ggsouth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"userid":"ggadmin@dbsouth","password":"ggadmin"}' | jq '.messages'
curl -s -k -X GET https://south:9101/services/v2/credentials/OracleGoldenGate/ggsouth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# Add UserIdAlias GGWEST to connect to the Database instance DBSOUTH
curl -s -k -X POST https://west:9201/services/v2/credentials/OracleGoldenGate/ggwest \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"userid":"ggadmin@dbwest","password":"ggadmin"}' | jq '.messages'
curl -s -k -X GET https://west:9201/services/v2/credentials/OracleGoldenGate/ggwest \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add Schematranda
# -- Add Heartbeattable
# -- Add Checkpointtables
# --
# ----------------------------------------------------------------------------------------------------
# Add Supplemental Logging to Database Schema HR (Schematrandata) on source database GGNORTH
curl -s -k -X POST https://north:9001/services/v2/connections/OracleGoldenGate.ggnorth/trandata/schema \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"add","schemaName":"hr"}' | jq '.messages'
curl -s -k -X POST https://north:9001/services/v2/connections/OracleGoldenGate.ggnorth/trandata/schema \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"info", "schemaName":"hr"}' | jq '.response'
# Add Supplemental Logging to Database Schema HR (Schematrandata) on intermediate database GGSOUTH
curl -s -k -X POST https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/trandata/schema \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"add","schemaName":"hr"}' | jq '.messages'
curl -s -k -X POST https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/trandata/schema \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"info", "schemaName":"hr"}' | jq '.response'
# Add Heartbeattable on source database GGNORTH
curl -s -k -X POST https://north:9001/services/v2/connections/OracleGoldenGate.ggnorth/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"frequency":60}' | jq '.messages'
curl -s -k -X GET https://north:9001/services/v2/connections/OracleGoldenGate.ggnorth/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq .'response'
# Add Heartbeattable on target database GGSOUTH
curl -s -k -X POST https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"frequency":60}' | jq '.messages'
curl -s -k -X GET https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# Add Heartbeattable on target database GGWEST
curl -s -k -X POST https://west:9201/services/v2/connections/OracleGoldenGate.ggwest/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"frequency":60}' | jq '.messages'
curl -s -k -X GET https://west:9201/services/v2/connections/OracleGoldenGate.ggwest/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# Add Checkpointtable on intermediate database GGSOUTH
curl -s -k -X POST https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/tables/checkpoint \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"add","name":"ggadmin.ggs_checkpointtable"}' | jq '.messages'
curl -s -k -X POST https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/tables/checkpoint \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"info","name":"ggadmin.ggs_checkpointtable"}' | jq '.messages'
# Add Checkpointtable on target database GGWEST
curl -s -k -X POST https://west:9201/services/v2/connections/OracleGoldenGate.ggwest/tables/checkpoint \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"add","name":"ggadmin.ggs_checkpointtable"}' | jq '.messages'
curl -s -k -X POST https://west:9201/services/v2/connections/OracleGoldenGate.ggwest/tables/checkpoint \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"operation":"info","name":"ggadmin.ggs_checkpointtable"}' | jq '.messages'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add Extracts on source database GGNORTH
# --
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://north:9001/services/v2/extracts/EXTN \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description":"Extract - Region North"
,"config":["EXTRACT extn"
,"USERIDALIAS ggnorth"
,"EXTTRAIL north/ea"
,"DDL INCLUDE MAPPED"
,"DDLOPTIONS REPORT"
,"REPORTCOUNT EVERY 10 MINUTES, RATE"
,"WARNLONGTRANS 15MINUTES, CHECKINTERVAL 5MINUTES"
,"TABLE hr.*;"
]
,"source": "tranlogs"
,"credentials":{"alias":"ggnorth"}
,"registration": {"optimized": false}
,"begin":"now"
,"targets":[{"name":"ea", "path":"north/"}]
,"status":"running"
}' | jq '.messages'
curl -s -k -X GET https://north:9001/services/v2/extracts/EXTN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add DistPath from source to intermediate system
# --
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://north:9002/services/v2/sources/DPNS \
-H 'Content-Type: application/json' \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description": "Region: From: North, To: South"
,"name": "DPNS"
,"source":
{"uri": "trail://north:9002/services/v2/sources?trail=north/ea"
,"details": {"encryption": {"algorithm": "NONE"}}
}
,"target":
{"uri": "wss://south:9103/services/v2/targets?trail=north/da"
,"authenticationMethod": {"certificate": "default"}
,"details":
{"trail": {"sizeMB": 100}
,"encryption": {"algorithm": "NONE"}
,"compression": {"enabled": false}
}
}
,"options":
{"eofDelayCSecs": 10
,"checkpointFrequency": 10
,"critical": false
,"autoRestart": {"retries": 10, "delay": 2}
,"streaming": true
}
,"begin": "now"
,"encryptionProfile": "LocalWallet"
,"status": "running"
}' | jq '.messages'
curl -s -k -X GET https://north:9002/services/v2/sources/DPNS \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
#
# Add Replicat at target Database GGSOUTH
#
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://south:9101/services/v2/replicats/REPN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description":"Replicat - Region South"
,"config":["REPLICAT repn"
,"USERIDALIAS ggsouth DOMAIN OracleGoldenGate"
,"DDL INCLUDE MAPPED"
,"DDLOPTIONS REPORT"
,"DDLERROR DEFAULT, DISCARD"
,"REPORTCOUNT EVERY 10 MINUTES, RATE"
,"REPERROR (DEFAULT, DISCARD)"
,"MAP hr.*, TARGET hr.*;"
]
,"credentials": {"alias": "ggsouth"}
,"mode": {"parallel":true,"type": "nonintegrated"}
,"source": {"name": "da", "path": "north"}
,"checkpoint":{"table": "ggadmin.ggs_checkpointtable"}
,"status": "running"
}' | jq '.messages'
curl -s -k -X GET https://south:9101/services/v2/replicats/REPN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add 2nd Extract EXTS on source database GGSOUTH
# --
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://south:9101/services/v2/extracts/EXTS \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description":"Extract - Region South"
,"config":["EXTRACT exts"
,"USERIDALIAS ggsouth"
,"EXTTRAIL south/ea"
,"DDL INCLUDE MAPPED"
,"DDLOPTIONS INCLUDETAG 00"
,"DDLOPTIONS REPORT"
,"REPORTCOUNT EVERY 10 MINUTES, RATE"
,"WARNLONGTRANS 15MINUTES, CHECKINTERVAL 5MINUTES"
,"TABLE hr.*;"
]
,"source": "tranlogs"
,"credentials":{"alias":"ggsouth"}
,"registration": {"optimized": false}
,"begin":"now"
,"targets":[{"name":"ea", "path":"south/"}]
,"status":"running"
}' | jq '.messages'
curl -s -k -X GET https://south:9101/services/v2/extracts/EXTS \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add 2nd DistPath DPSW from target to target system
# --
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://south:9102/services/v2/sources/DPSW \
-H 'Content-Type: application/json' \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description": "Region: From: South, To: West"
,"name": "DPSW"
,"source":
{"uri": "trail://south:9102/services/v2/sources?trail=south/ea"
,"details": {"encryption": {"algorithm": "NONE"}}
}
,"target":
{"uri": "wss://west:9203/services/v2/targets?trail=south/da"
,"authenticationMethod": {"certificate": "default"}
,"details":
{"trail": {"sizeMB": 100}
,"encryption": {"algorithm": "NONE"}
,"compression": {"enabled": false}
}
}
,"options":
{"eofDelayCSecs": 10
,"checkpointFrequency": 10
,"critical": false
,"autoRestart": {"retries": 10, "delay": 2}
,"streaming": true
}
,"begin": "now"
,"encryptionProfile": "LocalWallet"
,"status": "running"
}' | jq '.messages'
curl -s -k -X GET https://south:9102/services/v2/sources/DPSW \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
# ----------------------------------------------------------------------------------------------------
# --
# -- Add Replicat REPS at target Database GGWEST
# --
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://west:9201/services/v2/replicats/REPS \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description":"Replicat - Region West"
,"config":["REPLICAT reps"
,"USERIDALIAS ggwest DOMAIN OracleGoldenGate"
,"DDL INCLUDE MAPPED"
,"DDLOPTIONS REPORT"
,"DDLERROR DEFAULT, DISCARD"
,"REPORTCOUNT EVERY 10 MINUTES, RATE"
,"REPERROR (DEFAULT, DISCARD)"
,"MAP hr.*, TARGET hr.*;"
]
,"credentials": {"alias": "ggwest"}
,"mode": {"parallel":true,"type": "nonintegrated"}
,"source": {"name": "da", "path": "south"}
,"checkpoint":{"table": "ggadmin.ggs_checkpointtable"}
,"status": "running"
}' | jq '.messages'
curl -s -k -X GET https://west:9201/services/v2/replicats/REPS \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
Copy and use the following OBEY script to set up a cascaded Oracle GoldenGate data replication environment on an pre-installed database.
Note: The given sample script uses names and values of database server, parameter values, Extract, Replicat, and other processes. You must change these values according to your environment for this script to work.
# --
# -- Add Credentials
# --
CONNECT https://north:9001 DEPLOYMENT depl_north AS ggma PASSWORD GGma_26ai !
ALTER CREDENTIALSTORE ADD USER ggadmin@dbnorth ALIAS ggnorth DOMAIN OracleGoldenGate PASSWORD ggadmin
CONNECT https://south:9101 DEPLOYMENT depl_south AS ggma PASSWORD GGma_26ai !
ALTER CREDENTIALSTORE ADD USER ggadmin@dbsouth ALIAS ggsouth DOMAIN OracleGoldenGate PASSWORD ggadmin
CONNECT https://west:9201 DEPLOYMENT depl_west AS ggma PASSWORD GGma_26ai !
ALTER CREDENTIALSTORE ADD USER ggadmin@dbwest ALIAS ggwest DOMAIN OracleGoldenGate PASSWORD ggadmin
INFO CREDENTIALSTORE
# --
# -- Add Schematandata, Checkpointtable, and Heartbeattable
# --
CONNECT https://north:9001 DEPLOYMENT depl_north AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggnorth DOMAIN OracleGoldenGate
ADD SCHEMATRANDATA hr
ADD HEARTBEATTABLE
CONNECT https://south:9101 DEPLOYMENT depl_south AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggsouth DOMAIN OracleGoldenGate
ADD SCHEMATRANDATA hr
ADD CHECKPOINTTABLE ggadmin.ggs_checkpointtable
ADD HEARTBEATTABLE
CONNECT https://west:9201 DEPLOYMENT depl_west AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggwest DOMAIN OracleGoldenGate
ADD CHECKPOINTTABLE ggadmin.ggs_checkpointtable
ADD HEARTBEATTABLE
# --
# -- Add Extract and DistPath at source instance
# --
CONNECT https://north:9001 DEPLOYMENT depl_north AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggnorth DOMAIN OracleGoldenGate
ADD EXTRACT extn INTEGRATED TRANLOG BEGIN NOW
REGISTER EXTRACT extn database
ADD EXTTRAIL north/ea, EXTRACT extn
START EXTRACT extn
ADD DISTPATH dpns SOURCE trail://north:9002/services/v2/sources?trail=north/ea TARGET wss://south:9103/services/v2/targets?trail=north/da !
START DISTPATH dpns
INFO ALL
INFO DISTPATH ALL
# --
# -- Add Replicat, Extract, and DistPath at intermediate instance
# --
CONNECT https://south:9101 DEPLOYMENT depl_south AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggsouth DOMAIN OracleGoldenGate
ADD REPLICAT repn, PARALLEL, EXTTRAIL north/da, CHECKPOINTTABLE ggadmin.ggs_checkpointtable
START REPLICAT repn
ADD EXTRACT exts INTEGRATED TRANLOG BEGIN NOW
REGISTER EXTRACT exts database
ADD EXTTRAIL south/ea, EXTRACT exts
START EXTRACT exts
ADD DISTPATH dpsw SOURCE trail://north:9102/services/v2/sources?trail=south/ea TARGET wss://west:9203/services/v2/targets?trail=south/da !
START DISTPATH dpsw
INFO ALL
INFO DISTPATH ALL
# --
# -- Add Replicat at target instance
# --
CONNECT https://west:9201 DEPLOYMENT depl_west AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggwest DOMAIN OracleGoldenGate
ADD REPLICAT reps, PARALLEL, EXTTRAIL south/da, CHECKPOINTTABLE ggadmin.ggs_checkpointtable
START REPLICAT reps
INFO ALL
INFO DISTPATH ALL
DISCONNECT
After creating the OBEY file, create a shell script to run in Admin Client:
#!/bin/bash
# Clean up environment
/home/oracle/scripts/misc/cleanup.sh > /dev/null
# Copy parameter file (usually edited with EDIT PARAMs)
cp EXTN.prm /u01/app/oracle/deployments/depl_north/conf/ogg
cp REPN.prm /u01/app/oracle/deployments/depl_south/conf/ogg
cp EXTS.prm /u01/app/oracle/deployments/depl_south/conf/ogg
cp REPS.prm /u01/app/oracle/deployments/depl_west/conf/ogg
# Run the GoldenGate Obey script
echo "obey add_replication_cascading.oby" | adminclient