2 Oracle Database Architecture

Database Administration ยท Unit 2

Oracle Database Architecture

Exam-focused notes for Oracle Database Architecture (Database Administration, BIT352): what the TU syllabus asks and how it has actually been tested, with 3 solved past questions from this unit.

Oracle Database Architecture in short

Oracle Database architecture explains how the software, memory, processes and files work together. A DBA must know it to tune, back up and repair a database.

Oracle Database Architecture: full notes

Oracle database architecture overview

An Oracle server has two main parts: the instance and the database.

  • The instance is the set of memory structures and background processes. It lives in RAM and on the CPU.
  • The database is the set of files on disk: datafiles, control files and redo log files.

A user runs a tool such as SQL*Plus. A user process sends the request to a server process. The server process works on the instance and reads or writes the database files for the user.

User process --> Server process --> Instance (SGA + background processes)
                                          |
                                   Database files
                       (datafiles, control files, redo log files)

Other files help the system: the parameter file, password file, archived redo logs and alert log.

Oracle background processes

Background processes start with the instance. They do work for all users.

ProcessFull nameJob
DBWnDatabase WriterWrites changed (dirty) blocks from the buffer cache to datafiles
LGWRLog WriterWrites the redo log buffer to the online redo log files
CKPTCheckpointSignals DBWn at a checkpoint and updates control files and datafile headers
SMONSystem MonitorDoes instance recovery at startup and cleans unused temporary segments
PMONProcess MonitorCleans up after failed user processes and frees their locks
ARCnArchiverCopies filled redo log files to the archive location

LGWR writes when a user commits, when the buffer is one third full, and every three seconds. ARCn is optional and works only in ARCHIVELOG mode. Newer versions also have LREG, which registers services with the listener.

Memory structures and components

Oracle uses two main memory areas.

The System Global Area (SGA) is shared by all processes of the instance. Its main parts are:

  • Database buffer cache: holds copies of data blocks read from datafiles.
  • Shared pool: holds the library cache (parsed SQL and PL/SQL) and the data dictionary cache.
  • Redo log buffer: a circular buffer that holds change records before LGWR writes them.
  • Large pool, Java pool, Streams pool: optional areas for special jobs such as backup and Java code.

The Program Global Area (PGA) is private memory for one server process. It holds session data, sort space and bind variables.

You can see the SGA with this command.

SHOW SGA
SELECT name, ROUND(value/1024/1024) AS mb FROM v$sga;

Physical and logical structures

Physical structures are the files you see in the operating system.

  • Datafiles store the actual data.
  • Control files store the structure of the database.
  • Online redo log files store all changes made to data.

Logical structures decide how space is used inside the database. From largest to smallest:

  1. Tablespace: a logical container made of one or more datafiles.
  2. Segment: all the space used by one object, such as a table or index.
  3. Extent: a group of continuous data blocks given to a segment.
  4. Data block: the smallest unit of I/O, often 8 KB.

A tablespace holds many segments. A segment grows by adding extents. An extent is made of blocks.

Control files and contents

A control file is a small binary file that records the physical structure of the database. Oracle reads it at the MOUNT stage. Without it the database cannot open.

It stores:

  • Database name and creation time.
  • Names and locations of datafiles and redo log files.
  • Current log sequence number.
  • Checkpoint information.
  • Backup and archive log history.

Datafiles and tablespaces relationship

Each tablespace has at least one datafile. A datafile belongs to only one tablespace. A tablespace may have many datafiles, so it can grow by adding files.

SELECT tablespace_name, file_name, bytes/1024/1024 AS mb
FROM   dba_data_files
ORDER  BY tablespace_name;

The SYSTEM tablespace holds the data dictionary. SYSAUX holds helper data. User data is kept in separate tablespaces so the DBA can manage space and backup for each.

Key points to remember

  • An Oracle server is an instance (memory plus processes) plus a database (files).
  • DBWn writes dirty blocks, LGWR writes redo, CKPT marks checkpoints.
  • SMON recovers the instance and PMON cleans failed processes.
  • The SGA is shared; the PGA is private to one server process.
  • Physical files are datafiles, control files and redo log files.
  • Logical order is tablespace, segment, extent, block.
  • One datafile belongs to one tablespace; one tablespace can have many datafiles.
  • The control file records the structure of the database and is needed to mount it.

What this unit covers

  • Oracle database architecture overview
  • Oracle background processes
  • Memory structures and components
  • Physical and logical structures
  • Control files and contents
  • Datafiles and tablespaces relationship

Oracle database architecture overview

2081 ยท 10 marks

Explain architecture of oracle database with suitable diagram.[10]

Note: The reference notes did not contain this topic. The following answer is based on standard Oracle Database architecture as taught in Database Management Systems courses at TU BSc CSIT level. --- Oracle Database has a well-defined architecture that separates memory structures, process structu...

Open this answer on its own page โ†’

2080 ยท 10 marks

What do you mean by database management system? Mention the clear architecture of oracle database.[10]

Show solved answer

Database Management System (DBMS) and Oracle Database Architecture

What is a Database Management System (DBMS)?

A Database Management System (DBMS) is a collection of interrelated data and a set of programs to access and manage that data. It is software that acts as an interface between the user and the database, allowing users to create, retrieve, update, and delete data in an organized and efficient manner.

