Sie sind auf Seite 1von 5

The Oracle

DBMS Architecture:
BY DANIEL D. KITAY
A Technical Introduction

As more and more database


and system administrators TODAY’S database and system
administrators must sup-
port more and more Database Management
Global Area (PGA), both of which are
discussed later.
Typically, during server startup a data-
support multiple DBMSes, Systems (DBMSes) from different vendors base is immediately mounted and opened
running on various hardware and operating to allow user and application access.
it’s important to understand system platforms. One of these DBMSes is Mounting a database is the process of asso-
the Oracle 7 server. ciating a database with the started Oracle
the architecture of the system To effectively administer Oracle 7 servers server’s background processes and allocated
and its components. and the databases accessed, it’s important memory structures. Although DB2 supports
to understand the Oracle 7 server archi- multiple databases accessible from a single
This article introduces tecture. This article examines the Oracle 7 subsystem, the Oracle 7 server supports
server architecture and its major components. access only to a single database at a time.
the reader to the Oracle DBMS. It is intended to benefit new Oracle program- When a database is mounted, the instance
mers, DBAs, system administrators and finds and opens its control files. The control

© 1996 Candle Corporation. Reprinted with permission. All rights reserved. International copyright secured.
their managers. files specify the names of the database’s
Although it is impossible to describe data files and redo log files. A database can
all of the features and components of the be mounted in either exclusive or parallel
Oracle 7 server in just one article, the fol- mode. Parallel mode allows an Oracle
lowing essential topics are discussed: Parallel Server (OPS) environment to exist
by allowing multiple Oracle servers across
◆ instance and database startup; multiple machines to mount the same
◆ instance and application processes; shared database.
◆ server memory structures; Opening a mounted database is the
◆ server and database files; and process of making the database available
◆ performance monitoring and tuning. for normal database operations. When an
instance opens a database, one or more
INSTANCE AND DATABASE STARTUP rollback segments are acquired so that the
As depicted in Figure 1, an Oracle server instance can handle rollback information
instance is the combination of server back- produced by subsequent transaction exe-
ground processes and memory structures cutions. At this point, any valid user can
that allow database data to be stored, connect to the database and access or
managed and accessed by users. During change information. When the database is
Oracle server startup, an init.ora configu- opened, the online data and redo log files
ration file (similar to DB2’s DSNZPARM) are also opened. An instance can also be
is read in and a number of background started in (or later, dynamically altered to
processes are created that perform specific be in) restricted mode so that when the
database and server functions. The process database is open, connections are limited
of starting an instance includes the allocation only to those whose user accounts have
of several memory structures, including the been granted the RESTRICTED SESSION
System Global Area (SGA) and Program system privilege.

TECHNICAL SUPPORT February ‘97 http://www.naspa.net


