Overview

An Oracle database is the set of files on disk (data files, redo logs, control files); an instance is the set of memory structures and background processes that open it. Clients talk to a listener, which hands the connection to a server process. Everything here was verified on Oracle AI Database 26ai Free 23.26.4 (the product formerly named 23ai) in a Docker container (gvenzl/oracle-free:23-slim), with compatible = 23.6.0.

Why it matters

Tuning, backup and diagnosis all refer to these components: SGA caches, redo, undo, background processes and the container model.

Core concepts

flowchart TB
  L[Listener 1521] --> SP[Server process per session]
  SP --> SGA
  subgraph SGA[SGA shared memory]
    BC[Buffer cache]
    SP2[Shared pool: library cache, dictionary cache]
    RB[Redo log buffer]
  end
  subgraph BG[Background processes]
    LGWR
    DBWn
    CKPT
    SMON
    PMON
    ARCn
  end
  RB --> LGWR --> RL[(Online redo logs)]
  BC --> DBWn --> DF[(Data files)]
  RL --> ARCn --> AL[(Archived logs)]
  • SGA (System Global Area): buffer cache (data blocks), shared pool (parsed SQL and dictionary), redo log buffer. PGA (Program Global Area) is private memory per server process for sorts, hashes and session state.
  • Background processes: DBWn writes dirty blocks, LGWR writes redo at commit and on a schedule, CKPT signals checkpoints, SMON does instance recovery and cleanup, PMON cleans up failed sessions, ARCn copies filled redo logs to archive.
  • Dedicated server (one server process per session, the default) vs shared server; Database Resident Connection Pooling (DRCP) reduces process count for many short sessions.
  • Multitenant: a container database (CDB) holds the root (CDB$ROOT), a seed and one or more pluggable databases (PDB). Applications normally connect to a PDB service (oracle-multitenant).
  • The data dictionary (DBA_*, ALL_*, USER_* views) and dynamic performance views (V$*) expose metadata and live state.
  • A SCN (system change number) is the database’s logical clock; read consistency, recovery and flashback are all SCN-based (oracle-redo-undo).

Worked example

Instance facts from the test container:

SELECT banner_full FROM v$version;
-- Oracle AI Database 26ai Free Release 23.26.4.0.0 - Develop, Learn, and Run for Free
SELECT name, cdb FROM v$database;                -- FREE | YES
SELECT con_id, name, open_mode FROM v$pdbs;      -- PDB$SEED (read only), FREEPDB1 (read write)
SELECT name, ROUND(value/1024/1024) mb FROM v$sga;
-- Fixed Size 5 | Variable Size 592 | Database Buffers 928 | Redo Buffers 4
SELECT name, value FROM v$parameter
 WHERE name IN ('sga_target','pga_aggregate_target','processes','cpu_count','db_block_size','undo_retention');
-- sga_target 1.5 GB, pga_aggregate_target 512 MB, processes 200, cpu_count 2, block size 8192, undo_retention 900

The container was started with NOARCHIVELOG mode, 10 MB online redo log groups and the tablespaces SYSTEM, SYSAUX, TEMP, UNDOTBS1 and USERS. Oracle’s published limits for the Free edition include two CPU threads, 2 GB of memory and 12 GB of user data; check the current licensing page.

Pitfalls and production notes

  • Production databases must run in ARCHIVELOG mode (and usually with a fast recovery area) for point-in-time recovery (oracle-rman-backup).
  • Size SGA_TARGET/MEMORY_TARGET and PGA_AGGREGATE_TARGET from workload evidence; do not leave huge defaults on shared hosts.
  • Always use bind variables to share cursors in the shared pool; literals flood it with one-off SQL.
  • Feature and option availability depends on edition and license (Free, Standard, Enterprise, option packs). Check before relying on a feature in a design.

Practice questions

  1. What is the difference between an instance and a database?
  2. Which process writes at COMMIT, and which writes dirty data blocks?
  3. Why do you connect to a PDB service rather than the root for application work?

References

oracle-storage-tablespaces · oracle-redo-undo · oracle-multitenant · sqlserver-architecture · pg-architecture