You are on page 1of 40

Oracle Database

Architecture – Part 1
SCSP 3713
DATABASE ADMINISTRATION
Semester 1 2021/2022
Objectives
After completing this lesson, you should be
able to:
• List the major architectural components of Oracle
Database
• Explain the memory structures
• Describe the background processes
• Correlate the logical and physical storage
structures

2
25-Nov-20
Introduction

• The Oracle relational database management


system (RDBMS) provides an open,
comprehensive, integrated approach to
information management
• Prevents unauthorized access by implementing
various security features
• Implements a complete solution for recovering
from failure

3
25-Nov-20
Oracle Database
Architecture: Overview
Instance

SMON PMON RECO Others

SGA
Shared pool
Library
Database cache
Redo log
buffer
buffer
cache Data dictionary
cache
PGA
Server
DBWn CKPT LGWR ARCn
process

User Archived
process Control Online redo log files
Data files files log files
Database

4
25-Nov-20
Oracle Database Architecture:
Overview (cont.)
• An Oracle database server consists of an
Oracle database and one or more database
instances
• The instance consists of memory structures and
background processes.
• Every time an instance is started, a shared memory area
called the System Global Area (SGA) is allocated and the
background processes are started.

5
25-Nov-20
Oracle Database Architecture:
Overview (cont.)
• The database consists of both physical structures
and logical structures.
• Because the physical and logical structures are
separate, the physical storage of data can be
managed without affecting access to logical storage
structures.

6
25-Nov-20
Connecting to the Database:
Connection VS Session
• Connection: Communication pathway between a
user process and an instance
• A communication pathway is established using
available interprocess communication mechanisms (on
a computer that runs both the user process and Oracle
Database) or network software (when different
computers run the database application and Oracle
Database and communicate through a network).
7
25-Nov-20
Connecting to the Database:
Connection VS Session (cont.)
• Session: Specific connection of a user to an
instance through a user process
• represents the state of a current user login to the
database instance
• For example, when a user starts SQL*Plus, the user must
provide a valid username and password, and then a
session is established for that user
• A session lasts from the time a user connects until
the user disconnects or exits the database
application

8
25-Nov-20
Connecting to the Database:
Connection VS Session (cont.)

User Server
User SQL> Select … process process
Session

Connection

Session

9
25-Nov-20
Connecting to a Server: Methods

• A database user can connect to an Oracle server in one


of three ways:
1. Bequeth protocol  The user logs on to the operating
system running the Oracle instance and starts an application
or tool that accesses the database on that system.
• The communication pathway is established using the
interprocess communication mechanisms available on the host
operating system.

10
25-Nov-20
Connecting to a Server: Methods
(cont.)
2. Client-Server  The user starts the application or tool on a
local computer and connects over a network to the computer
running the Oracle database
• In this configuration, network software is used to communicate
between the user and the back-end server.

• The client/server architecture database system has two parts: a


front end (client) and a back end (server) connected through a
network. Network software is used to communicate between the
user and the Oracle server.

11
25-Nov-20
Connecting to a Server: Methods
(cont.)
2. Client-Server (continue)
• The client is a database application that initiates a request for an
operation to be performed on the database server. It requests,
processes, and presents data managed by the server. The client
workstation can be optimized for its job. For example, the client
might not need large disk capacity, or it might benefit from
graphic capabilities. Often, the client runs on a different
computer than the database server. Many clients can
simultaneously run against one server.

12
25-Nov-20
Connecting to a Server: Methods
(cont.)
2. Client-Server (continue)
• The server runs Oracle Database software and handles the functions
required for concurrent, shared data access. The server receives and
processes requests that originate from client applications. The computer that
manages the server can be optimized for its duties. For example, the server
computer can have large disk capacity and fast processors.

CLIENT-SERVER
Client ARCHITECTURE Server
13
25-Nov-20
Connecting to a Server: Methods
(cont.)
3. N-tier System  The user accesses an application server
through a tool (such as a Web browser) on the local
computer (client). The application server then interacts with
a back-end database server on behalf of the client.
• A traditional multitier architecture has the following
components  client, application server, database
server
• A client or initiator process that starts an operation

