
Autonomous Data Guard – First steps
Recently we have announced a new member in the Autonomous family: Autonomous Data Guard. Yes it is really autonomous! All is automatic and it is very easy to use. Here are the first steps on how to use it.
The GUI way
Create your ADB-S Database. You can do this by clicking the “Create autonomous Database” button.

Fill in some basic information

Make sure you select a 19c database

And of course you will need a good password.

For Demo purposes (I will destroy it afterwards anyhow) I took network settings to be available from everywhere, but if you want to deploy it for production use, please use your own VCN and make sure it is not publicly available on the world wide web.

When the creation has finished, we need to enable the Autonomous Data Guard. By default it is disabled.

It is as easy as clicking the button

You agree that the magic will incur some service costs. Which of course is normal as we are using more resources.
During the creation of the peer database it tells you it is busy doing so

So you see here that no hard work is to be done. Just click the link and the system does everything for you. Whilst it is doing so, it is a good moment to have a look at the documentation here: https://docs.cloud.oracle.com/en-us/iaas/adbdataguard/autonomous-data-guard-enable.html
And after a while we have setup our Autonomous Data Guard in a serverless ADB instance!

Maybe it goes without saying, but if you want to terminate the instance, the bystander database is also cleaned up

Using the tooling
This is even simpler.
From my earlier post about OCI tooling to setup Data Guard, you might remember that I store my longer-to-type commands in environment variables, so I keep doing so for this.
To Create an autonomous database the command is pretty simple:
1 |
oci db autonomous-database create --compartment-id ${COMPARTMENT_ID} --db-name pvanpuymcli19c --cpu-core-count 1 --data-storage-size-in-tbs 1 --admin-password ${PASSWORD} --db-version 19c |
Don’t forget to make sure to specify a 19c version. At the date of publication, the default is still 18c and Autonomous Data Guard is not available there. It gives you back a Json with all the info:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
mbp-pvanpuym:~ pietervanpuymbroeck$ oci db autonomous-database create --compartment-id ${COMPARTMENT_ID} --db-name pvanpuymcli19c --cpu-core-count 1 --data-storage-size-in-tbs 1 --admin-password ${PASSWORD} --db-version 19c { "data": { "autonomous-container-database-id": null, "available-upgrade-versions": null, "compartment-id": "ocid1.compartment.oc1..aaa***ulq", "connection-strings": { "all-connection-strings": null, "dedicated": null, "high": null, "low": null, "medium": null }, "connection-urls": { "apex-url": null, "machine-learning-user-management-url": null, "sql-dev-web-url": null }, "cpu-core-count": 1, "data-safe-status": "NOT_REGISTERED", "data-storage-size-in-tbs": 1, "db-name": "pvanpuymcli19c", "db-version": "19c", "db-workload": "OLTP", "defined-tags": {}, "display-name": "autonomousdatabase20200716145953", "failed-data-recovery-in-seconds": null, "freeform-tags": {}, "id": "ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abth***sq", "infrastructure-type": null, "is-auto-scaling-enabled": false, "is-data-guard-enabled": false, "is-dedicated": false, "is-free-tier": false, "is-preview": false, "license-model": "BRING_YOUR_OWN_LICENSE", "lifecycle-details": null, "lifecycle-state": "PROVISIONING", "nsg-ids": null, "private-endpoint": null, "private-endpoint-ip": null, "private-endpoint-label": null, "service-console-url": null, "standby-db": null, "subnet-id": null, "system-tags": {}, "time-created": "2020-07-16T14:59:53.410000+00:00", "time-deletion-of-free-autonomous-database": null, "time-maintenance-begin": null, "time-maintenance-end": null, "time-of-last-failover": null, "time-of-last-switchover": null, "time-reclamation-of-free-autonomous-database": null, "used-data-storage-size-in-tbs": null, "whitelisted-ips": null }, "etag": "9d4539bd", "opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abt***ec6q" } mbp-pvanpuym:~ pietervanpuymbroeck$ |
And of course this good friend is also quickly created

