Data Distribution (Broadcast) Topology Data Replication
Copy and use the following cURL script to set up Oracle GoldenGate data replication environment on an pre-installed database and Oracle GoldenGate deployment.
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
# ----------------------------------------------------------------------------------------------------
# --
# -- 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 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 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 .'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"
,"DDL INCLUDE MAPPED"
,"DDLOPTIONS REPORT"
,"REPORTCOUNT EVERY 10 MINUTES, RATE"
,"WARNLONGTRANS 15MINUTES, CHECKINTERVAL 5MINUTES"
,"EXTTRAIL north/ea"
,"TABLE hr.job_history_a;"
,"EXTTRAIL north/eb"
,"TABLE hr.job_history_b;"
,"EXTTRAIL north/ec"
,"TABLE hr.job_history_c;"
]
,"source": "tranlogs"
,"credentials":{"alias":"ggnorth"}
,"registration": {"optimized": false}
,"begin":"now"
,"targets":[{"name":"ea", "path":"north/"}
,{"name":"eb", "path":"north/"}
,{"name":"ec", "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 target system
# --
# ----------------------------------------------------------------------------------------------------
#ea: north -> A
curl -s -k -X POST https://north:9002/services/v2/sources/DPNS_A \
-H 'Content-Type: application/json' \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description": "Region: From: North, To: A"
,"name": "DPNS_A"
,"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'
#eb: north -> B
curl -s -k -X POST https://north:9002/services/v2/sources/DPNS_B \
-H 'Content-Type: application/json' \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description": "Region: From: North, To: B"
,"name": "DPNS_B"
,"source":
{"uri": "trail://north:9002/services/v2/sources?trail=north/eb"
,"details": {"encryption": {"algorithm": "NONE"}}
}
,"target":
{"uri": "wss://south:9103/services/v2/targets?trail=north/db"
,"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 POST https://north:9002/services/v2/sources/DPNS_C \
-H 'Content-Type: application/json' \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"description": "Region: From: North, To: C"
,"name": "DPNS_C"
,"source":
{"uri": "trail://north:9002/services/v2/sources?trail=north/ec"
,"details": {"encryption": {"algorithm": "NONE"}}
}
,"target":
{"uri": "wss://south:9103/services/v2/targets?trail=north/dc"
,"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 \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
curl -s -k -X GET https://north:9002/services/v2/sources/DPNS_A \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
curl -s -k -X GET https://north:9002/services/v2/sources/DPNS_B \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.response'
curl -s -k -X GET https://north:9002/services/v2/sources/DPNS_C \
-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 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.
# --
# -- Connect the GoldenGate Deployment depl_north
# --
CONNECT https://north:9001 DEPLOYMENT depl_north AS ggma PASSWORD GGma_26ai !
ALTER CREDENTIALSTORE ADD USER ggadmin@dbnorth ALIAS ggnorth DOMAIN OracleGoldenGate PASSWORD ggadmin
INFO CREDENTIALSTORE
DBLOGIN USERIDALIAS ggnorth DOMAIN OracleGoldenGate
ADD SCHEMATRANDATA hr
ADD HEARTBEATTABLE
ADD EXTRACT extn INTEGRATED TRANLOG BEGIN NOW
REGISTER EXTRACT extn database
ADD EXTTRAIL north/ea, EXTRACT extn
START EXTRACT extn
ADD DISTPATH dpns_a SOURCE trail://north:9002/services/v2/sources?trail=north/ea TARGET wss://south:9103/services/v2/targets?trail=north/da !
ADD DISTPATH dpns_b SOURCE trail://north:9002/services/v2/sources?trail=north/ea TARGET wss://south:9103/services/v2/targets?trail=north/db !
ADD DISTPATH dpnw_a SOURCE trail://north:9002/services/v2/sources?trail=north/ea TARGET wss://west:9203/services/v2/targets?trail=north/da !
ADD DISTPATH dpnw_b SOURCE trail://north:9002/services/v2/sources?trail=north/ea TARGET wss://west:9203/services/v2/targets?trail=north/db !
START DISTPATH dpns_a
START DISTPATH dpns_b
START DISTPATH dpnw_a
START DISTPATH dpnw_b
DISCONNECT
After creating the OBEY file, create a shell script to run in Admin Client. This script runs triggers the bidirectional replication setup using the .oby file:
#!/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/etc/conf/ogg/
# Run the GoldenGate Obey script
echo "obey add_replication_datadistribution.oby" | adminclient