1. Home
  2. Knowledge Base
  3. GoldenGate
  4. Managing OCI GoldenGate with OCI Command Line Interface (OCI CLI)
  1. Home
  2. Knowledge Base
  3. Oracle Cloud
  4. Managing OCI GoldenGate with OCI Command Line Interface (OCI CLI)

Managing OCI GoldenGate with OCI Command Line Interface (OCI CLI)

One of the tools available to manage and administer OCI GoldenGate is the OCI Command Line Interface (OCI CLI).

The link below provides a list of the available Oracle Cloud Infrastructure GoldenGate CLI commands.

https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.37.0/oci_cli_docs/cmdref/goldengate/trail-sequence-summary/list-trail-sequences.html

This note describes the usage of OCI CLI commands to perform the following tasks:

  • Creation of a GoldenGate Deployment
  • Performing a backup of the GoldenGate Deployment
  • Listing deployment and backup details
  • Monitoring the progress of deployment and backup creation work requests

Creating a GoldenGate Deployment

Create the deployment.var file which will contain the variables provided to the script which creates the GoldenGate deployment.

[opc@hub ~]$ cat deployment.var

export DEPLOYMENT_NAME="TEST_OGG"
export DISPLAY_NAME="Test GoldenGate Deployment"
export LICENSE_MODEL="LICENSE_INCLUDED"
export COMPARTMENT_ID="ocid1.compartment.oc1..aaaaa………"
export SUBNET_ID="ocid1.subnet.oc1.ap-sydney-1.aaaaaaaao4za…….."
export CPU_CORE_COUNT=1
export IS_AUTO_SCALING_ENABLED=FALSE
export ADMIN_USERNAME="oggadmin"
export ADMIN_PASSWORD="Dream……."
export IS_PUBLIC=FALSE

Create the shell script cre_deployment.sh which runs the OCI CLI command oci goldengate deployment create referring to the variables listed in the deployment.var file.

[opc@hub ~]$ cat cre_deployment.sh
source deployment.var

oci goldengate deployment create --deployment-name $DEPLOYMENT_NAME  --display-name $DISPLAY_NAME  --license-model  $LICENCE_MODEL --compartment-id $COMPARTMENT_ID --subnet-id $SUBNET_ID --cpu-core-count $CPU_CORE_COUNT --is-auto-scaling-enabled $IS_AUTO_SCALING_ENABLED --admin-username $ADMIN_USERNAME --admin-password $ADMIN_PASSWORD --is-public $IS_PUBLIC

Execute the cre_deployment.sh script.

[opc@hub ~]$ ./cre_deployment.sh
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycd...",
    "cpu-core-count": 1,
    "defined-tags": {
      "Oracle-Tags": {
        "CreatedBy": "gavin.soorma@health.wa.gov.au",
        "CreatedOn": "2023-12-01T01:54:11.257Z"
      }
    },
    "deployment-backup-id": null,
    "deployment-diagnostic-data": null,
    "deployment-type": "OGG",
    "deployment-url": "https://ow4yx6cxnsgq.deployment.goldengate.ap-sydney-1.oci.oraclecloud.com/",
    "description": null,
    "display-name": "Test GoldenGate Deployment",
    "fqdn": "ow4yx6cxnsgq.deployment.goldengate.ap-sydney-1.oci.oraclecloud.com",
    "freeform-tags": {},
    "id": "ocid1.goldengatedeployment.oc1.ap-sydney-1.ama.....",
    "is-auto-scaling-enabled": false,
    "is-healthy": true,
    "is-latest-version": true,
    "is-public": false,
    "is-storage-utilization-limit-exceeded": false,
    "license-model": "LICENSE_INCLUDED",
    "lifecycle-details": null,
    "lifecycle-state": "CREATING",
    "lifecycle-sub-state": null,
    "nsg-ids": [],
    "ogg-data": {
      "admin-username": "oggadmin",
      "certificate": null,
      "deployment-name": "TEST_OGG",
      "ogg-version": "oggoracle:21.12.0.0.0_231007.0000_862"
    },
    "private-ip-address": null,
    "public-ip-address": null,
    "storage-utilization-in-bytes": 0,
    "subnet-id": "ocid1.subnet.oc1.ap-sydney-1.aaaaaaaao4za....",
    "system-tags": {},
    "time-created": "2023-12-01T01:54:14.102000+00:00",
    "time-updated": "2023-12-01T01:54:14.102000+00:00",
    "time-upgrade-required": null
  },
  "etag": "cc0bd5d490eaf4cea6490ca665b8181d82da0b30c962d0ba5bd927a7ff2c6e8f",
  "opc-work-request-id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapopptoerimj5syrtqglrm4sgjm37c53iz5pxxisyrbla"
}