S Y S T E M S
Figure 1: Oracle 7 Architecture: Processes, Memory and Files process. The shared server process per-
RECO
forms the same function as a dedicated
SMON PMON
server process, but after servicing each
SQL request it is free to service requests
LCKn
from a different user process. Configuration
Systems Global Area (SGA)
(Oracle Parallel values control the initial and maximum
Server)
Shared Pool number of shared servers allowed active
Database Shared SQL
Buffer
Redo Log
Areas or at one time. Request and response queues
Buffer
Cache Library Cache
Dictionary
Archive Storage are used by the dispatchers and shared
Cache servers to communicate SQL requests and
CKPT LGWR
to return data results.
At startup time, Oracle creates a number
ARCH
Shared DBWR of system background processes for each
Server Dedicated
User
Processes Server Control Files instance to perform system functions:
Processes Processes Database Redo Log
(Snnn)
(access via MTS) Files Files
◆ The System Monitor (SMON) performs
instance recovery during startup, cleans
Dnnn User Process
up temporary segments that are no longer
in use, recovers dead transactions skipped
during crash and instance recovery
because of file-read or offline errors, and
A database is sometimes left unmounted, server process still exists. These dedicated coalesces small chunks of contiguous
or mounted and unopened, during startup to connections are always required when free space into larger blocks of contigu-
allow execution of administrative functions executing certain Oracle administration ous space for easier allocation by Oracle.
that require the database’s data to be functions, such as database startup, shut-
unavailable to users. down and recovery. ◆ The Process Monitor (PMON) performs
In a Multi-Threaded Server (MTS) recovery when a user process fails.
INSTANCE AND APPLICATION PROCESSES configuration, as shown in Figure 2, many PMON cleans up the cache and frees
An Oracle DBMS comprises two types user processes can be serviced by a smaller resources that the process was using.
of processes: user and Oracle system. A number of shared server processes. This PMON also restarts failed dispatcher
user or client process is created to execute helps reduce process memory utilization and shared server processes.
the program code of an application. It also and process management overhead. An
manages the communication with the MTS configuration uses a SQL*Net net- ◆ The Database Writer (DBWR) writes
Oracle server processes. Oracle system work listener process to connect user modified (dirty) data blocks from the
processes are called by other users or processes to dispatchers, which route client database cache to data files on disk
Oracle processes to perform functions on requests to the next available shared server using a least recently used algorithm.
behalf of the invoking process. Oracle sys-
tem processes are divided into two types: Figure 2: Oracle Multi-Threaded Server Architecture
server processes and background processes.
Server processes exist to service requests User processes
and
from connected user processes. A server application code

process receives SQL statement requests, Client Workstations


checks the shared pool within the SGA for Database Server
Listener
the parsed form of the SQL statement (if it
does not exist within the shared pool, it is Dispatcher processes (Dnnn)
TCP/IP
read in and parsed), checks user access xxxxxxx
privilege, retrieves data from the actual data yyyyyyy
file or data that is already cached in the
instance’s SGA, and makes the data avail- Shared
able to the requesting application. Server
Processes
In a dedicated server configuration (Snnn)
(sometimes called two-task Oracle), each
server process handles requests for a single
Request
user process. In this type of system, the Queue Response Queue
(common to all (one per dispatcher)
application process and the Oracle server dispatchers)
process frequently execute on different
machines. Even when the user is not actively System Global Area
making a database request, the dedicated

http://www.naspa.net February ‘97 TECHNICAL SUPPORT


