Sub topic 5
Creating an Always Free Autonomous Database
This chapter walks through creating an Always Free Autonomous Database in Oracle Cloud. It covers what you are asking Oracle to build, which choices in the create form matter, and how to confirm that the database is running and reachable.
It assumes you can run basic SQL (SELECT, INSERT, CREATE TABLE) and have read the chapter that compares the three free options. It also assumes you know what a client-server database is. You don't need Docker for this option. Connection methods such as wallets and TLS get their own chapter. Creating a non-administrative user is covered in a later chapter.
What you are creating
Autonomous Database is a managed Oracle database service. Oracle runs the hardware, patching, backups, and tuning. You get a database service and SQL tools, not an operating system or a SYS login. The deployment model is called Serverless. Oracle places your database on shared Exadata infrastructure and gives you a dedicated pluggable database inside it.
An Always Free Autonomous Database is a tier of that service. It costs nothing and doesn't expire like a trial. In exchange, it has fixed resources and a few lifecycle rules. Check Oracle's Always Free documentation for current numbers before relying on them. At the time of writing, the main limits were:
| Item | Always Free behavior |
|---|---|
| Count | Up to two Always Free Autonomous Databases per tenancy |
| Compute | A small fixed amount, about 2 ECPUs shared with other users' sessions, not adjustable |
| Storage | About 20 GB, not adjustable |
| Region | Your home region only, chosen when you created the account |
| Idle behavior | Stopped automatically after a period with no activity (7 days of inactivity) |
| Long-term stop | Reclaimed if left stopped for an extended period (about 90 days) |
| Scaling | No auto scaling, no backup restore to a point in time of your choosing |
The Limits and lifecycle chapter covers the rules in detail. The point for now is that the form you fill in is short because most settings are fixed.
Prerequisites in Oracle Cloud
You need an Oracle Cloud account with the Free Tier. Sign-up asks for an email address, a home region, and a payment card for identity verification. Oracle states that the card is not charged for Always Free resources.
Two decisions at sign-up are hard to undo:
- Home region. Always Free Autonomous Databases can be created only in your home region. Choose a region near you that has capacity. Some popular regions run out of Always Free capacity from time to time.
- Tenancy name. This becomes part of your account and appears in some URLs.
After sign-up you land in the Oracle Cloud Console. The console is the web UI where you create and manage cloud resources.
Creating the database in the console
The overall flow looks like this.
Step 1: Open the service page
In the console, open the navigation menu and choose Oracle Database, then Autonomous Database. Look at the Compartment selector on the left. A compartment is a folder-like container that groups cloud resources and controls access to them. A new account has a root compartment. For practice, you can use that or a compartment you create.
Click Create Autonomous Database.
Step 2: Name the database and choose a workload
The form asks for these values:
- Display name. A friendly label that appears in the console, for example
practice-db. It can contain spaces and can be changed later. - Database name. A short identifier, for example
PRACTICEDB. It must start with a letter, use only letters and digits, and be at most 30 characters. It is used in the connection host name, and it can't be changed later without recreating the database. It must be unique within the region of your tenancy. - Workload type. This tunes defaults for the database. The choices are:
| Workload type | Best fit | Notes |
|---|---|---|
| Transaction Processing | Typical application-style SQL, many small reads and writes | Good default for learning SQL and PL/SQL |
| Data Warehouse | Large scans, reporting, analytics | Favors parallel queries and bulk loads |
| JSON | Document-style applications using the JSON APIs | Same engine, JSON-focused defaults |
| APEX | Low-code web apps built with Oracle APEX | Opens APEX tools first |
For general SQL practice, choose Transaction Processing. All four types run the same Oracle Database engine, so SQL you write in one works in the others.
Step 3: Choose the deployment and turn on Always Free
Select Serverless as the deployment type. Then find the Always Free toggle and turn it on. This is the setting that makes the database free. If you leave it off, you are configuring a paid database, and the form will show ECPU and storage sliders. When the toggle is on, those sliders disappear and show the fixed values instead.
Choose a database version from the list. Oracle offers more than one release for Always Free, for example 19c and 26ai. For learning, choose 26ai if it is offered, so that the features in this tutorial are available. If you need to match a production system on 19c, choose that.
> Version availability changes over time, so the list on your screen is the source of truth.
Step 4: Set the ADMIN password
ADMIN is the built-in administrator account of an Autonomous Database. It is not SYS. It has broad privileges, such as creating users and granting roles, but Oracle keeps the real SYS and SYSTEM accounts locked away.
The password must follow these rules:
- 12 to 30 characters long.
- At least one uppercase letter, one lowercase letter, and one number.
- It can't contain a double quote character.
- It can't contain the word
admin, in any capitalization.
Write the password down in a password manager. Oracle can't tell you what it is later, though you can reset it from the console.
Step 5: Choose network access
The Choose network access section decides who can reach the database over the network. Always Free supports these options, though availability changes, so check what your form offers:
- Secure access from everywhere. The default. Anyone with valid credentials and the right connection information can connect. Connections are always encrypted.
- Secure access from allowed IPs and VCNs only. You list IP addresses or ranges that may connect. Everything else is refused before it reaches the database.
Private endpoint access, where the database has only a private address inside your own virtual network, is generally not available for Always Free.
For practice, the default is fine as long as your password is strong. If you always connect from the same fixed address, an allowed-IP list reduces exposure. Be careful, though: if your home IP changes, you will be locked out until you update the list in the console.
The mutual TLS (mTLS) authentication checkbox, if shown, controls whether clients must present a wallet. By default mTLS is required, so tools connect with a wallet file. You can turn it off to allow one-way TLS connections, which don't need a wallet. The connectivity chapter explains the difference.
Step 6: Contact email and create
You may add a contact email for maintenance and lifecycle notices. Add one. It is how Oracle warns you before an idle database is stopped. Then click Create Autonomous Database.
Waiting for provisioning
The details page opens with a status of Provisioning. This usually takes one to a few minutes. When the status shows Available in green, the database is ready.
The details page contains the values you need later:
- The Database name and Display name.
- The Workload type and Database version.
- A Database actions button for SQL and administration tools.
- A Database connection button for wallets and connection strings.
- A More actions menu with Stop, Start, Restart, Change password, and Terminate.
Creating the database with the OCI CLI
The console is the easiest path for a first database. You can also script it with the OCI command-line interface, which is useful for repeatable setups. This assumes the CLI is installed and configured with oci setup config, and that you have the OCID (the unique identifier) of your compartment.
export COMPARTMENT_OCID='ocid1.compartment.oc1..replace_me'
export ADMIN_PWD='Replace_This_Pwd_1'
oci db autonomous-database create \
--compartment-id "$COMPARTMENT_OCID" \
--display-name practice-db \
--db-name PRACTICEDB \
--db-workload OLTP \
--is-free-tier true \
--cpu-core-count 1 \
--data-storage-size-in-tbs 1 \
--admin-password "$ADMIN_PWD" \
--wait-for-state AVAILABLENotes on this command:
--db-workload OLTPselects Transaction Processing. Other values areDW,AJD(JSON), andAPEX.--is-free-tier trueis the CLI form of the Always Free toggle. The CPU and storage values are required by the command, but Always Free fixes the real resources.--wait-for-state AVAILABLEmakes the command return when the database is ready, instead of immediately.- Replace the placeholder password and OCID before running it. Passing a password on the command line can leave it in your shell history, so use a throwaway password or read it from a protected source.
Opening SQL in Database Actions
Database Actions is the browser-based tool suite built into every Autonomous Database. It includes a SQL worksheet, data loading, and user administration, so you can start without installing any client.
- On the database details page, click Database actions, then choose SQL. If you see a list of views first, pick SQL from the Development section.
- You are signed in as
ADMINwith no separate login step when you open it from the console. - Close any welcome tour, and type SQL into the worksheet.
- Press the Run Script button (or Ctrl+Enter for the highlighted statement, Shift+Enter for a script).
Run a first check:
SELECT banner_full
FROM v$version;
SELECT sys_context('USERENV', 'SESSION_USER') AS session_user,
sys_context('USERENV', 'CON_NAME') AS container_name
FROM dual;The first query returns the Oracle release string. The second should show ADMIN as the session user. The container name is the name of your pluggable database, which is generated by Oracle and is not the database name you typed.
If both queries return rows, your database is created and working. The next chapters cover other ways to connect, creating a development user, and a full verification routine.
Common problems at creation time
| Symptom | Likely cause | What to do |
|---|---|---|
| No Always Free toggle on the form | Wrong region, or not a Free Tier account, or you already use both free databases | Check your home region and your existing Autonomous Databases |
| "Out of capacity" error | The home region has no spare Always Free capacity | Try again later, or use a different free option for now |
| Password rejected | Fails the complexity rules, or contains `admin` or a double quote | Choose a password that meets the rules |
| Database name rejected | Starts with a digit, has symbols, or is already used | Use letters and digits, starting with a letter, and try another name |
| Status shows Stopped | The database was idle too long or you stopped it | Choose **More actions**, then **Start** |
Exercise
You create an Always Free Autonomous Database and your colleague asks you to set the ADMIN password to "AdminPractice1" because it is easy to remember. Will the console accept it, and what rules should you check instead?
Show answer
No. The password contains the word "admin", which is not allowed in any capitalization. A valid password is 12 to 30 characters long, has at least one uppercase letter, one lowercase letter, and one number, and has no double quote and no "admin". For example, "PracticeSql2026" meets those rules.
Exercise
A learner turned off the Always Free toggle and now sees ECPU and storage sliders. What does that mean for cost, and how should they fix it?
Show answer
Without the toggle, the form creates a paid database that is billed for the resources it uses. They should not click Create. They should turn Always Free on, confirm that the sliders are replaced by fixed values, and then create the database. If they already created a paid database, they should terminate it from the More actions menu.
Exercise
You can open Database Actions and run SQL as ADMIN, but a teammate says "the database name is PRACTICEDB, so the container name from sys_context should also be PRACTICEDB". Is that right?
Show answer
Not necessarily. The container name returned by syscontext('USERENV', 'CONNAME') is the name of the pluggable database that Oracle generates for your service. It is not the database name you typed in the form, so the two usually differ. Use the connection strings in the console to find the right service name when you connect from other tools.