0% found this document useful (0 votes)
164 views

Oracle Database Architecture & Processes

The document describes the architecture and components of Oracle databases. It discusses Oracle products like Oracle Database and Application Server. It then covers the primary components of an Oracle database - the database, instance, and Oracle server. It details the physical structures like datafiles, control files, and redo logs. It also explains the logical structures including tablespaces, extents, segments, and data blocks.

Uploaded by

shailuram
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views

Oracle Database Architecture & Processes

The document describes the architecture and components of Oracle databases. It discusses Oracle products like Oracle Database and Application Server. It then covers the primary components of an Oracle database - the database, instance, and Oracle server. It details the physical structures like datafiles, control files, and redo logs. It also explains the logical structures including tablespaces, extents, segments, and data blocks.

Uploaded by

shailuram
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 58

ORACLE DATABASE

ARCHITECTURE &
PROCESSES
Introduction
 Database is a collection of data treated as a
unit.
 The purpose of a database is to store and
retrieve related information.
 A database server is the key to solving the
problems of information management.

2
Oracle Products Family
 Oracle Database 10g
 Oracle Application Server 10g
 HTTP Server
 Forms and Reports
 Discoverer Plus and Viewer (BI Products)
 Portal and Wireless
 Oracle Developer Suite 10g
 Oracle Forms & Reports 9i
 Oracle Warehouse Builder 9i (ETL Tool)
 Oracle Discoverer Administrator/Desktop 9i
 Oracle JDeveloper

 Oracle Applications 11i (Oracle Apps) 3


Oracle Primary Components
 Database
- Oracle database consists of operating
system files, also known as database files,
that provide the actual physical storage for
database information.
 Instance
- Oracle instance is the combination of the
background processes and memory
structures.
 Oracle server
- consists of an Oracle instance and an Oracle
database.

4
Oracle Database Architecture
 The database has Physical structures and
Logical structures.
 The Physical and Logical structures are
separate.
 The Physical storage of data can be
managed without affecting the access to
logical storage structures.
5
Oracle Database Architecture

6
Oracle Processes

7
Oracle Database Physical Structures
 Datafile
 Control Files
 Redo Log Files
 Archive File
 Parameter File
 Log File (alert*.log, sqlnet.log,listener.log...)
 Trace File

8
Datafile
 Every Oracle database has one or more
physical datafiles.

 The datafiles contain all the database data.

 The data of logical database structures,


such as tables and indexes, is physically
stored in the datafiles allocated for a
database.

9
Datafile Characteristics

 A Datafile can be associated with only one


database.

 Datafiles can have certain characteristics set to


let them automatically extend when the
database runs out of space.

 One or more datafiles form a logical unit of


database storage called a tablespace.
10
Control Files
 A control file contains entries that specify the physical
structure of the database.

 It contains the following information:


 Database name

 Names and locations of datafiles and redo log files

 Time stamp of database creation

 Oracle can multiplex the control file, that is,


simultaneously maintain a number of identical control file
copies, to protect against a failure involving the control
file.

11
Redo log files &Archive Log Files
 Oracle has a set of two or more redo log files. The
set of redo log files is collectively known as the
redo log for the database.
 A redo log is made up of redo entries (also called
redo records).
 The primary function of the redo log is to record
all changes made to data.
 If a failure prevents modified data from being
permanently written to the datafiles, then the
changes can be obtained from the redo log, so
work is never lost.

12
Parameter Files

 Parameter files contain a list of configuration


parameters for that instance and database.
 Oracle recommends that you create a server
parameter file (SPFILE) as a dynamic means of
maintaining initialization parameters.
 A server parameter file lets you store and manage
your initialization parameters persistently in a
server-side disk file.

13
Alert and Trace Log Files
 Each server and background process can write to an
associated trace file.
 When an internal error is detected by a process, it dumps
information about the error to its trace file. Some of the
information written to a trace file is intended for the
database administrator, while other information is for
Oracle Support Services.
 Trace file information is also used to tune applications and
instances.
 The alert file, or alert log, is a special trace file. The alert
log of a database is a chronological log of messages and
errors.

14
Backup Files
 To restore a file is to replace it with a backup file. Typically,
you restore a file when a media failure or user error has
damaged or deleted the original file.

 User-managed backup and recovery requires you to actually


restore backup files before you can perform a trial recovery of
the backups.

 Server-managed backup and recovery manages the backup


