The OCI CLI is a small-footprint tool that you can use on its own or with the Oracle Cloud Console to complete Oracle Cloud Infrastructure tasks. The OCI CLI provides the same core functionality as the Console, plus additional commands. Some of these, such as the ability to run scripts, extend Console functionality.
In this blog, we will use the OCI CLI command line tool to create an “Always Free” Autonomous Database. Then, we will use the tool to stop, start, and delete the autonomous database.
Prerequisites:
To create the new autonomous database, we use the command “oci db autonomous-database create [options]“. There are required and optional parameters to run the command.
Use the command “oci db autonomous-database create –help” to get the command’s reference.
— is-free-tier parameter indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory, and CPU cannot be scaled.
The main parameters to define:
–compartment-id: The OCID of the compartment of the Autonomous Database
–db-name: The database name. The name must begin with an alphabetic character and can contain a maximum of 14 alphanumeric characters. Special characters are not permitted. The database name must be unique in the tenancy
–display-name: The user-friendly name for the Autonomous Database. The name does not have to be unique
–db-workload: The Autonomous Database workload type. Accepted values are: OLTP, DW, APEX, AJD
–admin-password: Autonomous Database Admin Password
Once you execute the command, go to the OCI console and navigate to “Oracle Database > Autonomous”, you can see the new always free autonomous database in the Processing state as shown below.
Once create command finishes, the state will be Available.
Use the command “oci db autonomous-database get [options]” to get the details of the specified autonomous database.
Use command “oci db autonomous-database stop [options]” to stop a specified autonomous database.
Use the command “oci db autonomous-database start [options]” to start a specified autonomous database.
Use command “oci db autonomous-database delete [options]” to delete a specified autonomous database.
Resources:
– OCI CLI Command Reference Document https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.30.2/oci_cli_docs/cmdref/db/autonomous-database.html