6.2 The basics - OCI CLI (MySQL DB System)

Prerequisites: Install and configure OCI CLI

This example takes place in root compartment, therefore there is a layer of simplicity when implemeting the deployment of an MySQL instance using OCI CLI

root@deploymentmachine:~/.oci# export TENANCY="ocid1.tenancy.oc1..aaaaaasomefaketenancyidinhereaaaaa323423421"
root@deploymentmachine:~/.oci# export COMPARTMENT="ocid1.tenancy.oc1..aaaaaasomefakecompartmentidinhereaaaaa323423422"
root@deploymentmachine:~/.oci# export USER="ocid1.user.oc1..aaaaaasomefakeuseridinhereaaaaa323423423"

You will be needing the Compartment ID for extracting the necessary data.

1. Get a list of supported Oracle Database versions.

root@deploymentmachine:/home/tests/mydb# oci db version list -c $COMPARTMENT --db-system-shape "VM.Standard1.1" --all --output table
+-----------------------------+-----------------------+----------------------+--------------+-----------------+
| is-latest-for-major-version | is-preview-db-version | is-upgrade-supported | supports-pdb | version         |
+-----------------------------+-----------------------+----------------------+--------------+-----------------+
| True                        | False                 | False                | False        | 11.2.0.4        |
| False                       | False                 | False                | False        | 11.2.0.4.200114 |
| False                       | False                 | False                | False        | 11.2.0.4.200414 |
| False                       | False                 | False                | False        | 11.2.0.4.200714 |
| False                       | False                 | False                | False        | 11.2.0.4.201020 |
| True                        | False                 | False                | True         | 12.1.0.2        |
| False                       | False                 | False                | True         | 12.1.0.2.200114 |
| False                       | False                 | False                | True         | 12.1.0.2.200414 |
[.................................skipping................................skipping............................]
| False                       | False                 | False                | True         | 18.10.0.0       |
| False                       | False                 | False                | True         | 18.11.0.0       |
| False                       | False                 | False                | True         | 18.12.0.0       |
| False                       | False                 | False                | True         | 18.9.0.0        |
| True                        | False                 | True                 | True         | 19.0.0.0        |
| False                       | False                 | False                | True         | 19.6.0.0        |
| False                       | False                 | True                 | True         | 19.7.0.0        |
| False                       | False                 | True                 | True         | 19.8.0.0        |
| False                       | False                 | True                 | True         | 19.9.0.0        |
| True                        | False                 | False                | True         | 21.0.0.0        |
| False                       | False                 | False                | True         | 21.1.0.0        |
+-----------------------------+-----------------------+----------------------+--------------+-----------------+

2. For this example, going with 19.6.0.0 version

For surpressing further warning messages when running OCI CLI, perform following:

3. Obtain Subnet ID:

3.1 Obtain VCN ID:

3.2 Obtain the Subnet ID corresponding to the VCN ID:

n.b: Those that wish to know more about the json file involved in creating MySQL instance, can run the following command:

Since this is a very simple example, our final json file to use for building the MySQL instance:

4. To create the MySQL instance, run the following command:

n.b: If any issues with your json file, you would receive an error output.

Suppose I have allocated only 40Gb for my dataStorageSizeInGb, I would be receivig a ServiceError as below:

4.1 If all good when running command, for the our json file we should receive an output as following:

5. Check the creation from OCI UI:

6. Once the MySQL DB System is available, an private IP will be provided to it:

Last updated