Cheat sheets

Oracle + APEX quick reference

The connection details, URLs and commands you reach for every day.

Local stack connection

DB host / port
localhost / 1521
Service (PDB)
FREEPDB1
Admin user
SYSTEM
APEX URL
http://localhost:8080/ords/apex
EM Express
https://localhost:5500/em

Docker lifecycle

Start
docker compose start
Stop (keep data)
docker compose stop
Remove
docker compose down
Full reset
docker compose down -v
Status
docker ps

APEXlang / SQLcl

Export app
apex export -applicationid 100 -exptype APEXLANG -dir ./app100
Import app
apex import -input ./app100/my-app
Connect
sql user/pwd@//host:1521/FREEPDB1

Quick SQL / PL-SQL

Top-N
FETCH FIRST 5 ROWS ONLY
Upsert
MERGE INTO t USING s ON (…) WHEN MATCHED THEN UPDATE … WHEN NOT MATCHED THEN INSERT …
Identity
id NUMBER GENERATED ALWAYS AS IDENTITY
Bulk
FORALL i IN ind.FIRST..ind.LAST INSERT …

Oracle DB AI snippets

Use profile
EXEC DBMS_CLOUD_AI.set_profile('HR_AI')
Ask
SELECT AI how many orders this month
Review SQL
SELECT AI showsql …
Vector top-5
ORDER BY VECTOR_DISTANCE(embedding, :q, COSINE) FETCH FIRST 5 ROWS ONLY

APEX AI quick refs

Enable
Workspace Utilities → Generative AI
Gen app
Create → Create App using Generative AI
Assistant
Page Designer → AI Assistant panel

Claude Code for Oracle developers

Run an AI coding agent against a real Oracle project without letting it near what it must not touch, and without burning tokens.

Safe agent setup

Deny destructive commands
.claude/settings.json → "permissions": { "deny": ["Bash(git push --force:*)", "Bash(rm -rf:*)"] }
Keep secrets unreadable
"deny": ["Read(./.env)", "Read(./**/wallet/**)"]
Protect the settings themselves
"deny": ["Edit(.claude/settings.json)"]
Hash-checked apply
sha256sum -c apply.sql.sha256 && sql -S $DB_CONN @apply.sql
DB user for the agent
Least-privilege schema user; no DBA, no SYS, no prod wallet

Multi-agent workflow

Lead
Owns the plan and the contracts; merges, never bulk-edits
Worker lanes
One lane per file set, so two writers never touch the same files
Reviewer
Adversarial: before a contract locks, when a test breaks twice, before done
Traffic controller
Queues merges, enforces lane limits, stops overlap
Done means
Tests run on a clean install, not "it compiled"

Token-saving rules

Right model per task
Large model to plan and review; smaller model for mechanical edits and searches
Focused check first
Run the one test you touched before the full suite
Retry limits in code
MAX_RETRIES = 2 in the script, not "try until it works" in the prompt
Small context
Point at files and line numbers; don't paste whole exports
Stop rule
Same failure twice → stop and call the reviewer

SQLcl + Liquibase

Capture schema
lb generate-schema -split
Preview SQL
lb update-sql -changelog-file controller.xml
Deploy
lb update -changelog-file controller.xml
Status
lb status -changelog-file controller.xml
Tag a release
lb tag -tag v1.2.0
Roll back last change
lb rollback-count -count 1 -changelog-file controller.xml
Roll back to tag
lb rollback -tag v1.2.0 -changelog-file controller.xml

SQLcl projects

Start a project (git repo)
project init -name myapp -schemas APP -makeroot
Export objects to src/
project export
Stage changes from the git diff
project stage
Cut the release
project release -version 1.2.0
Build the artifact
project gen-artifact -version 1.2.0
Deploy the artifact
project deploy -file artifact/myapp-1.2.0.zip
Clean-install test
Deploy every release into an empty schema before you ship