process, such as scheduling of backups, as well as the recovery
process, such as applying the correct backup file when
recovery is needed.
15
Logical Database Structures
 Tablespaces

 Oracle Data Blocks

 Extents

 Segments

16
Tablespaces
 A database is divided into logical storage units
called tablespaces, which group related logical
structures together.
 Each database is logically divided into one or more
tablespaces.
 One or more datafiles are explicitly created for
each tablespace to physically store the data of all
logical structures in a tablespace.

17
Tablespaces
 Relationship between
tablespaces and datafiles
Database

System Tablespace USER Tablespace

DATA1.ORA DATA2.ORA
DATA3.ORA

18
Tablespaces
 Objects stored in tablespaces
Tablespace (one or more datafiles)

Table Table INDEX

INDEX INDEX INDEX INDEX


INDEX INDEX
INDEX Table
INDEX INDEX

Database Files Objects


(Physical structures associated (stored in tablespace may
with only one tablespace) span several datafiles)
19
Tablespaces in Oracle 10g
 SYSTEM
- Stores the data dictionary tables and PL/SQL code.
 SYSAUX
- Stores segments used for database options such as
the Automatic Workload Repository, Online
Analytical Processing (OLAP).
 TEMP
- Used for performing large sort operations. TEMP is
required when the SYSTEM tablespace is created as
a locally managed tablespace.
20
Tablespaces in Oracle10g
 TOOLS
- Used to store segments for non-application
management tools.
 USERS
- Used as the default tablespace for database
users.
 UNDOTBS1
- Used to store transaction information for
read consistency and recovery purposes.
21
Oracle Data Blocks
 At the finest level of granularity, Oracle database
data is stored in data blocks.
 One data block corresponds to a specific number
of bytes of physical database space on disk.
 The standard block size is specified by the
DB_BLOCK_SIZE initialization parameter.
 In addition, you can specify up to five other block
sizes. A database uses and allocates free database
space in Oracle data blocks.

22
Extents & Segments
 An extent is a specific number of contiguous data
blocks, obtained in a single allocation, used to
store a specific type of information.

 Segments Above extents, the level of logical


database storage is a segment.

 A segment is a set of extents allocated for a certain


logical structure.
23
Relationship Segments, Extents and
Blocks
 Relationship among Segments, Extents, and Blocks

Segment

Extent Extent
2K
2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
2K 2K 2K 2K
24

Database Blocks
Types of Segments

 Data segment

 Index segment

 Temporary segment

 Rollback segment

25
Data segment
 Each nonclustered table has a data segment. All
table data is stored in the extents of the data
segment.
 For a partitioned table, each partition has a data
segment.
 Each cluster has a data segment. The data of every
table in the cluster is stored in the cluster’s data
segment.

26
Index Segment

 Each index has an index segment that stores all of


its data.

 For a partitioned index, each partition has an


index segment.

27
Temporary Segment
 Temporary segments are created by Oracle when
a SQL statement needs a temporary database area
to complete execution.

 When the statement finishes execution, the extents


in the temporary segment are returned to the
system for future use.

28
Rollback segment

 The information in a rollback segment was used


during database recovery for generating read-
consistent database information and for rolling
back uncommitted transactions for users.

29
Relationship – Database, Tablespace
& Datafiles
 Each database is logically divided in to one or more
tablespaces.
 One or more datafiles are explicitly created for each
tablespace to physically store the data of all logical
structures in a tablespace.
 The combined size of the tablespace details is the
storage capacity of the tablespace.
 The combined storage capacity of a database
tablespaces is the total storage capacity of the
database.
30
Overview of Schemas and Common
Schema Objects
 SCHEMA
- Is a collection of Database Objects.
- Schema objects include structures like tables,
views, and indexes.
- There is no relationship between a tablespace
and a schema.
- Objects in the same schema can be in different
tablespaces, and a tablespace can hold objects
from different schemas.
31
Tables, Indexes and Views
 Tables are the basic unit of data storage in an
Oracle database.
 Indexes can be created to increase the
performance of data retrieval.
 Views are customized presentations of data in one
or more tables or other views.
 A view can also be considered a stored query.

32
Clusters & Synonyms
 Clusters are groups of one or more tables
physically stored together because they share
common columns and are often used together.
 A synonym is an alias for any table, view,
materialized view, sequence, procedure, function,
package, type, Java class schema object, user-
defined object type, or another synonym.