Monitor the progress of the Deployment create work request by providing the OCI work request ID to the CLI command oci goldengate work-request get .

[opc@hub ~]$  oci goldengate work-request get --work-request-id ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapopptoerimj5syrtqglrm4sgjm37c53iz5pxxisyrbla
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreimwx7vm....",
    "id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapopptoerimj5syrtqglrm4sgjm37c53iz5pxxisyrbla",
    "operation-type": "GOLDENGATE_DEPLOYMENT_CREATE",
    "percent-complete": 0.0,
    "resources": [
      {
        "action-type": "RELATED",
        "entity-type": "goldengatedeployment",
        "entity-uri": "/deployments/ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeetb5tq...",
        "identifier": "ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeetb5tqa3fd7dr34vntuhiymurep..."
      },
      {
        "action-type": "IN_PROGRESS",
        "entity-type": "goldengateconnection",
        "entity-uri": "/connections/%s",
        "identifier": "ocid1.goldengateconnection.oc1.ap-sydney-1.amaaaaaaeetb5tqazkwyxkg6x7viwugr7akq2u6tllojtl3egp2boxjc7kra"
      }
    ],
    "status": "IN_PROGRESS",
    "time-accepted": "2023-12-01T01:54:14.153000+00:00",
    "time-finished": null,
    "time-started": "2023-12-01T01:54:41.064000+00:00"
  }
}

Once the Work Request status changes to SUCCEEDED, we can verify the Deployment either using the OCI CLI command or directly via the OCI console as shown below.

[opc@hub ~]$  oci goldengate work-request get --work-request-id ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapopptoerimj5syrtqglrm4sgjm37c53iz5pxxisyrbla
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreim...",
    "id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapopptoerimj5syrtqglrm4sgjm37c53iz5pxxisyrbla",
    "operation-type": "GOLDENGATE_DEPLOYMENT_CREATE",
    "percent-complete": 100.0,
    "resources": [
      {
        "action-type": "CREATED",
        "entity-type": "goldengatedeployment",
        "entity-uri": "/deployments/ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeet....",
        "identifier": "ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeet..."
      },
      {
        "action-type": "CREATED",
        "entity-type": "goldengateconnection",
        "entity-uri": "/connections/%s",
        "identifier": "ocid1.goldengateconnection.oc1.ap-sydney-1.amaaaaaaeetb5tqazkwyxkg6x7viwugr7akq2u6tllojtl3egp2boxjc7kra"
      }
    ],
    "status": "SUCCEEDED",
    "time-accepted": "2023-12-01T01:54:14.153000+00:00",
    "time-finished": "2023-12-01T01:59:08.024000+00:00",
    "time-started": "2023-12-01T01:54:41.064000+00:00"
  }
}

The OCI CLI command oci goldengate deployment get –deployment-id can be used to get details about the deployment – similar to what we would see via the OCI console.

Performing a backup of the GoldenGate Deployment

Execute the OCI CLI command oci goldengate deployment-backup create to perform the backup of OCI GoldenGate Deployment.

We need to provide the Compartment and Deployment OCIDs as well as the OCI Object Storage bucket and namespace names.

[opc@hub ~]$ oci goldengate deployment-backup create --bucket-name OCI-GG-backup --compartment-id ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyv... --deployment-id ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeetb5tqa3fd7dr34vntuhiymurep7j... --display-name TEST_OGG_BKP --namespace-name sdkdqm75kud3 --object-name TEST_OGG_BKP
{
  "opc-work-request-id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapzqgpj7h67kpcqd72pl5zkbk27kbpayi4uo36lxhszva"
}

Using the Work Request ID obtained from the above OCI CLI command, we can monitor the progress of the Deployment backup job.

Execute the OCI CLI command oci goldengate work-request get and provide the Work Request ID.