But we can check it with OCI too:
1 2 3 4 |
mbp-pvanpuym:~ pietervanpuymbroeck$ oci db autonomous-database list --db-version 19c --compartment-id ${COMPARTMENT_ID}| jq '.data[]'| jq -c '[."db-name", .id, ."lifecycle-state"]' ["pvanpuym","ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abt****6zipq","TERMINATED"] ["pvanpuymcli19c","ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abt***bpsq","AVAILABLE"] mbp-pvanpuym:~ pietervanpuymbroeck$ |
I have then stored the OCID from the new pvanpuymcli database in my ADBID variable and to enable it for Autonomous Data Guard you just issue following command
1 |
oci db autonomous-database update --autonomous-database-id ${ADBID} --is-data-guard-enabled true |
Then it returns a lot of Json again to inform you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
mbp-pvanpuym:~ pietervanpuymbroeck$ oci db autonomous-database update --autonomous-database-id ${ADBID} --is-data-guard-enabled true { "data": { "autonomous-container-database-id": null, "available-upgrade-versions": [], "compartment-id": "ocid1.compartment.oc1..aa***lq", "connection-strings": { ... Output omitted ... "cpu-core-count": 1, "data-safe-status": "NOT_REGISTERED", "data-storage-size-in-tbs": 1, "db-name": "pvanpuymcli19c", "db-version": "19c", "db-workload": "OLTP", "defined-tags": {}, "display-name": "autonomousdatabase20200716145953", "failed-data-recovery-in-seconds": null, "freeform-tags": {}, "id": "ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abth***sq", "infrastructure-type": null, "is-auto-scaling-enabled": false, "is-data-guard-enabled": false, "is-dedicated": false, "is-free-tier": false, "is-preview": false, "license-model": "BRING_YOUR_OWN_LICENSE", "lifecycle-details": null, "lifecycle-state": "UPDATING", "nsg-ids": null, "private-endpoint": null, "private-endpoint-ip": null, "private-endpoint-label": null, "service-console-url": "https://adb.eu-frankfurt-1.oraclecloud.com/console/index.html?tenant_name=OCID1.TENANCY.OC1..AAAA***JO2EA&database_name=PVANPUYMCLI19C&service_type=ATP", "standby-db": { "lag-time-in-seconds": null, "lifecycle-details": null, "lifecycle-state": "PROVISIONING" }, "subnet-id": null, "system-tags": {}, "time-created": "2020-07-16T14:59:53.410000+00:00", "time-deletion-of-free-autonomous-database": null, "time-maintenance-begin": "2020-07-18T08:00:00+00:00", "time-maintenance-end": "2020-07-18T14:30:00+00:00", "time-of-last-failover": null, "time-of-last-switchover": null, "time-reclamation-of-free-autonomous-database": null, "used-data-storage-size-in-tbs": null, "whitelisted-ips": null }, "etag": "93d65ef0", "opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljrrdeqourqmtglrnmp3wz5q4qvepnszen5c3ak64y3z6n77xqqriya" } mbp-pvanpuym:~ pietervanpuymbroeck$ |
And afterwards you see it starts provisioning again, just as the GUI did

And after a while, when all is done, it is just as if you did it via GUI

Switchover
This is literally as simple as clicking a button and to quote my Friend Franck Pachot “It just works”. Always nice to hear.
For the commandline, it is also a very simple command:
1 |
oci db autonomous-database switchover --autonomous-database-id ${ADBID} |
And with the corresponding Json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
mbp-pvanpuym:~ pietervanpuymbroeck$ oci db autonomous-database switchover --autonomous-database-id ${ADBID} { "data": { "autonomous-container-database-id": null, "available-upgrade-versions": [], "compartment-id": "ocid1.compartment.oc1..aaa***ulq", "connection-strings": { ... Output omitted ... }, "cpu-core-count": 1, "data-safe-status": "NOT_REGISTERED", "data-storage-size-in-tbs": 1, "db-name": "pvanpuymcli19c", "db-version": "19c", "db-workload": "OLTP", "defined-tags": {}, "display-name": "autonomousdatabase20200716145953", "failed-data-recovery-in-seconds": null, "freeform-tags": {}, "id": "ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abt***psq", "infrastructure-type": null, "is-auto-scaling-enabled": false, "is-data-guard-enabled": true, "is-dedicated": false, "is-free-tier": false, "is-preview": false, "license-model": "BRING_YOUR_OWN_LICENSE", "lifecycle-details": null, "lifecycle-state": "UPDATING", "nsg-ids": null, "private-endpoint": null, "private-endpoint-ip": null, "private-endpoint-label": null, "service-console-url": "https://adb.eu-frankfurt-1.oraclecloud.com/console/index.html?tenant_name=OCID1.TENANCY.OC1..AAA***2EA&database_name=PVANPUYMCLI19C&service_type=ATP", "standby-db": { "lag-time-in-seconds": 338, "lifecycle-details": null, "lifecycle-state": "ROLE_CHANGE_IN_PROGRESS" }, "subnet-id": null, "system-tags": {}, "time-created": "2020-07-16T14:59:53.410000+00:00", "time-deletion-of-free-autonomous-database": null, "time-maintenance-begin": "2020-07-18T08:00:00+00:00", "time-maintenance-end": "2020-07-18T14:30:00+00:00", "time-of-last-failover": null, "time-of-last-switchover": null, "time-reclamation-of-free-autonomous-database": null, "used-data-storage-size-in-tbs": 1, "whitelisted-ips": null }, "etag": "10eae318", "opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abt***wvfsq" } mbp-pvanpuym:~ pietervanpuymbroeck$ |
During the role transition, you can see it in the GUI too

This state also prevents you from doing strange things to the ADB. Which makes sense, as during a role transition you don’t want to get stuck.
Something very nice, which I really like is that when the role transition finished, it just tells you how it went

Conclusion
Setting up Autonomous Data Guard on a serverless instance is very simple. Despite the process being very complex, the tooling guys did a great job to make this work!
It just works!
As always, questions, remarks?
find me on twitter @vanpupi