Chapter 02 · Instance Architecture: SGA, PGA, Processes, Sessions, and Startup/Shutdown
Oracle Instance vs Database, SGA Components, Background Processes, and Physical Files
Understand the Oracle instance as SGA plus background processes, map memory workers to physical files, and prove each boundary with current dynamic-view evidence.
Learning outcomes
Chapter 01 established the ServiceHub lab in
FREEPDB1 with separate owner/runtime identities.
Now an operator sees “Oracle is up” and assumes that means every
required part of the database is healthy. That phrase hides the
mechanisms that matter during recovery and performance
incidents: the database is persistent files and
metadata, while the instance is memory plus
processes that open and operate those files.
Distinguish an Oracle instance from the database it opens and identify the major physical-file categories behind that boundary.
Explain the buffer cache, shared pool, redo log buffer, and other System Global Area (SGA) components as working memory rather than a memorization list.
Connect DBWn, LGWR, CKPT, SMON, PMON, LREG, and other current background processes to observable work and failure evidence.
Use V$INSTANCE, V$SGAINFO, V$PROCESS, V$CONTROLFILE, V$DATAFILE, and V$LOGFILE to build an architecture evidence card.
Diagnose why “the instance is started” does not prove that the database is mounted/open, PDBs are open, or listener services are registered.
Use the disposable Oracle AI Database Free 26ai environment from Chapter 01. Administrative queries should be run from a dedicated SYSDBA connection in the database host/container. Do not change files, redo groups, memory settings, or background-process parameters in this lesson.
1. Database and instance are deliberately separate
An Oracle database is the durable collection of control files, datafiles, and online redo log files plus the logical structures represented by those files. An Oracle instance is the System Global Area (SGA) and Oracle processes/threads that operate a database. Starting an instance allocates memory and starts background processes. Mounting a database makes the instance read the control-file metadata; opening the database makes the datafiles and redo structures available for normal database access. Lesson 4 will exercise those states explicitly.
The distinction is not academic. In Oracle Real Application Clusters (RAC), several instances can open the same database. Even on this single-instance Free lab, a failed startup can leave you with no instance, a NOMOUNT instance, a mounted database, an open CDB with a closed PDB, or an open database whose service is not reachable through the listener. “Oracle is running” is therefore an incomplete incident statement.
SELECT instance_name, host_name, status, database_status, version, version_full, startup_time, loginsFROM v$instance;SELECT name, dbid, open_mode, database_role, log_mode, cdbFROM v$database;SELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name, SYS_CONTEXT('USERENV','CON_ID') AS con_id, SYS_CONTEXT('USERENV','SERVICE_NAME') AS service_nameFROM dual;
In a normally open Free lab you should see an
OPEN instance and a
READ WRITE database. The exact names, host, startup
timestamp, service, and version are environment evidence—not
constants to copy from a screenshot.
2. SGA: shared working memory for the instance
The System Global Area (SGA) is shared memory that server and background processes can access. The database buffer cache holds copies of database blocks; modifying a cached block makes it dirty, but the block does not have to be written to its datafile at commit time. The shared pool contains structures such as library-cache and data-dictionary information used while parsing and executing SQL. The redo log buffer stages redo entries before LGWR writes them to the online redo log. Other pools and dynamic components appear according to configuration and workload.
Those components solve different problems. A cache hit avoids a physical block read, but the buffer cache is not durable storage. A shared SQL area can be reused by sessions, but it is not a transaction log. Redo records changes needed for recovery, but redo does not replace datafiles or backups. Treating all SGA memory as “cache” obscures why different pressure signals have different remedies.
SELECT name, bytes, resizeableFROM v$sgainfoORDER BY name;SELECT component, current_size, min_size, max_size, user_specified_size, oper_count, last_oper_typeFROM v$sga_dynamic_componentsWHERE current_size > 0ORDER BY current_size DESC;
These views describe allocation and resize history. They do not prove that a different memory size would improve ServiceHub. Oracle AI Database Free is capped at 2 GB combined SGA and PGA, so this course never extrapolates Free memory observations into a universal production sizing rule.
3. Background processes are workers, not a trivia list
Oracle creates mandatory and optional background processes
according to the instance configuration and enabled features.
Current 26ai documentation defines a background process as a row
in V$PROCESS with a non-null PNAME.
Some environments can run many Oracle activities as
operating-system threads rather than separate processes, so an
OS process list alone is not the authoritative architecture
inventory.
| Process | Mechanism | Why an operator cares |
|---|---|---|
| DBWn | Writes modified database blocks from the buffer cache to datafiles. | Dirty buffers can exist safely before DBWn writes them; commit durability is primarily a redo/LGWR concern. |
| LGWR | Writes redo entries from the redo log buffer to online redo logs. | Commit latency and redo I/O problems often surface around LGWR, but log design is covered later. |
| CKPT | Coordinates checkpoints and updates control files/datafile headers with checkpoint information. | CKPT does not write all dirty database blocks itself; it signals DBWn and records checkpoint progress. |
| SMON | Performs system-level maintenance such as undo/data-dictionary cleanup and, in RAC contexts, can recover a failed instance. | Do not use an obsolete one-line “SMON always performs startup recovery” slogan as a complete recovery model. |
| PMON | Scans for abnormally terminated processes and coordinates cleanup, assisted by current cleanup processes. | Modern Oracle separates monitoring/coordination from some cleanup work; old diagrams can be misleading. |
| LREG | Registers instance, service, handler, and endpoint information with listeners. | A running database with missing listener registration can be healthy internally but unreachable by a normal service connect. |
| MMON/MMNL | Perform manageability/metric work. | Diagnostics-related features can have licensing implications in production offerings; presence is not entitlement. |
SELECT pname, program, pid, spid, pga_used_mem, pga_alloc_memFROM v$processWHERE pname IS NOT NULLORDER BY pname;
Your list can contain far more processes than the table. That is expected: features, worker pools, maintenance tasks, multitenant behavior, and platform details influence what runs. Learn the request path first, then investigate a process when evidence points to it.
4. Connect memory workers to physical files
The instance does not persist useful database state by itself. It opens physical files. Control files hold structural and recovery metadata; datafiles store database blocks belonging to tablespaces; online redo log members store redo used for crash/instance recovery and other recovery mechanisms. Chapter 03 expands blocks, extents, segments, tablespaces, and ASM. Chapter 14 expands redo, undo, checkpoints, and recovery.
SELECT name, statusFROM v$controlfileORDER BY name;SELECT file#, name, status, enabledFROM v$datafileORDER BY file#;SELECT group#, member, type, statusFROM v$logfileORDER BY group#, member;
Do not infer safety from row counts. One control-file row is not evidence of an acceptable multiplexing strategy, a visible datafile is not evidence of a usable backup, and online redo members are not archived redo. This lesson only builds the map.
5. Failure case: the instance is OPEN, therefore clients must be able to connect
This conclusion is wrong because client reachability has another boundary. The Oracle Net listener is a separate process. The Listener Registration process (LREG) registers instance/service/handler information dynamically. If the listener is stopped or registration is stale, an existing local administrative session may show an open database while remote application connections fail.
SELECT name, network_name, pdb, con_idFROM v$servicesORDER BY name;ALTER SYSTEM REGISTER;
ALTER SYSTEM REGISTER requests immediate service
registration; it is useful after a listener starts, but it is
not a magic fix for an incorrect connect descriptor, firewall,
listener endpoint, service definition, or closed PDB. Verify
both sides with V$SERVICES and
lsnrctl services. If the listener is intentionally
down, start it according to the platform/container procedure
rather than repeatedly registering from the database.
6. Hands-on lab: build an instance architecture evidence card
Run the following while connected as SYSDBA to the disposable Free database. Keep the output with your Chapter 01 environment manifest. This is a read-only lab except for the harmless registration request above.
SELECT SYSTIMESTAMP AS observed_at FROM dual;SELECT instance_name, host_name, status, database_status, version_full, startup_time, loginsFROM v$instance;SELECT name, open_mode, database_role, log_mode, cdbFROM v$database;SELECT SYS_CONTEXT('USERENV','CON_NAME') AS con_name, SYS_CONTEXT('USERENV','SERVICE_NAME') AS service_nameFROM dual;SELECT name, ROUND(bytes/1024/1024,1) AS mbFROM v$sgainfoWHERE bytes IS NOT NULLORDER BY bytes DESC;SELECT pname, program, spidFROM v$processWHERE pname IS NOT NULLORDER BY pname;SELECT name, network_name, pdbFROM v$servicesORDER BY name;
Verification checklist:
- You can identify the running instance separately from the database it opens.
- You can name the current CDB/PDB and service context.
- You can describe what the buffer cache, shared pool, and redo log buffer are for without calling all of them “disk cache.”
- You can point to DBWn, LGWR, CKPT, PMON, SMON, and LREG in current process evidence when they are present.
- You can list control files, datafiles, and online redo members without modifying them.
-
You can explain why listener reachability is not proved by
V$INSTANCE.STATUS='OPEN'.
7. Production judgment
Do not tune SGA subcomponents or background-process counts from
folklore. Record workload, RU, COMPATIBLE, memory
limits, platform, current parameter values, and wait/I/O
evidence before changing anything. Oracle AI Database Free’s 2
GB combined SGA/PGA ceiling makes it a learning environment, not
a production sizing oracle. Hidden/underscore parameters are
outside normal self-directed tuning and should be changed only
under explicit Oracle Support guidance.
When an incident begins, separate the layers: instance memory/processes, mounted/open database state, PDB state, physical-file state, and listener/service reachability. The next lesson zooms in on foreground/server processes and PGA memory so one client connection no longer gets confused with one immutable OS process.
8. Summary and next step
The Oracle instance is SGA plus processes/threads; the database is persistent files and metadata. Shared memory is partitioned by purpose, background processes cooperate to move blocks/redo, coordinate checkpoints and maintenance, and register services, while the listener remains a separate network component. You now have the evidence vocabulary needed to reason about the process model instead of treating “Oracle is running” as a diagnosis.
Check your understanding
- Why does commit not require DBWn to write every modified database block immediately?
- What is the difference between CKPT and DBWn during a checkpoint?
- Why can an open database still be unreachable by a normal application service?
- What does a non-null PNAME in V$PROCESS tell you?
- Why should Oracle AI Database Free memory behavior not be generalized into a production SGA/PGA formula?
Review the answers
Oracle durability relies on redo being written according to commit rules; dirty database blocks can be written later by DBWn and recovered using redo if needed.
CKPT coordinates checkpoint progress and updates control-file/datafile-header metadata; DBWn performs the database-block writes.
Listener/service registration and network reachability are separate boundaries. LREG may not have registered a service, the listener can be down, or the connect/network configuration can be wrong.
Current Oracle documentation defines that row as an Oracle background process. The exact process set depends on platform and enabled features.
Free has a documented 2 GB combined SGA/PGA cap and is not representative of arbitrary production workload, concurrency, storage, or licensed-feature conditions.
Authoritative references
- Oracle AI Database Concepts — Memory Architecture — SGA/PGA/UGA/MGA architecture
- Oracle AI Database Reference — Background Processes — current background-process roles
- Oracle AI Database Concepts — database, instance, physical storage, and process concepts
- Oracle Net Services Administrator’s Guide — Service Registration — LREG, services, handlers, and listener registration
- Oracle AI Database Free FAQ — current Free resource/support boundaries