Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Oracle CLI Tutorial

Welcome to the Oracle Command-Line Interface (CLI) tutorial. This guide will walk you through the basics of using Oracle CLI for managing Oracle databases and services.

Introduction to Oracle CLI

The Oracle CLI is a powerful tool for interacting with Oracle Cloud services and managing resources from the command line. It allows you to automate tasks, manage databases, and more.

Installing Oracle CLI

To get started, you need to install the Oracle CLI. Follow these steps:

$ curl -o oci-cli.zip https://url-to-download/oci-cli.zip
$ unzip oci-cli.zip
$ cd oci-cli
$ ./install.sh
      

Configuring Oracle CLI

After installation, configure the Oracle CLI with your Oracle Cloud credentials:

$ oci setup config
Oracle Cloud User ID: your_user_id
Oracle Cloud Tenancy ID: your_tenancy_id
Region: us-phoenix-1
      

Using Oracle CLI

Here are some common commands to get you started:

# List all available services
$ oci services list

# List Autonomous Databases
$ oci db autonomous-database list

# List Compute Instances
$ oci compute instance list

# List Object Storage Buckets
$ oci os bucket list --compartment-id ocid1.compartment.oc1..your_compartment_id

# Get details of a specific Autonomous Database
$ oci db autonomous-database get --autonomous-database-id ocid1.autonomousdatabase.oc1..your_adb_id
      

Managing Resources

You can manage resources like databases, compute instances, and object storage using Oracle CLI:

# Stop a Compute Instance
$ oci compute instance action --action STOP --instance-id ocid1.instance.oc1..your_instance_id

# Scale Autonomous Database
$ oci db autonomous-database update --autonomous-database-id ocid1.autonomousdatabase.oc1..your_adb_id --cpu-core-count 2 --data-storage-size-in-tbs 5

# Upload a file to Object Storage
$ oci os object put --bucket-name your_bucket_name --file /path/to/local/file.txt --name file.txt
      

Conclusion

Congratulations! You've learned the basics of Oracle CLI. Experiment with more commands and explore the documentation for advanced usage.