S Y S T E M S
Whenever possible, DBWR writes dirty SERVER MEMORY STRUCTURES
buffers to disk using a multi-block write To operate, each Oracle instance allocates
mechanism. DBWR manages the buffer
An Oracle DBMS comprises a number of cache areas. As shown in
cache so that user processes can always two types of processes: Figure 1, the major memory areas are the
find free buffers. The DBWR process SGA, PGA and sort areas.
is signaled to write dirty buffers to disk
user and Oracle system. The SGA is a single shared memory
under the following conditions: A user or client process area consisting of three main components:
• when the dirty list reaches a threshold Database Buffer cache, Shared Pool and
length defined by the init.ora parameter
is created to execute the program Redo Log buffer. The size of the SGA
DB_BLOCK_WRITE_BATCH; code of an application. is based on various init.ora parameter
• when a free buffer has not been values including: DB_BLOCK_SIZE,
found after n buffers have been
It also manages the communication DB_BLOCK_BUFFERS, LOG_BUFFER,
scanned (where n is defined by with the Oracle server processes. and SHARED_POOL_SIZE.
DB_BLOCK_MAX_SCAN_CNT The Database Buffer cache holds the
in init.ora);
Oracle system processes most recently used data from files on
• when a timeout occurs (every are called by other users disk. It is similar to using a single DB2
three seconds); Buffer Pool (BP), but without the ability
• when a checkpoint occurs; and
or Oracle processes to dynamically alter its size. Database
• when the Log Writer (LGWR) to perform functions on behalf Buffer cache size is determined at Oracle
signals DBWR. startup based on the DB_BLOCK_BUF-
of the invoking process. FERS parameter. Each block size is
◆ The LGWR is triggered during several usually between 2KB and 32KB (in
internal events (commit, checkpoint, multiples of 2KB), as determined by
and log write timeout), as well as when ◆ Lock (LCKn) processes are used DB_BLOCK_SIZE.
the redo log buffer is one-third full. in conjunction with the Parallel Server The Shared Pool is similar to DB2’s
This process writes the redo log buffer option. Up to 10 LCK processes (LCK0 Environmental Descriptor Manager pool,
in memory to the redo log file on disk. through LCK9) are used to control which contains runtime definitions for SQL
During each Checkpoint (CKPT), the inter-instance locking. statements and other dictionary information.
LGWR updates file headers if a CKPT The Shared Pool contains cache areas for
process is not configured to perform ◆ Dispatcher (Dnnn) processes, used with parsing and storing SQL and PL/SQL state-
this function. the MTS configuration, allow user ments (Shared SQL Area); a Data Dictionary
processes to share a limited number cache (row cache) which contains database
◆ The optional CKPT updates the headers of shared server processes. At least reference information, similar to DB2’s
of all data files during checkpoint one dispatcher process must be created dictionary database; and, in an MTS configu-
processing. If the init.ora CHECK- for each network protocol used to ration, private SQL areas containing binding
POINT_PROCESS parameter is communicate with Oracle. information and run-time buffers. The
enabled, this process can improve SHARED_POOL_SIZE parameter defines
system performance by freeing the ◆ Parallel Query server processes are used the size of the Shared Pool.
LGWR to concentrate on the redo with the Parallel Query option in Oracle The Redo Log buffer is an area of the
log buffer. The CKPT process does 7.1 or higher. With this option, a query SGA that Oracle uses to record database
not write data blocks to disk; this is coordinator (QC) intercepts queries, related changes caused by SQL INSERT,
performed by the DBWR. decides if they should be split into UPDATE, DELETE, CREATE, ALTER, or
multiple smaller queries, and sends DROP, and to recreate data or objects during
◆ The Recoverer (RECO) is started when them to the pool of available query recovery of an executing transaction. It is a
distributed transactions are permitted servers for processing. Query servers circular buffer that contains redo entries
and the init.ora parameter DISTRIB- are also used for parallel index creation containing the information necessary to
UTED_TRANSACTIONS is greater and data loads. The number of query reconstruct or redo changes made to the
than zero. The Oracle distributed servers automatically increases or database. Redo entries are later copied to
option uses the RECO process to decreases (within the upper and lower the active redo log file on disk. Oracle’s
automatically resolve distributed limits set by the administrator) to logging functions are very similar to DB2
transaction failures. accommodate changing workload levels. log buffer and online log files. Redo Log
buffer size is determined by the LOG_BUF-
◆ The Archiver (ARCH) copies online ◆ Snapshot (SNPn) processes are used FER parameter.
redo log files, once they become full, with the Oracle distributed option to Oracle also uses rollback segments.
to a specified storage device or location. automatically refresh table snapshots. These memory areas store pre-update
ARCH is present only when the data- These processes “wake-up” periodically images that can be used to rollback transac-
base is started in ARCHIVELOG mode when snapshots are scheduled to be tion updates and allow access to data as it is
and automatic archiving is enabled. automatically refreshed. being updated (dirty reads).

TECHNICAL SUPPORT February ‘97 http://www.naspa.net


S Y S T E M S
When the MTS is configured, request eliminates the overhead associated with Figure 3: Oracle Database Logical
and response queues and some contents of frequently creating and deleting temporary and Physical Structures
the PGA are stored within the SGA. Other sort segments.
information that needs to be communicated
between processes, such as locking infor-
mation, is also stored within the SGA. A Database
fixed SGA area stores information about
In Oracle 7.3,
the state of the database and instance for permanent segments can be created
access by background processes.
The PGA is memory that contains data
to contain sort work areas, Tablespace
Data Files
and control information for an Oracle similar to the permanently
instance or application process. Each
process has its own PGA; its contents vary
allocated sort work tables in DB2.
depending on whether an MTS configuration Segment
is used by a user or application to connect (index)
to the Oracle instance. Each process PGA (temporary)