14
25-Nov-20
Connecting to a Server : Methods (cont.)
3. N-tier System (continue)
• One or more application servers that perform parts of the operation. An
application server contains a large part of the application logic, provides access
to the data for the client, and performs some query processing, thus removing
some of the load from the database server. The application server can serve as
an interface between clients and multiple database servers and can provide an
additional level of security.

• An end server or database server that stores most of the data used in the
operation

Server

Client Middle tier

15
25-Nov-20
Interacting with an Oracle Database
Instance
User Server
process process SGA
Shared pool
Library
Database cache
Redo log
buffer
buffer
cache Data dictionary
cache

DBWn CKPT LGWR SMON PMON ARCn RECO Others

User

16
25-Nov-20
Interacting with an Oracle Database

• The following example describes Oracle database


operations at the most basic level. It illustrates an
Oracle database configuration in which the user and
associated server process are on separate computers,
connected through a network.
1. An instance has started on a node where Oracle
Database is installed, often called the host or database
server

17
25-Nov-20
Interacting with an Oracle Database
(cont.)

2. A user starts an application spawning a user process. The


application attempts to establish a connection to the server.
(The connection may be local, client/server, or a three-tier
connection from a middle tier.)

3. The server runs a listener that has the appropriate Oracle


Net Services handler. The listener detects the connection
request from the application and creates a dedicated server
process on behalf of the user process.

18
25-Nov-20
Interacting with an Oracle Database
(cont.)
4. The user runs a DML-type SQL statement and commits the
transaction. For example, the user changes the address of a
customer in a table and commits the change.

5. The server process receives the statement and checks the shared
pool (an SGA component) for any shared SQL area that contains
an identical SQL statement. If a shared SQL area is found, the
server process checks the user’s access privileges to the
requested data, and the existing shared SQL area is used to
process the statement. If a shared SQL area is not found, a new
shared SQL area is allocated for the statement so that it can be
parsed and processed.
19
25-Nov-20
Interacting with an Oracle Database(cont.)

6. The server process retrieves any necessary data values,


either from the actual data file (table) or from values stored
in the Database buffer cache.

7. The server process modifies data in the SGA. Because the


transaction is committed, the LogWriter process (LGWR)
immediately records the transaction in the redo log file. The
Database Writer process (DBWn) writes modified blocks
permanently to disk when it is efficient to do so.

20
25-Nov-20
Interacting with an Oracle Database
(cont.)

8. If the transaction is successful, the server process sends a


message across the network to the application. If it is not
successful, an error message is transmitted.

9. Throughout this entire procedure, the other background


processes run, watching for conditions that require
intervention. In addition, the database server manages
other users’ transactions and prevents contention between
transactions that request the same data.

21
25-Nov-20
Oracle Database Server Structures
Instance
Memory structures SGA
Shared pool
Library
Database cache
User Server Redo log
buffer
process process buffer
cache Data dictionary
cache

Processes DBWn CKPT LGWR SMON PMON ARCn RECO Others

Database

Storage structures

Control Online redo


Data files files log files

22
25-Nov-20
Oracle Database Server Structures

• After starting an instance, the Oracle software


associates the instance with a specific database. This
is called mounting the database.
• The database is then ready to be opened, which makes it
accessible to authorized users. Multiple instances can
execute concurrently on the same computer, each accessing
its own physical database

23
25-Nov-20
Oracle Database Server Structures

• An Oracle instance uses memory structures and processes to


manage and access the database.
• All memory structures exist in the main memory of the
computers that constitute the database server.
• Processes are jobs that work in the memory of these
computers.
• A process is defined as a “thread of control” or a mechanism
in an operating system that can run a series of steps

24
25-Nov-20
Oracle Database
Memory Structures
Server Server Background
process 1
PGA process 2
PGA
process
PGA

Data dictionary SGA


Shared
cache
SQL area

Library Other
cache

Redo log Shared pool


buffer
Free
Database buffer I/O buffer
memory
cache
Response Request
Java pool Streams queue queue
pool Large pool

25
25-Nov-20
Oracle Database
Memory Structures
• Oracle database creates and uses memory
structures for various purposes.
• For example, memory stores program code being
run, data that is shared among users, and private
data areas for each connected user.