33
Data Dictionary
 Data dictionary is a set of tables and views that are used as
a read-only reference about the database.
 It stores information about both the logical and physical
structure of the database.
 A data dictionary also stores the following information:
 The valid users of an Oracle database.

 Information about integrity constraints defined for

tables in the database.


 The amount of space allocated for a schema object

and how much of it is in use.

34
Overview of the Oracle Instance
 An Oracle database server consists of an Oracle
database and an Oracle instance.
 Every time a database is started, a system global
area (SGA) is allocated and Oracle background
processes are started.
 The combination of the background processes and
memory buffers is called an Oracle instance.

35
Instance Memory Structures
 Oracle creates and uses memory structures to
complete several jobs.
 Two basic memory structures are associated with
Oracle: the system global area and the program
global area.
 System Global Area (SGA), which is shared by all
server and background processes.
 Program Global Areas (PGA), which is private to
each server and background process; there is one
PGA for each process.
36
SGA (System Global Area)
 A system global area (SGA) is a group of shared
memory structures that contain data and control
information for one Oracle database instance.
 If multiple users are concurrently connected to the
same instance, then the data in the instance’s SGA
is shared among the users.
 SGA is sometimes called the shared global area.
 Oracle automatically allocates memory for an
SGA when you start an instance.

37
SGA’s Memory Structures

 Database buffer cache


 Redo log buffer
 Shared pool
 Java pool
 Large pool
 Streams pool
 Data dictionary cache

38
SGA Data Structures
 Database Buffer Cache
- Caches the data that has been most recently
accessed by database users.
 Shared Pool
- Caches the most recently used SQL statements that
have been issued by database users.
 Redo Log Buffer
- Stores transaction information for recovery
purposes.

39
SGA Data Structures
 Java Pool
- Caches the most recently used Java objects and
application code.
 Large Pool
- Caches data for large operations such as Recovery
Manager (RMAN) backup and restore activities and
Shared Server components.
 Streams Pool
- Caches the data associated with queued message
requests.

40
PROGRAM GLOBAL AREA (PGA)
 PGA is a memory buffer that contains data and
control information for a server process. A server
process is a process that services a client’s
requests.

 A PGA is created by oracle when a server process


is started. The information in a PGA depends on
the oracle configuration.

 The PGA area is a non-shared area of memory


created by oracle when a server process is started.

41
Oracle Background Processes
 An Oracle database 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
system.
 The background processes consolidate functions
that would otherwise be handled by multiple
Oracle programs running for each user process.

42
Server Processes
 Oracle creates server processes to
handle requests from connected user
processes.
 A server process communicates with
the user process and interacts with
Oracle to carry out requests from the
associated user process.

43
Oracle Background Processes
 System Monitor (SMON)  Dispatcher (Dnnn)
 Process Monitor (PMON)  Shared Server (Snnn)
 Database Writer (DBWn)  Memory Manager
 Log Writer (LGWR) (MMAN)
 Checkpoint (CKPT)  Memory Monitor (MMON)
 Archiver (ARCn)  Memory Monitor Light
 Recoverer (RECO) (MMNL)
 Recovery Writer (RVWR)
 Job Queue Monitor
(CJQn)  Change Tracking Writer
 Job Queue (Jnnn) (CTWR)
 Queue Monitor (QMNn)
 Parallel Query Slave 44
(Qnnn)
Background Processes
 System Monitor (SMON)
 Performs instance recovery following an instance

crash, coalesces free space in the database, and


manages space used for sorting.

 Process Monitor (PMON)


 Cleans up failed user database connections.

 Database Writer
 Writes modified database blocks from the SGA’s

Database Buffer Cache to the datafiles on disk.

45
Background Processes
 Log Writer
 Writes transaction recovery information from the

SGA’s Redo Log Buffer to the online Redo Log files


on disk.
 Checkpoint
 Updates the database files following a Checkpoint

Event.
 Archiver
 Copies the transaction recovery information written

to disk by LGWR (log writer) to the online Redo Log


files and to a secondary location in case it is needed
for recovery.
46
Background Processes
 Recoverer
 Recovers failed transactions that are distributed
across multiple databases when using Oracle’s
distributed database feature.
 Job Queue Monitor
 Assigns jobs to the Job Queue processes when
using Oracle’s job scheduling feature.
 Job Queue
 Executes database jobs that have been scheduled
using Oracle’s job scheduling feature.
feature

