In previous post I showed how to perform remote clone with Resource Manager/Terraform/Ansible. What if you just want a quick remote clone to be done manually?
Remember OCI Console doesn’t support Remote Cloning at the moment (February 2022) but you can do the remote clone through API’s as well. So let’s do it with OCI CLI!
Command to clone is very simple as you can see below:
simo@cloudshell:~ (us-ashburn-1)$ oci db pluggable-database remote-cloneUsage: oci db pluggable-database remote-clone [OPTIONS]
Error: Missing option(s) --target-container-database-id, --source-container-db-admin-password, --cloned-pdb-name, --pluggable-database-id.
Only options I need to define are target-container-database-id, source-container-db-admin-password, cloned-pdb-name and pluggable-database-id (source), right? WRONG!
I ran above command but it kept saying that I’m missing few parameters. Looking CLI documentation I need to define following parameters:
--cloned-pdb-name
--pdb-admin-password
--pluggable-database-id
--source-container-db-admin-password
--target-container-database-id
--target-tde-wallet-password
After defining them and running CLI I see the job has been created:
simo@cloudshell:~ (us-ashburn-1)$ oci db pluggable-database remote-clone --target-container-database-id ocid1.database.oc1.iad.12345 --source-container-db-admin-password Password123 --cloned-pdb-name MY_pdb1 --pluggable-database-id ocid1.pluggabledatabase.oc1.iad.12345 --pdb-admin-password Password123 --target-tde-wallet-password Password123
{
"data": {
"compartment-id": "ocid1.compartment.oc1..12345",
"connection-strings": null,
"container-database-id": "ocid1.database.oc1.iad.12345",
"defined-tags": {},
"freeform-tags": {},
"id": "ocid1.pluggabledatabase.oc1.iad.12345",
"is-restricted": null,
"lifecycle-details": null,
"lifecycle-state": "PROVISIONING",
"open-mode": "READ_WRITE",
"pdb-name": "MY_pdb1",
"time-created": "2022-02-23T17:42:59.089000+00:00"
},
"etag": "806984a2",
"opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.iad.12345"
}
After a short wait – I can see my new PDB being available in the destination CDB. You can use CLI to monitor the status, OCI Console didn’t really show the work request status properly.
s_vilmunen@cloudshell:~ (us-ashburn-1)$ oci work-requests work-request get --work-request-id ocid1.coreservicesworkrequest.oc1.iad.12345
{
"data": {
"compartment-id": "ocid1.compartment.oc1..12345",
"id": "ocid1.coreservicesworkrequest.oc1.iad.12345",
"operation-type": "Remote Clone Pluggable Database",
"percent-complete": 100.0,
"resources": [
{
"action-type": "CREATED",
"entity-type": "pluggableDatabase",
"entity-uri": "/20160918/pluggableDatabases/ocid1.pluggabledatabase.oc1.iad.12345",
"identifier": "ocid1.pluggabledatabase.oc1.iad.12345"
}
],
"status": "SUCCEEDED",
"time-accepted": "2022-02-23T17:42:59.166000+00:00",
"time-finished": "2022-02-23T17:57:15.400000+00:00",
"time-started": null
}
}
Easy way to use CLI to clone your PDB – just the CLI required parameters should be fixed!