Sub topic 11
Choosing the right environment for your goal
This chapter helps you pick one of the three practice environments covered earlier in this tutorial: FreeSQL, Oracle Database 26ai Free in a container, and an Always Free Autonomous Database. It assumes you can write basic SQL (SELECT, INSERT, CREATE TABLE), use a terminal, and understand the client-server idea. Docker or Podman experience matters only if you choose the container option.
No option is best in general. Each trades setup effort against control, persistence, and how closely it matches production. Start from what you want to practice, then check the limits.
The three options side by side
| Dimension | FreeSQL | 26ai Free in a container | Always Free Autonomous Database |
|---|---|---|---|
| Where it runs | Oracle's servers, in your browser | Your machine (or any host with a container engine) | Oracle Cloud Infrastructure (OCI) |
| Setup effort | Open a page, optionally sign in | Install a container engine, pull a large image, wait for first start | Create an OCI account and provision a database |
| Control | Lowest. You write SQL only | Highest. You own the container, ports, volumes and passwords | Medium. You are ADMIN, but Oracle manages the infrastructure |
| Persistence | Saved scripts need an account; treat data as disposable | Persists only if you mount a volume | Persists, but the database stops when idle and can be reclaimed |
| Network access from your tools | Not applicable (browser only) | Listener on port 1521, plain Easy Connect | TLS or mutual TLS (wallet), Database Actions in the browser |
| Typical use | Learning SQL, trying a snippet, sharing a script | Application development, tools, offline work, repeatable labs | Cloud-style practice, APEX, REST, sharing a reachable database |
Treat the numbers on limits (CPU, memory, storage, idle timeouts) as values to confirm on Oracle's current documentation. They have changed between releases, and this table avoids freezing them.
Decide by goal, not by feature list
Most practice goals fit one of a few patterns. Match yours to the pattern, then read the reasoning.
Goal: learn or review SQL syntax
Use FreeSQL. You need nothing except a browser, and you can start a session in under a minute. It is also the best way to test a query on a machine where you cannot install software, such as a locked-down work laptop or a tablet.
FreeSQL limits you in ways that matter later. You cannot connect your own tools (SQL*Plus, SQLcl, a JDBC application) to it. You cannot control the instance, and privileges are restricted. If your practice involves any of those, move on.
Goal: build an application that connects to a database
Use 26ai Free in a container or Autonomous Database. Your code needs a connect string, a user, and a network path, and FreeSQL provides none of these.
- Choose the container when the application runs on your machine and you want a fast, free loop with no cloud account. Connecting is a single Easy Connect string,
localhost:1521/FREEPDB1. - Choose Autonomous when the application runs in the cloud, when several people or machines must reach the same database, or when you want to practice the TLS and wallet configuration real cloud deployments need.
Goal: practice administration and architecture
Use the container. Only there can you see the multitenant structure directly: connect to the container database (CDB) as SYS, switch to the pluggable database (PDB) FREEPDB1, restart the instance, read log output, and see what happens when a volume is missing. Autonomous deliberately hides these layers. FreeSQL hides them completely.
Goal: practice in the cloud style
Use Autonomous. It gives you Database Actions, the browser-based SQL worksheet, plus the wallet and TLS connection model, Oracle-managed patching, and the idle-stop lifecycle. Those are what you will deal with on the job if your employer uses Oracle Cloud.
Goal: share a lab or a script with others
Two good answers exist. For a script that anyone can run, publish it to FreeSQL. For a shared, reachable database, use Autonomous. A container on your laptop is reachable by others only if you expose a port, which is rarely a good idea.
A decision flow
The diagram turns the questions above into a path. Follow the first question that applies to you.
Trade-offs worth weighing
Setup effort versus first-run surprises
FreeSQL has almost no setup, but its limits show up only when you try something unusual. The container asks the most up front: a container engine, a download of the image, and a first start during which the database is created. During that wait, the log shows progress and ends with DATABASE IS READY TO USE!. Autonomous has a medium setup, though the account sign-up and provisioning steps are the part most likely to need patience, especially with identity verification.
Persistence
Persistence is where beginners lose work. Compare what survives in each option:
- FreeSQL: save your scripts to your account, and keep a copy of important ones elsewhere. Do not rely on data you created in a session.
- Container: data lives inside the container's filesystem unless you mount a volume. Stopping and starting the same container keeps data. Removing the container deletes it. A volume keeps data across container removal and image upgrades.
- Autonomous: data persists across stop and start. An Always Free database that sits idle is stopped automatically. If it stays stopped for long enough, Oracle can reclaim it, and then the data is gone. Check the current idle and reclamation periods in Oracle's documentation.
To make the container persist, name a volume when you create it:
docker run -d --name oracle-free \
-p 1521:1521 \
-e ORACLE_PWD='ChangeMe_123' \
-v oracle-free-data:/opt/oracle/oradata \
container-registry.oracle.com/database/free:latestThe -v option maps a named volume to the directory where the image keeps its data files. Without it, docker rm oracle-free destroys the database.
Resource limits
The Free editions and Always Free tier cap resources. Oracle Database Free limits CPU, memory, and user data. Always Free Autonomous limits storage, compute, and concurrent sessions, and allows only a small number of Always Free instances per tenancy. For learning SQL, PL/SQL, indexing, and data modeling, these limits rarely matter. They matter when you load large datasets, run many parallel sessions, or benchmark. A practice database is not a performance testing platform. Results from one cannot be extrapolated to production.
Feature fidelity
Autonomous is a managed service, so some things differ from a self-managed database. You cannot connect as SYS, you cannot change many initialization parameters, and tablespace and storage management are automated. The container is a normal Oracle Database instance, so it behaves like a self-managed one, with the same freedom and the same responsibility. If you are learning for a job that uses Autonomous, practice there. If the job uses on-premises Oracle, the container matches more closely.
Security habits
Whatever you choose, work as a development user and not as the administrator. On the container, create a user such as app_user in FREEPDB1 instead of working as SYS. On Autonomous, create a user instead of working as ADMIN. This keeps your practice code from depending on privileges your real applications will not have.
Verify the choice with one portable script
Whichever environment you pick, run the same short script to confirm it works. This checks that you are in the expected container and user, then exercises DDL, DML and a query. The first query uses sys_context, which any user can call, so it avoids dictionary views that need extra privileges.
SELECT sys_context('USERENV', 'CON_NAME') AS container_name,
sys_context('USERENV', 'SESSION_USER') AS session_user,
sys_context('USERENV', 'SERVICE_NAME') AS service_name
FROM dual;
CREATE TABLE practice_note (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
body VARCHAR2(200) NOT NULL
);
INSERT INTO practice_note (body) VALUES ('Hello from my practice database');
COMMIT;
SELECT id, body FROM practice_note;What to expect in each place:
- Container:
container_nameisFREEPDB1, andsession_useris your development user (notSYS). - Autonomous: the container name is a generated PDB name,
session_userisADMINor your own user, and the service name matches one of the service levels (such ashigh,mediumorlow) in its connection string. - FreeSQL: the query works, but the container and service names belong to Oracle's shared infrastructure, so do not read meaning into them.
If the script behaves the same in two environments, your SQL is portable between them. When it fails in one, the difference is usually a privilege or quota, such as a missing QUOTA on a tablespace. The earlier chapter on development users covers the fix.
Using more than one option
You do not have to commit to a single environment. A common pattern for learners:
- Prototype and test short queries in FreeSQL.
- Develop and iterate on a schema in the container, with a volume so it survives restarts.
- Deploy the same scripts to Autonomous to test cloud connectivity or share a demo.
This works when your DDL and data scripts are plain SQL files that run unchanged in all three. Avoid hard-coding tablespace names, file paths, or SYS-only operations in them. If a script needs environment-specific setup, keep that part in a separate file.
Common mistakes when choosing
- Choosing the container for the sake of "real" Oracle, then stalling on setup. If the goal is to learn SQL, a blocked install costs more than FreeSQL's limits would have.
- Treating Autonomous as permanent storage. Idle-stop and reclamation rules mean you should export data you care about.
- Expecting to connect SQL*Plus or an application to FreeSQL. It is a browser tool. Use the container or Autonomous for client connections.
- Working as an administrator everywhere. It hides missing-grant problems until you move to a real system.
- Using a practice database for performance conclusions. The resource caps make timing results misleading.
Summary
Use FreeSQL when you need SQL immediately with nothing to install. Use the 26ai Free container when you need control, offline work, CDB and PDB visibility, or a local application target. Use Always Free Autonomous Database when you need the cloud model, a reachable database, or practice with wallets, TLS, and Database Actions. Check the persistence rules before you put data you care about into any of them, and run one small verification script so you know the environment works before you build on it.
Exercise
You are building a small web application on your laptop and want the database to keep its data when you remove and recreate the container during upgrades. Which environment fits, and what must you add to the docker run command?
Show answer
Use Oracle Database 26ai Free in a container, because your application needs a connect string and a network path that FreeSQL does not provide, and the container runs locally. Add a named volume, for example -v oracle-free-data:/opt/oracle/oradata, so the data files live outside the container and survive docker rm and image upgrades.
Exercise
A colleague wants to practice SELECT with joins on a work laptop where installing software is forbidden, and has no cloud account. Which option do you recommend, and name one thing they cannot do with it?
Show answer
Recommend FreeSQL, which runs in the browser with nothing to install. They cannot connect their own tools or applications (such as SQL*Plus or a JDBC program) to it, and they have no control over the instance.
Exercise
You created an Always Free Autonomous Database three months ago, practiced for a week, and have not touched it since. What risk should you check on, and how would you protect your work?
Show answer
Always Free databases are stopped automatically after a period of inactivity, and if they stay stopped long enough Oracle can reclaim them, which deletes the data. Check the current idle and reclamation periods in Oracle's documentation, restart the database if it is stopped, and export any data or scripts you want to keep.