[opc@hub ~]$ oci goldengate work-request get --work-request-id ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapzqgpj7h67kpcqd72pl5zkbk27kbpayi4uo36lxhszva
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreimwx7vm4z3g3k3i3payjd....",
    "id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapzqgpj7h67kpcqd72pl5zkbk27kbpayi4uo36lxhszva",
    "operation-type": "GOLDENGATE_DEPLOYMENT_BACKUP_CREATE",
    "percent-complete": 66.0,
    "resources": [
      {
        "action-type": "RELATED",
        "entity-type": "goldengatedeploymentbackup",
        "entity-uri": "/deploymentbackup/ocid1.goldengatedeploymentbackup.oc1.ap-sydney-1.amaaaaaaeetb5tqa67z2hixc7f5bfj6fkhcaemwvmkkzoyh35mbhf6po32bq",
        "identifier": "ocid1.goldengatedeploymentbackup.oc1.ap-sydney-1.amaaaaaaeetb5tqa67z2hixc7f5bfj6fkhcaemwvmkkzoyh35mbhf6po32bq"
      }
    ],
    "status": "IN_PROGRESS",
    "time-accepted": "2023-12-01T04:42:03.933000+00:00",
    "time-finished": null,
    "time-started": "2023-12-01T04:42:14.909000+00:00"
  }
}

After the status of the backup job changes to SUCCEEDED, we can list the details of the backup of the deployment from both the OCI console as well as using the OCI CLI command oci goldengate deployment-backup list.

[opc@hub ~]$ oci goldengate work-request get --work-request-id ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapzqgpj7h67kpcqd72pl5zkbk27kbpayi4uo36lxhszva
{
  "data": {
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreimwx....",
    "id": "ocid1.goldengateworkrequest.oc1.ap-sydney-1.amaaaaaaeetb5tqapzqgpj7h67kpcqd72pl5zkbk27kbpayi4uo36lxhszva",
    "operation-type": "GOLDENGATE_DEPLOYMENT_BACKUP_CREATE",
    "percent-complete": 100.0,
    "resources": [
      {
        "action-type": "CREATED",
        "entity-type": "goldengatedeploymentbackup",
        "entity-uri": "/deploymentbackup/ocid1.goldengatedeploymentbackup.oc1.ap-sydney-1.amaaaaaaeetb5tqa67z2hixc7f5bfj6fkhcaemwvmkkzoyh35mbhf6po32bq",
        "identifier": "ocid1.goldengatedeploymentbackup.oc1.ap-sydney-1.amaaaaaaeetb5tqa67z2hixc7f5bfj6fkhcaemwvmkkzoyh35mbhf6po32bq"
      }
    ],
    "status": "SUCCEEDED",
    "time-accepted": "2023-12-01T04:42:03.933000+00:00",
    "time-finished": "2023-12-01T04:43:00.791000+00:00",
    "time-started": "2023-12-01T04:42:14.909000+00:00"
  }
}
[opc@hub ~]$ oci goldengate deployment-backup list --compartment-id ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreimwx7vm4z3g3k3i3payjd6e....  --deployment-id  ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeetb5tqa3fd7dr34vntuhiymurep7ju4odmw22zjow4yx6.... --sort-by timeCreated
{
  "data": {
    "items": [
      {
        "backup-type": "FULL",
        "bucket-name": "OCI-GG-backup",
        "compartment-id": "ocid1.compartment.oc1..aaaaaaaa5owqpzgycdfjhlyvreimwx7vm4z3g3k3i3payjd6e6...",
        "defined-tags": {
          "Oracle-Tags": {
            "CreatedBy": "gavin.soorma@health.wa.gov.au",
            "CreatedOn": "2023-12-01T04:42:01.533Z"
          }
        },
        "deployment-id": "ocid1.goldengatedeployment.oc1.ap-sydney-1.amaaaaaaeetb5tqa3fd7dr34vntuhiymurep7ju4odmw22zjow4yx6cxnsgq",
        "display-name": "TEST_OGG_BKP",
        "freeform-tags": {},
        "id": "ocid1.goldengatedeploymentbackup.oc1.ap-sydney-1.amaaaaaaeetb5tqa67z2hixc7f5bfj6fkhcaemwvmkkzoyh35mbhf6po32bq",
        "is-automatic": false,
        "lifecycle-details": null,
        "lifecycle-state": "ACTIVE",
        "namespace-name": "sdkdqm75kud3",
        "object-name": "TEST_OGG_BKP",
        "ogg-version": "oggoracle",
        "size-in-bytes": 1435288.0,
        "system-tags": {},
        "time-backup-finished": "2023-12-01T04:42:30+00:00",
        "time-created": "2023-12-01T04:42:03.873000+00:00",
        "time-of-backup": "2023-12-01T04:42:15.433000+00:00",
        "time-updated": "2023-12-01T04:43:00.548000+00:00"
      },
Updated on December 14, 2023

Was this article helpful?

Related Articles

Leave a Comment