26
25-Nov-20
Oracle Database
Memory Structures: SGA
• Two basic memory structures are associated with an instance 
SGA, PGA:

• System Global Area (SGA):


• Group of shared memory structures, known as SGA components, that
contain data and control information for one Oracle Database instance. The
SGA is shared by all server and background processes. Examples of data
stored in the SGA include cached data blocks and shared SQL areas

• When you start the instance by using Enterprise Manager or SQL*Plus, the
amount of memory allocated for the SGA is displayed.

27
25-Nov-20
Oracle Database
Memory Structures : SGA (cont)
– The SGA is the memory area that contains data and control
information for the instance. The SGA includes the following
data structures:
1. Database buffer cache

2. Redo log buffer

3. Shared pool

4. Large pool

5. Java pool

6. Streams pool

28
25-Nov-20
Oracle Database
Memory Structures: SGA (cont)
• DESCRIBE THE PURPOSE OF EACH SGA DATA
STRUCTURE

29
25-Nov-20
Oracle Database
Memory Structures : PGA
– Program Global Areas (PGA):
• Memory regions that contain data and control information
for a server process or a background process.
• A PGA is nonshared memory created by Oracle Database
when a server or background process is started.
• Access to the PGA is exclusive to the server process. Each
server process and background process has its own PGA.

30
25-Nov-20
Oracle Database
Memory Structures: PGA
(cont)
• User process
• This process is started when a user or job starts an application
• User process can run either on the client, middle tier or the
database server
• Database processes
• Server process: Connects to the Oracle instance and is started
when a user establishes a session
• Server process configuration can be dedicated or shared server
• Background processes: Are started when an Oracle instance is
started

31
25-Nov-20
PGA: DB Process Structures
Server Server Server Server Server
Server n
processes

SGA
Shared pool
Library
Database
Redo log cache
buffer
buffer
SGA
cache
Data dictionary
cache

CKPT RECO PMON SMON DBWn LGWR ARCn Others


Oracle
background
processes

32
25-Nov-20
PGA: Background Processes
• The background processes include the following:
• Database writer process (DBWn)
• Log writer process (LGWR)
• Checkpoint process (CKPT)
• System Monitor process (SMON)
• Process monitor process (PMON)
• Recoverer process (RECO)
• Job queue processes
• Archiver processes (ARCn)
• Queue monitor processes (QMNn)

33
25-Nov-20
PGA: Background Processes
• DESCRIBE THE PURPOSE OF EACH PGA
BACKGROUND PROCESSES

34
25-Nov-20
Logical and Physical Database
Structures
Logical Physical
Database

Schema Tablespace Data file

Segment

Extent

Oracle data
OS block
block

35
25-Nov-20
Tablespaces and Data Files
• Tablespaces are logical structures which consist of one or
more data files.
• Data files are the physical structures which belong to only
one tablespace.
• Each tablespace must have minimum of one datafile

Data file 1 Data file 2

USERS tablespace
36
25-Nov-20
Tablespaces and Data Files
http://docs.oracle.com/cd/B19306_01/server.102/b14220/physical.htm

one tablespace that


contains two datafiles.
The datafiles area the
physical structures
associated with only
one tablespace. Inside
the datafiles are
objects, like tables
and indexes. Objects
stored in tablespaces
can span several
datafiles

37
25-Nov-20
SYSTEM and SYSAUX
Tablespaces
• The SYSTEM and SYSAUX tablespaces are mandatory
tablespaces that are created at the time of database
creation. They must be online and available for read and
write operations.
• The SYSTEM tablespace is used for core functionality (for
example, store data dictionary tables).
• The auxiliary SYSAUX tablespace is used for additional
database components (such as the Enterprise Manager
Repository and Automatic Workload Repository (AWR)
snapshots).

38
25-Nov-20
Segments, Extents, and
Blocks
• Segments exist in a tablespace.
• Segments are collections of extents.
• Extents are collections of data blocks.
• Data blocks are mapped to disk blocks.

Segment Extents Data Disk blocks


blocks

39
25-Nov-20
Summary
• In this lesson, you should have learned how to:
• List the major architectural components of Oracle
Database
• Explain the memory structures
• Describe the background processes
• Correlate the logical and physical storage structures

40
25-Nov-20

You might also like