Key Characteristics of DBMS:

  • Data Abstraction: Hides the complexity of data storage from users
  • Data Independence: Changes in data structure do not affect application programs
  • Data Integrity: Ensures accuracy and consistency of data
  • Data Security: Provides access control and authorization mechanisms
  • Concurrent Access: Allows multiple users to access data simultaneously
  • Backup and Recovery: Provides mechanisms to recover data after failures

Examples:

Oracle, MySQL, PostgreSQL, Microsoft SQL Server, MongoDB


Oracle Database Architecture

Oracle Database has a well-defined architecture consisting of two major components:

Oracle Database = Instance + Database (Physical Files)


1. Oracle Instance

An Oracle Instance is a combination of Memory Structures and Background Processes that manage database files. It exists in RAM and is created when the database is started.

A. Memory Structures (SGA - System Global Area)

The System Global Area (SGA) is a shared memory region allocated when an Oracle instance starts. It contains:

ComponentDescription
Database Buffer CacheStores copies of data blocks read from datafiles; reduces disk I/O
Shared PoolContains Library Cache (parsed SQL, execution plans) and Data Dictionary Cache
Redo Log BufferRecords all changes made to the database before writing to redo log files
Large PoolOptional area for large memory allocations (backup, parallel queries)
Java PoolUsed for Java code and data in the JVM
Streams PoolUsed by Oracle Streams for data replication

Additionally, each user session has a PGA (Program Global Area) - a private memory area for individual server processes.

B. Background Processes

Oracle uses several background processes to manage the database:

ProcessFull NameFunction
SMONSystem MonitorPerforms instance recovery at startup; cleans temporary segments
PMONProcess MonitorCleans up failed user processes; releases locks and resources
DBWnDatabase WriterWrites modified (dirty) blocks from buffer cache to datafiles
LGWRLog WriterWrites redo log buffer entries to redo log files
CKPTCheckpointUpdates datafile headers and control files at checkpoints
ARCnArchiverCopies filled redo log files to archive log destination
RECORecovererResolves distributed transaction failures

2. Oracle Database (Physical Storage Structures)

The physical database consists of OS files stored on disk:

A. Datafiles (.dbf)

  • Store the actual data (tables, indexes, etc.)
  • Each database has one or more datafiles
  • Belong to a tablespace

B. Control Files

  • Small binary files that record the physical structure of the database
  • Contain database name, datafile locations, redo log file locations, and checkpoint information
  • Critical for database startup and recovery

C. Redo Log Files

  • Record all changes made to the database
  • Used for database recovery in case of failure
  • Oracle writes to redo log files in a circular fashion
  • At least two redo log groups are required

D. Archive Log Files (Optional)

  • Archived copies of filled redo log files
  • Used for complete media recovery
  • Required when database runs in ARCHIVELOG mode

E. Parameter File (SPFILE / PFILE)

  • Contains initialization parameters for the Oracle instance
  • Defines SGA size, number of processes, database name, etc.

F. Password File

  • Stores passwords for privileged users (SYSDBA, SYSOPER)

3. Logical Storage Structures

Oracle also has logical structures that map to physical storage:

Database
   โ””โ”€โ”€ Tablespace (SYSTEM, SYSAUX, USERS, TEMP, UNDO)
         โ””โ”€โ”€ Segment (Table Segment, Index Segment)
               โ””โ”€โ”€ Extent (collection of contiguous blocks)
                     โ””โ”€โ”€ Data Block (smallest unit, e.g., 8KB)

Oracle Architecture Diagram (Simplified)

+--------------------------------------------------+
|              ORACLE INSTANCE (RAM)               |
|  +--------------------+  +--------------------+  |
|  |   SGA              |  | Background         |  |
|  | - Buffer Cache     |  | Processes:         |  |
|  | - Shared Pool      |  | SMON, PMON, DBWn   |  |
|  | - Redo Log Buffer  |  | LGWR, CKPT, ARCn   |  |
|  | - Large Pool       |  |                    |  |
|  +--------------------+  +--------------------+  |
+--------------------------------------------------+
              |                    |
              v                    v
+--------------------------------------------------+
|           ORACLE DATABASE (DISK)                 |
|  Datafiles | Control Files | Redo Log Files      |
|  Archive Logs | Parameter File | Password File    |
+--------------------------------------------------+

Summary

ComponentLocationPurpose
SGAMemory (RAM)Shared data and SQL caching
PGAMemory (RAM)Per-session private data
Background ProcessesCPUAutomate database management tasks
DatafilesDiskPersistent data storage
Control FilesDiskDatabase structure metadata
Redo Log FilesDiskChange records for recovery

Note: The separation of Instance (memory + processes) and Database (disk files) is the fundamental design principle of Oracle, enabling features like crash recovery, high availability, and Oracle RAC (Real Application Clusters).

Open this answer on its own page โ†’

0 ยท 10 marks

Explain architecture of oracle database with suitable diagram. Explain different oracle background processes.[10]

Note: The reference notes did not contain this topic. The following answer is based on standard Oracle Database architecture as taught in Database Management Systems courses at TU BSc CSIT level. --- Oracle Database has a well-defined architecture consisting of two major components: 1. Oracle Ins...

Open this answer on its own page โ†’