Sub topic 9
Limits, Persistence and Lifecycle of Each Option
This chapter assumes you have read the earlier chapters on the three environments: Oracle Database 26ai Free in a container, an Always Free Autonomous Database, and FreeSQL. You should be comfortable with basic Docker commands and with the idea of a database user and its schema. Here you learn what each option limits, where your data lives, and what makes it disappear.
Resource numbers for free products change between releases. The figures below were correct when this was written. Treat the vendor documentation as the final source before you plan around a specific number.
Why lifecycle matters for practice work
A practice database is only useful if your work survives long enough to be reused. Each option fails in a different way:
- The container loses data when you delete it without a volume.
- Autonomous Database stops itself when you leave it idle, and can eventually be reclaimed.
- FreeSQL keeps scripts only under conditions you must understand, and gives you no administrative control.
Knowing these rules up front lets you keep your DDL in script files and rebuild an environment in minutes.
Oracle Database 26ai Free in a container
Resource limits
Oracle Database Free is the full database engine with fixed caps on what it uses, regardless of how large your machine is:
- Up to 2 CPU threads for foreground processing.
- Up to 2 GB of RAM for the database instance.
- Up to 12 GB of user data on disk.
These caps are enforced by the database, not by Docker. Giving the container more cores does not raise them. The 12 GB limit applies to user data. Oracle's own data such as the system tablespaces does not count against it. If you load a large dataset and hit the cap, inserts fail with an error and you must delete data to continue.
The product also has feature restrictions compared with Enterprise Edition. For example, you get one instance per machine, and some options are unavailable. Most SQL and PL/SQL practice is not affected.
Where the data lives
Inside the container, the database files are stored under /opt/oracle/oradata. Where that path points determines what you lose:
| Action | Container filesystem | Named volume on `/opt/oracle/oradata` |
|---|---|---|
| `docker stop` then `docker start` | Data kept | Data kept |
| Host reboot, Docker restarts container | Data kept | Data kept |
| `docker rm` | Data lost | Data kept in the volume |
| `docker rm -v` or `docker volume rm` | Data lost | Data lost |
A stopped container still holds its writable layer, so a plain stop and start is safe. The risk is docker rm, which is a routine cleanup step and deletes everything the database wrote inside the container.
To make the data independent of the container, mount a volume when you first 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:latestDocker creates the named volume oracle-free-data on first use. After this, you can remove and recreate the container, and the new one will find the existing database files and open them instead of creating a new database.
First start versus later starts
On the first start with an empty data directory, the container creates the database. This takes several minutes, and you wait for DATABASE IS READY TO USE! in the log. On later starts, with data already present, the container only opens the existing database, which is much faster.
Two consequences follow:
ORACLE_PWDis only used during creation. If you start a container against an existing volume with a differentORACLE_PWD, the passwords inside the database do not change.- If a first start is interrupted, for example by killing Docker during creation, the volume can hold a half-built database. The simplest fix for practice work is to remove the container and the volume and start again.
Bind mounts and permissions
You can mount a host directory instead of a named volume, such as -v /home/me/oradata:/opt/oracle/oradata. The database process runs as the oracle user inside the container, which has a numeric user ID (54321 in Oracle's images). The host directory must be writable by that ID, or startup fails with permission errors. Named volumes avoid this problem because Docker sets them up for you. With Podman in rootless mode, user-ID mapping adds another layer, so the named volume is again the easier choice.
Version changes
The latest tag moves when Oracle publishes a new release. If you pull a newer image and point it at a volume created by an older one, the database may need an upgrade step that the container does not do for you. For anything you want to keep, pin a specific tag and change it deliberately. For throwaway practice, latest with a fresh volume is fine.
Backups
Nothing backs up a local container for you. Two cheap options work for practice:
- Keep your schema and sample data in SQL script files in version control, so you can rebuild.
- Export with Data Pump or copy the volume contents while the container is stopped.
The first option is usually enough and is the habit worth building.
Always Free Autonomous Database
Resource limits
An Always Free Autonomous Database is a small instance of a managed service. The limits that matter for practice:
- A small fixed compute allocation, with no option to scale it up while the database is Always Free.
- A small fixed storage allocation, about 20 GB at the time of writing.
- A limited number of Always Free Autonomous Databases per tenancy. The documented figure has been two.
- A low cap on concurrent database sessions, so many parallel connections or a busy tool can hit it.
- The database must be created in your home region.
Because the service is managed, you cannot log in as SYS or reach the operating system. Your highest privileged account is ADMIN, and several operations that you could do in the container, such as changing instance parameters freely, are unavailable or restricted. Some features are limited or absent in the Always Free tier. If you want to rely on a particular feature, search the documentation for it before you build a lab around it.
Idle stop and reclamation
Always Free databases are not meant to run unattended forever, so Oracle applies inactivity rules:
- If the database has no activity for a stretch of days (7 at the time of writing), the service stops it automatically.
- If it stays stopped for a longer stretch (90 days at the time of writing), the service can reclaim it. Reclaiming means deleting the database and its data.
A stopped database does not lose data. You restart it from the Oracle Cloud console, and it becomes available again after a short wait. The danger is leaving it stopped for so long that it is reclaimed. Oracle also sends notification emails to the tenancy's contact address before it takes this step, so make sure that address is one you read.
The following diagram shows the lifecycle.
Activity that keeps the database from counting as idle means real connections and statements. A reasonable habit is to sign in and run a query at least once a week while you are actively using it, and to start it again after a break.
Persistence
While the database exists, your data is stored durably and the service handles storage and backups on the cloud side. You do not manage volumes. The persistence risk is not a lost disk but the lifecycle rules above, plus the fact that the free allocation is small. Even so, keeping your DDL in scripts remains the right way to rebuild, especially because an Always Free database can be reclaimed.
Account-level risk
Always Free resources belong to your Oracle Cloud account. If you start with a trial that has credits, check what happens to your Always Free resources when the trial ends, and whether you need to upgrade the account to keep them. If your cloud account itself is closed or becomes inactive, the databases go with it.
FreeSQL
What you get
FreeSQL is a browser-based SQL worksheet running against an Oracle database that Oracle hosts. You install nothing, and you do not manage a database or a user. The limits come from that design:
- You do not get administrative access, and you cannot connect to it from SQL*Plus, SQLcl or an application. It is reachable only through the web page.
- You cannot change the database version or configuration. It tracks whatever Oracle runs on the site.
- Resource limits on statements, session time and storage are enforced by the service and can change. Heavy workloads or long-running statements are not the intended use.
Persistence of scripts and data
FreeSQL separates your scripts from the database state:
- Scripts you save are stored with your account, so you need to sign in with an Oracle account to keep them. If you work without signing in, treat everything as temporary, and copy your SQL out before you close the tab.
- Database objects you create belong to a session-scoped or account-scoped schema that the service manages. Do not assume tables will exist next week. Design your practice so that a script creates what it needs from scratch each time.
A script that begins with the drops and creates for its own objects works in all three environments and does not depend on persistence. A common pattern in Oracle SQL scripts is to drop and ignore the error if the table does not exist. In 26ai you can use the IF EXISTS clause:
DROP TABLE IF EXISTS practice_note PURGE;
CREATE TABLE practice_note (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
body VARCHAR2(200) NOT NULL
);
INSERT INTO practice_note (body) VALUES ('Rebuilt from a script');
COMMIT;
SELECT id, body FROM practice_note;DROP TABLE ... IF EXISTS is available from Oracle Database 23ai onward. On an older database, you have to catch the error in PL/SQL instead.
Checking how much space you use
Hitting a storage cap is a likely failure on the container (12 GB of user data) and on Autonomous (about 20 GB). As a development user you can look at your own segments without any special privilege:
SELECT segment_type,
ROUND(SUM(bytes) / 1024 / 1024, 2) AS size_mb
FROM user_segments
GROUP BY segment_type
ORDER BY size_mb DESC;This shows only your schema. It does not show the whole database total, which needs privileged views such as dba_data_files or dba_segments and is not available to a normal user.
Side-by-side summary
| Property | 26ai Free container | Autonomous Always Free | FreeSQL |
|---|---|---|---|
| Where data lives | Container layer or Docker volume | Oracle Cloud storage | Oracle-hosted service |
| Main size limit | 12 GB user data, 2 GB RAM, 2 CPU threads | About 20 GB, small fixed compute | Service-enforced, can change |
| Survives stop and restart | Yes | Yes, but may stop itself when idle | Not applicable |
| Main way to lose data | `docker rm` without a volume | Reclamation after a long stop, or deletion | Closing the page without signing in, service resets |
| Admin access | Yes (SYS, SYSTEM, PDBADMIN) | ADMIN only, restricted | None |
| Backup responsibility | You | Mostly the service | Keep your own scripts |
| Needs internet | Only to pull the image | Always | Always |
Common mistakes
- Starting the container without
-v, loading data for a week, then runningdocker rmduring cleanup. - Leaving an Autonomous Database untouched through a long break and not reading the warning emails.
- Treating FreeSQL as a place to keep the only copy of a script.
- Assuming that a bigger Docker allocation raises the 2 GB or 12 GB caps.
- Changing
ORACLE_PWDon restart and expecting the password to change.
Exercises
Exercise
You ran the 26ai Free container without a -v option and created several tables. You run docker stop oracle-free and later docker start oracle-free. Are the tables still there? What if you had run docker rm oracle-free instead of stopping it?
Show answer
After docker stop and docker start, the tables are still there, because the stopped container keeps its writable layer with the database files. After docker rm, the writable layer is deleted and the tables are lost, because no volume held /opt/oracle/oradata.
Exercise
Your Always Free Autonomous Database was stopped automatically after a week of inactivity. Is your data gone? What would you do, and what is the longer-term risk?
Show answer
The data is not gone. A stopped database keeps its data, and you start it again from the Oracle Cloud console. The longer-term risk is that if it stays stopped for too long (90 days at the time of writing), the service can reclaim it and delete the data. Keep your setup scripts so you can rebuild if that happens.
Exercise
Why does ORACLE_PWD have no effect when you start a container on a volume that already holds a database?
Show answer
The variable is read only when the container creates a new database on an empty data directory. When the data files already exist, the container just opens them, so the existing passwords stay unchanged.