Create Oracle Autonomous Database Using OCI CLI

Share on:

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:

  • An Oracle Cloud Free Trial or Paid Account
  • Installed and configured OCI CLI client. I have the OCI client installed and configured on Linux Virtual Machine.

 

Create Always Free Autonomous Database 

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

 

ocicli

 

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.  

ocicli2

 

Once create command finishes, the state will be Available

ocicli3

 

Get the details of the Autonomous Database

Use the command “oci db autonomous-database get [options]” to get the details of the specified autonomous database.

 

ocicli4

ocicli5

 

Stop an Autonomous Database

Use command “oci db autonomous-database stop [options]” to stop a specified autonomous database.

 

ocicli6

ocicli7

ocicli8

 

Start an Autonomous Database

Use the command “oci db autonomous-database start [options]” to start a specified autonomous database.

 

ocicli9

ocicli10

ocicli11

 

Delete an Autonomous Database

Use command “oci db autonomous-database delete [options]” to delete a specified autonomous database.

 

ocicli12

ocicli13

ocicli14

 

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

Share on:

More from this Author

Oracle 23c: Hybrid Read-Only Mode for Pluggable Databases

Overview: Oracle 23c database introduces a new feature to open Pluggable database in a new mode called hybrid read-only Hybrid read-only mode enables ... Read More

MySQL: Updating the Configuration of a MySQL DB System on OCI

Overview: A MySQL configuration is a collection of variables that define the operation of a MySQL DB system. It is analogous to ... Read More

Back to Top