Delete the Replication Environment
Copy and use the following cURL script to delete the data replication environment after you have tested it and do not need it.
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.
# ----------------------------------------------------------------------------------------------------
# Stop and Delete Replicat
#
# ----------------------------------------------------------------------------------------------------
curl -s -k -X PATCH https://south:9101/services/v2/replicats/REPN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"status":"stopped"}' | jq '.messages'
curl -s -k -X DELETE https://south:9101/services/v2/replicats/REPN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
# ----------------------------------------------------------------------------------------------------
#
# Stop and Delete DistPath
#
# ----------------------------------------------------------------------------------------------------
curl -s -k -X PATCH https://north:9002/services/v2/sources/DPNS \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"status":"stopped"}' | jq '.messages'
curl -s -k -X DELETE https://north:9002/services/v2/sources/DPNS \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
# ----------------------------------------------------------------------------------------------------
#
# Stop and Delete Extracts
#
# ----------------------------------------------------------------------------------------------------
curl -s -k -X PATCH https://north:9001/services/v2/extracts/EXTN \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"status":"stopped"}' | jq '.messages'
curl -s -k -X DELETE https://north:9001/services/v2/extracts/EXTN \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
# ----------------------------------------------------------------------------------------------------
# Delete Schematranda
# Delete Checkpointtable
# Delete Heartbeattables
# ----------------------------------------------------------------------------------------------------
# Delete SchemaTrandata at 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":"delete","schemaName":"hr"}' | jq '.messages'
# Delete Checkpointtable at 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":"delete","name":"ggadmin.ggs_checkpointtable"}' | jq '.messages' ###
# Delete Heartbeattable at Database GGNORTH
curl -s -k -X DELETE 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'
# Delete Heartbeattable at Database GGSOUTH
curl -s -k -X DELETE https://south:9101/services/v2/connections/OracleGoldenGate.ggsouth/tables/heartbeat \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
# ----------------------------------------------------------------------------------------------------
# Delete USERIDALIAS from GoldenGate
# ----------------------------------------------------------------------------------------------------
curl -s -k -X DELETE https://north:9001/services/v2/credentials/OracleGoldenGate/ggnorth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
curl -s -k -X DELETE https://south:9101/services/v2/credentials/OracleGoldenGate/ggsouth \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' | jq '.messages'
# --------------------------------------------------------------------------------------------------
#
# Delete Trail Files
#
# ----------------------------------------------------------------------------------------------------
curl -s -k -X POST https://north:9001/services/v2/commands/execute \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"name": "purge"
,"purgeType": "trails"
,"trails": [{"name": "ea","path": "north/"}]
,"useCheckpoints": false
,"keep": [{"type": "min","units": "files","value": 0}]
}' | jq '.messages'
curl -s -k -X POST https://north:9001/services/v2/commands/execute \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Basic Z2dtYTpHR21hXzIzYWk=' \
-d '{"name": "purge"
,"purgeType": "trails"
,"trails": [{"name": "da","path": "north/"}]
,"useCheckpoints": false
,"keep": [{"type": "min","units": "files","value": 0}]
}' | jq '.messages'
Copy and use the following OBEY script by adjusting the values for each of the options with the options in your enviornment, to delete the data replication environment.
# Connect the GoldenGate Deployment depl_south
CONNECT https://south:9101 DEPLOYMENT depl_south AS ggma PASSWORD GGma_26ai !
DBLOGIN USERIDALIAS ggsouth DOMAIN OracleGoldenGate
KILL REPLICAT repn
DELETE REPLICAT repn
DELETE CHECKPOINTTABLE ggadmin.ggs_checkpointtable !
DELETE HEARTBEATTABLE !
ALTER CREDENTIALSTORE DELETE USER ggadmin@dbsouth ALIAS ggsouth DOMAIN OracleGoldenGate
INFO CREDENTIALSTORE
PURGE EXTTRAIL north/da
# Connect the GoldenGate Deployment depl_north
CONNECT https://north:9001 DEPLOYMENT depl_north AS ggma PASSWORD GGma_26ai !
STOP DISTPATH dpns
DELETE DISTPATH dpns
DBLOGIN USERIDALIAS ggnorth DOMAIN OracleGoldenGate
KILL EXTRACT extn
DELETE EXTRACT extn
INFO ALL
INFO DISTPATH ALL
ALTER CREDENTIALSTORE DELETE USER ggadmin@dbnorth ALIAS ggnorth DOMAIN OracleGoldenGate
INFO CREDENTIALSTORE
PURGE EXTTRAIL north/ea
DISCONNECT
After you create the preceding .oby file, create a shell script to run in Admin Client that would run the .oby commands:
rm -f /u01/app/oracle/deployments/depl_north/etc/conf/ogg/EXTN.prm
rm -f /u01/app/oracle/deployments/depl_south/etc/conf/ogg/REPN.prm
echo "obey delete_replication_reporting.oby" | adminclient