47
Background Processes
 Queue Monitor
 Monitors the messages in the message queue when
Oracle’s Advanced Queuing feature is used.
 Parallel Query Slave
 Used to carry out portions of a larger overall query
when Oracle’s Parallel Query feature is used.
 Dispatcher
 Assigns user’s database requests to a queue where
they are then serviced by Shared Server processes
when Oracle’s Shared Server feature is used.
48
Background Processes
 Shared Server
 Server Processes that are shared among several
users when Oracle’s Shared Server feature is used.
 Memory Manager
 Manages the size of each individual SGA component
when Oracle’s Automatic Shared Memory
Management feature is used.
 Memory Monitor
 Gathers and analyzes statistics used by the
Automatic Workload Repository feature.
49
Background Processes
 Memory Monitor Light
 Gathers and analyzes statistics used by the
Automatic Workload Repository feature.
 Recovery Writer
 Writes recovery information to disk when Oracle’s
Flashback Database Recovery feature is used.
 Change Tracking Writer
 Keeps track of which database blocks have changed
when Oracle’s incremental Recovery Manager
feature is used.
50
User Processes

 A user process is used when a user runs an


application program.
 Runs the tool/application and is considered the
client.
 Passes SQL to the server process and receives the
results.

51
Server Processes
 A server process must place the data in the database buffer
cache
 Parse and execute SQL statements
 Read data blocks from disk into the shared database
buffers of the SGA
 Return the results of SQL statements to the user process
• Parse : check syntax, security access, object resolution,
optimization
• Execute : applies the parse tree to the data, perform a physical
read and change
• Fetch : Passes data to the user (only SELECT)

52
Oracle Network
 What is TNS?
 Transparent Network Substrate.
 Oracle’s Network applications to access the underlying

network protocol transparently.


 TNS-based application, Oracle Protocol Adapters,

Network software like TCP/IP.

 Configuration File
 LISTENER.ORA ( Server )
 TNSNAMES.ORA (Server ,Client )

 SQLNET.ORA (Server ,Client )


53
SQL*Net Configuration
TNSNAMES.ORA  LISTENER.ORA
info = LISTENER=
(ADDRESS_LIST=
(DESCRIPTION= (ADDRESS=
(ADDRESS_LIST= (PROTOCOL=tcp)
(HOST=local host)
(ADDRESS= (PORT=1521)
)
(PROTOCOL=tcp) )
(HOST=local host) SID_LIST_LISTENER=
 SQLNET.ORA (SID_LIST=
(PORT=1521) # SQLNET.EXPIRE_TIME = 0 (SID_DESC=
) (SID_NAME=BRBINFO1)
SQLNET.AUTHENTICATION_S
(ORACLE_HOME=/oracle/oracle10)
) ERVICES=(none, beq)
(ENVS='EPC_DISABLED=TRUE')
(CONNECT_DATA= )
)
(SID=SIDNAME) STARTUP_WAIT_TIME_LISTENER=0
CONNECT_TIMEOUT_LISTENER=0
) LOG_DIRECTORY_LISTENER=/oracle/oracle10/
network/log
)
LOG_FILE_LISTENER=listener
TRACE_LEVEL_LISTENER=OFF

54
How Oracle Works?
 An instance has started on the computer running Oracle (often called
the host or database server).

 A computer running an application (a local computer or client


workstation) runs the application in a user process.

 The client application attempts to establish a connection to the server


using the proper Oracle Net Services driver.

 The server is running the proper Oracle Net Services driver.

 The server detects the connection request from the application and
creates a dedicated server process on behalf of the user process.

55
How Oracle Works?
 The user runs a SQL statement and commits the transaction. For
example, the user changes a name in a row of a table.

 The server process receives the statement and checks the shared pool
for any shared SQL area that contains a similar SQL statement.

 If a shared SQL area is found, then the server process checks the
user’s access privileges to the requested data, and the previously
existing shared SQL area is used to process the statement.

 If not, then a new shared SQL area is allocated for the statement, so it
can be parsed and processed.

 The server process retrieves any necessary data values from the actual
datafile (table) or those stored in the SGA.

56
How Oracle Works?
 The server process modifies data in the system global area. The DBWn
process writes modified blocks permanently to disk when doing so is
efficient.

 Because the transaction is committed, the LGWR process immediately


records the transaction in the redo log file.

 If the transaction is successful, then the server process sends a message


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

 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.
57
Any
Queries?
?
58

You might also like