always contains stack space, which is SERVER AND DATABASE FILES


memory used to hold a session’s variables, An Oracle instance uses a number of dif-
arrays and other information. A PGA ferent physical and logical structures to Extents
without an MTS connection requires addi- operate. Some of the physical structures
tional memory for the user’s session, such used by an Oracle instance are shown in
as private SQL areas. If the connection uses Figure 1:
an MTS, the extra memory is allocated to
Blocks
the SGA instead of the PGA. Several ◆ Oracle database files contain database
initialization parameters affect the size information, including both system
of a PGA, including OPEN_LINKS, and application data. System data
DB_FILES and LOG_FILES. files contain the contents of the
On top of physical SGA and PGA SYSTEM tablespace, including
memory, some logical memory structures the data dictionary and the names
are created. These structures may be shared and locations of all objects within ◆ Process trace files can exist for each
or private and differ as to when they are the database. Application data files server and background process. When
allocated and deallocated. Logical memory hold user data that is accessed by a process detects an internal error it
structures include: User Global Area (UGA), SQL statements. dumps error information to its trace
Call Global Area (CGA), Shared Context file. Trace files can also contain SQL
Areas or Cursors, Cursor Ephemeral Frame, ◆ Oracle parameter file, init.ora, contains tuning information when the initial-
Cursor Work Heap, Cursor Persistent Frame, startup parameters to customize the ization parameter SQL_TRACE is set
and connection memory (HGA). For more Oracle instance’s execution environment. TRUE (although this global setting is
information on these areas, refer to the article expensive) or when a session enables
UGA and More Undocumented Features in ◆ Control files are used to record the trace logging by using the ALTER
the bibliography. names of the database’s data files SESSION SET SQL_TRACE =
Finally, sorting requires sort space in and redo log files as well as other TRUE command.
memory. A sort area exists in the memory status and configuration information.
of an Oracle user process that requests a ◆ An instance’s ALERT file contains
sort. A sort area dynamically grows to ◆ Online and Archived Redo log files a chronological log of messages
accommodate the amount of data to be record changes made to data and and errors generated by an instance.
sorted, within the limits of the ensure that no data is lost in the event
SORT_AREA_SIZE value. If Oracle does of an instance failure. An online redo ◆ One or more configuration files
not need to reference the sort area, it may log consists of two or more pre-allocated on each client and server define
dynamically reduce its size as determined files that store all changes made to the SQL*NET communications and
by the SORT_AREA_RETAINED_SIZE database as they occur. Archived enable client/server connections.
parameter. When needed, Oracle uses tem- (offline) redo logs consist of archived
porary segments on disk to contain sort online redo log files that become full. As shown in Figure 3, an Oracle database
work areas. These temporary segments are The archived redo log is optional based contains several logical structures defined
dynamically created and deleted on an “as on a database’s archiving mode. on top of a physical data file’s user or system
needed” basis. In Oracle 7.3, permanent data. Within an Oracle database, the logical
segments can be created to contain sort ◆ Database backup files can be created structures from the highest to lowest level
work areas, similar to the permanently to support the restoration of damaged include: tablespaces, segments, extents and
allocated sort work tables in DB2. This data files or control files. data blocks.

http://www.naspa.net February ‘97 TECHNICAL SUPPORT


