Sub topic 3
Verifying your environment with a few queries
This chapter assumes you know basic SQL (SELECT, INSERT, CREATE TABLE), can use a terminal, understand the client-server model, and, for the local option, can run a container with Docker or Podman. You should have one of the three environments from the previous chapters ready.
Verifying your environment with a few queries
Run these checks after you connect. They confirm which container you are in, which user you are, and whether DDL (CREATE), DML (INSERT) and queries all work.
SELECT sys_context('USERENV', 'CON_NAME') AS container_name,
sys_context('USERENV', 'SESSION_USER') AS session_user
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;The first query should return FREEPDB1 for the local container, and your own user name rather than SYS. If the CREATE TABLE fails with insufficient privileges, you are probably not using the development user from the setup chapter.
Limits, persistence and lifecycle of each option
| Option | Control | Data persistence | Typical limit |
|---|---|---|---|
| Oracle Database 26ai Free (container) | Full, including the OS and listener | Kept only while the container's volume exists | Limited to the Free edition's resource caps |
| Always Free Autonomous Database | Managed by Oracle | Kept while the database runs | Storage and compute caps; idle databases are stopped and may be reclaimed |
| FreeSQL | None beyond the browser | Scripts are not a backup | Intended for quick exercises |
Removing a container without a mounted volume deletes its data. Export scripts you want to keep.
Troubleshooting common setup problems
- Connection refused on port 1521: The container is still creating the database. Run
docker logs -f oracle-freeand wait forDATABASE IS READY TO USE!. - ORA-12514 (listener does not know the service): Use
FREEPDB1as the service name, not the container name. - ORA-01017 (invalid username or password): Check the password you set with
ORACLE_PWD. Quoted passwords must match exactly. - Autonomous connection fails: Confirm you downloaded the wallet and used the correct TLS connection name.
Choosing the right environment for your goal
Use the container when you want full control or work offline. Use Always Free Autonomous Database when you want a cloud database that Oracle manages. Use FreeSQL for short queries with no install.
Exercise
Exercise
After connecting to the local container, your first query returns SYS as the session user. What should you do before creating practice tables?
Show answer
Connect as the development user you created, such as app_user, and rerun the verification query. Working as SYS lets you change objects you should not touch in practice.