Mit der REST-API
Mit der OCI GoldenGate-REST-API können Sie mit Ihren Datenreplikations-Deployments kommunizieren. Erfahren Sie, wie Sie die REST-API in verschiedenen Konfigurationen verwenden und Befehle mit curl und Cloud Shell aufrufen.
Verwandte Themen
Verbindung zu einem öffentlichen Deployment herstellen
Um eine Verbindung zu einem OCI GoldenGate-Deployment mit einem öffentlichen Endpunkt in Cloud Shell herzustellen, benötigen Sie nur die Deployment-URL. Die Deployment-URL (Konsolen-URL) finden Sie auf der Detailseite des Deployments.
Verbindung zu einem privaten Deployment herstellen
Wenn das Deployment über einen privaten Endpunkt verfügt, können Sie Cloud Shell mit einem Netzwerk mit Zugriff auf das Deployment über Cloud Shell Networking verbinden oder eine Bastion, Bastion-Session und einen SSH-Tunnel erstellen.
Standardmäßig beschränkt Cloud Shell den Netzwerkzugriff auf interne OCI-Ressourcen in der Hauptregion Ihres Mandanten, es sei denn, Sie haben das von Cloud Shell verwaltete öffentliche Netzwerk aktiviert. Der Administrator muss eine Identitäts-Policy konfigurieren, um das öffentliche Cloud Shell-Netzwerk zu aktivieren. Weitere Informationen finden Sie unter Cloud Shell-Networking.
REST-API-Beispielaufrufe
Optional können Sie Ihren Deployment-Benutzernamen und Ihr Kennwort in einer .netrc-Datei speichern. In den folgenden Beispielen wird davon ausgegangen, dass Sie eine .netrc-Datei verwenden.
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/services/v2/config/healthTraildateien auflisten
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/services/v2/exttrails
Exporte oder Replicats auflisten
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/v2/extractscurl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/v2/replicatsExtract- oder Replicat-Details abrufen
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/v2/extracts/<extract name>curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://<deployment URL>/v2/replicats/<replicat name>Extract erstellen
{
"config":[
"Extract EATP",
"ExtTrail E1",
"UseridAlias BLOGSRCATP",
"Table SRC_OCIGGLL.*;"
],
"source":{"tranlogs":"integrated"},
"credentials":{"alias":"BLOGSRCATP"},
"registration":{"optimized":false},
"begin":"now",
"targets":[{"name":"E1"}]
}
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>/services/v2/extracts/<Extract name> -d @<JSON file>.jsonReplicat erstellen
{
"config":[
"REPLICAT RADW",
"UseridAlias BLOGTRGADW",
"MAP SRC_OCIGGLL.*, TARGET SRCMIRROR_OCIGGLL.*;"
],
"source":{"name": "E1"},
"credentials":{"alias":"BLOGTRGADW"},
"checkpoint":{"table":"SRCMIRROR_OCIGGLL.CHECKTABLE"},
"mode":{
"type":"nonintegrated",
"parallel": false
},
"registration":"none",
"begin":"now",
"status":"stopped"
}
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>/services/v2/replicats/<Replicat name> -d @<JSON file>.jsonExtract oder Replikat starten
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>/services/v2/commands/execute -d '{ "name":"start", "processName":"<Extract or Replicat name>"}'
Status und Statistiken für einen bestimmten Extract abrufen
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>:<port>/services/v2/extracts/<extract name>/command -d '{"command":"STATUS"}'curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>:<port>/services/v2/extracts/<extract name>/command -d '{"command":"STATUS"}'Status und Statistiken für ein bestimmtes Replicat abrufen
curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>:<port>/services/v2/replicats/<replicat name>/command -d '{"command":"STATUS"}'curl -n -H "Content-Type: application/json" -H "Accept: application/json" -X POST https://<deployment URL>:<port>/services/v2/replicats/<replicat name>/command -d '{"command":"STATS"}'