S Y S T E M S
A database is divided into one or more either 2KB or 4KB. Each data block ◆ a SQL statement tracing facility
logical storage units called tablespaces. A contains a header, row directory, row data (SQL_TRACE) that can be
database administrator can create new and free space. enabled globally for all SQL
tablespaces, add data files for tablespaces, statements (although not
set and alter default segment storage settings recommended because of high
for segments created in a tablespace and overhead) or at the individual
drop tablespaces. Every database contains a
Oracle 7 has many session level. Trace records are
tablespace named SYSTEM that is auto- configuration options written to a file that can be read
matically built during database creation. by a translation and reporting
This tablespace contains the data dictionary
and optional features utility called TKPROF.
tables for the entire database. It is similar to that must be
the DB2 catalog and dictionary databases. ◆ Oracle 7.3 provides more extensive
To add more space to a database, data files
carefully implemented tracing and instrumentation facilities
can be added to one of its existing table- and tuned for you to optimize that can be controlled and reported
spaces up to the database limit of the total on by an additional product called
number of files allowed.
your system Oracle Trace.
The next level of logical structures are and application performance.
segments. A segment is a set of extents ORACLE 7: THE POWER AND COMPLEXITY
stored in the same tablespace that have been This article described the major
allocated for a specific type of data structure. components of the Oracle 7 server to
For example, each table’s data is stored in show both the power and the complexity
its own data segment, while each index’s PERFORMANCE MONITORING AND TUNING of this database management system.
data is stored in its own index segment. The Oracle server product includes a It has many configuration options and
Both segment types can reside in the same number of built-in and add-on tools and optional features that must be carefully
tablespace and physical files, which is very mechanisms for monitoring the perfor- implemented and tuned for you to
different from DB2’s implementation of mance of an Oracle instance and tuning optimize your system and application
separate table- and indexspaces. Segment performance. These mechanisms are: performance. ts
extents can span one or more files assigned
to a tablespace. When the existing extents ◆ more than 30 memory resident tables BIBLIOGRAPHY
for a segment are full, Oracle allocates (X$ tables) and the views on them
another extent for that segment. Since (V$ tables), providing a wealth of Oracle 7 Server Concepts,
extents are allocated as needed, segment performance and configuration infor- Part No. 6693-70-1292
extents may be non-contiguous. The main mation to users and third-party
segment types are: performance monitors, such as Oracle 7.2 Parallel Server,
Candle’s OMEGAMON Monitoring Part No. A19487-2
◆ one data segment per table, snapshot, Agents for Oracle.
or snapshot log defined; UGA and More Undocumented Features,
◆ one index segment per index defined; ◆ SQL*DBA monitor facilities Tony Jambu, Select Journal, July 1995.
◆ one or more rollback segments (or the more graphical Oracle 7.3
for recording transaction change replacement, Server Manager) to
activity; and display the contents of dynamic Daniel D. Kitay is R&D manager at Candle
◆ one or more temporary segments performance tables. Corporation’s Westlake, Calif., R&D office.
to contain sort and other types He specializes in designing and implementing
of work areas. ◆ Oracle scripts for performance applications to manage the performance and
monitoring, including UTLBSTAT, availability of distributed systems and applications.
The next level of logical database space UTLESTAT, and UTLLOCKT.SQL For the past 13 years Daniel has worked with IMS,
is called an extent. An extent is a specific for reviewing locking conflicts. VTAM, DB2 for MVS, and more recently, Oracle,
number of contiguous data blocks that is Sybase, Lotus Notes and SAP. He can be reached
allocated for storing a specific type of ◆ an ANALYZE SQL statement that tells at dan_kitay@candle.com.
information. A single extent cannot span a Oracle to collect and store tablespace
physical file. related statistics, similar to DB2’s ©1997 Technical Enterprises, Inc. Reprinted
A data block is the smallest unit of I/O RUNSTATS utility. with permission of Technical Support maga-
used by an instance. A data block corre- zine. For subscription information, email
sponds to a block of physical bytes on ◆ a SQL EXPLAIN PLAN facility, mbrship@naspa.net or call 414-768-8000,
disk, equal to the Oracle data block size. similar to DB2’s, that allows Ext. 116.
This block size can differ from the stan- you to review access path choices
dard I/O block size of the operating made by Oracle’s cost- and
system that executes Oracle; it is usually rule-based optimizer.

TECHNICAL SUPPORT February ‘97 http://www.naspa.net

Das könnte Ihnen auch gefallen