Local Oracle Database 21c XE environment via Docker used on course Oracle SQL Especialista: do Básico ao Avançado.
| Tool | Version | Notes |
|---|---|---|
| Docker | 24+ | With Docker Compose v2 plugin (docker compose) |
| Node.js | 18+ | For npm scripts |
No JDK required to run the container. If you need JDBC connectivity from a Java client, install JDK 11+.
.env.development has ready-to-use variable values for running locally
Password rules enforced by Oracle:
- Minimum 8 characters
- At least one uppercase letter, one lowercase letter, one digit
npm run db:upThe first start downloads the image (~1.3 GB) and initializes the database — this takes 2–5 minutes. Watch progress with:
npm run db:logsWait until you see:
DATABASE IS READY TO USE!
npm run db:connect| Setting | Value |
|---|---|
| Host | localhost |
| Port | 1521 |
| Service name | XEPDB1 (app PDB) or XE (CDB root) |
| SYS password | value of ORACLE_PASSWORD |
| App user | value of APP_USER / APP_USER_PASSWORD |
JDBC URL:
jdbc:oracle:thin:@localhost:1521/XEPDB1
Inside sqlplus (either connect script above):
-- Basic connectivity
SELECT 'OK' AS status FROM dual;
-- Current user and database
SELECT USER, SYS_CONTEXT('USERENV','DB_NAME') AS db FROM dual;
-- Oracle version
SELECT * FROM v$version WHERE banner LIKE 'Oracle%';Expected output from the last query:
BANNER
--------------------------------------------------------------------------------
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
| Script | Description |
|---|---|
npm run db:up |
Start Oracle container in the background |
npm run db:down |
Stop container (data volume preserved) |
npm run db:destroy |
Stop container and delete all data |
npm run db:logs |
Stream container logs |
npm run db:status |
Show container health and status |
npm run db:connect |
Connect as app user via sqlplus |
gvenzl/oracle-xe:21-slim — community-maintained, no Oracle account required.
- Source: https://hub.docker.com/r/gvenzl/oracle-xe
- Slim variant: reduced image size, no sample schemas
Data is stored in the oracle-data Docker named volume. It survives db:down and container restarts. Only db:destroy removes it.
Container unhealthy / startup timeout
- First-run initialization can take 3–5 min — keep tailing logs with
npm run db:logs.
ORA-01017: invalid username/password
- Check password values; they are case-sensitive.
- Re-create the container after changing passwords:
npm run db:destroy && npm run db:up. - Do not set
ORACLE_DATABASEtoXEPDB1in your env files. Thegvenzl/oracle-xeimage treatsORACLE_DATABASEas the name of a new PDB to create — if you set it toXEPDB1(which already exists as the default), that step is silently skipped andAPP_USERis never created. LeaveORACLE_DATABASEunset to useXEPDB1(the connect script falls back to it automatically), or set it to a custom name likeDEVDBto create a dedicated PDB.
Port 1521 already in use
- Change
ORACLE_PORTin.env(e.g.,ORACLE_PORT=1522) and restart.