Oracle Database Internal
Architecture
Oracle Database internals consist of
two main components: the database and the Oracle instance. The database is the static
part of the Oracle system, and the Oracle instance is the memory structures and
the Oracle background processes that are started when the database is started.
The Oracle Database internal architecture is shown in below figure
Database
The Oracle Database includes all the
files that constitute the dataset. This includes the datafiles, control files,
online redo log files, and offline archive log files. When an Oracle system is
started, the database files are associated with the Oracle instance, and any
operations the user performs are recorded in the appropriate files at the
operating system level. The following definitions will clarify the different
files that constitute the Oracle Database.
Tablespaces
Oracle manages data in logical units
referred to as tablespaces. A logical tablespace consists of one or several
physical files referred to as datafiles. When a new database object, such as a
table or an index, is created this occurs in an assigned tablespace. When the
tablespace is running out of space, it can be extended by adding datafiles. SAP
follows specific naming conventions for the tablespaces.
Datafiles
Datafiles are actual physical files at
the operating system level with set naming conventions to which the data is
saved by database operations. Datafiles can be added to the tablespace as long
as the mount point has space allocated and is available for such growth. In
real-life production SAP systems, there will be tens and hundreds of datafiles
depending upon the database growth of a given business operation.
Control Files
A control file has the list of
physical datafiles and the paths where such files are located. When an Oracle
instance is started, the system reads the control file to open the datafiles
and redo log files and make it available for general database operations. Since
the control file is such an important file, usually more than one copy exists
at different locations at the operating system level.
Redo Log Files
When data is changed in the Oracle
system, it is not permanently written to the datafiles right away. The data
changes are written to the redo log files. In case there is a power failure,
for example, data is applied back from the redo logs at instance start. In this
way any data loss is prevented. Modified data is not written on a synchronous
manner permanently to the datafiles immediately because of performance reasons.
Instead, the data is written to the datafiles from time to time.
Offline Archive Log Files
The online redo log files are
automatically moved to an offline device when the Oracle database is configured
to turn on the archive log mode. When needed, offline archive log files can be
used to perform a database point-in-time recovery.
Instance
When an Oracle Database is started it
will start the background processes and open the memory structures configured
for the database, and this is referred to as an Oracle instance. The Oracle
instance is associated with the physical static database files to manage the
database operations.
Memory Structures
Memory structures such as the system
global area (SGA) are opened at the Oracle instance start and are based on the configuration
parameter information.
System Global Area
The system global area is a shared
memory region allocated to an Oracle instance based on the configuration
parameters.
The SGA has two primary subareas: the
database buffer cache and the redo log buffer. The Oracle SQL command “show sga”
displays the current configuration of the SGA in the Oracle Database. This
information can be obtained by using the following commands after you log in to
the system at the operating system level as ora<sid> user:
*****************************************************************************************************************
moiz_cmd> sqlplus '/as
sysdba'
SQL*Plus: Release
10.2.0.4.0 - Production on Tue Sep 21 00:54:33 2010
Copyright (c) 1982,
2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g
Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning,
OLAP, Data Mining and Real Application Testing options
SQL> show sga
Total System Global Area
7962544640 bytes
Fixed Size 2094544 bytes
Variable Size 3707767344
bytes
Database Buffers
4238002688 bytes
Redo Buffers 14680064
bytes
******************************************************************************************************************
Database Buffer Cache
The database buffer cache is a set of
database buffers that keep the modified and unmodified blocks of data in the memory
area to facilitate faster access to it.
Redo Log Buffer
The redo log buffer keeps a log of
changes to the data in the memory area. The size of the redo log is static.
Background Processes
When an Oracle instance is started a
set of Oracle processes are started in memory and run in the background.
Background processes are like jobs
that perform common tasks to manage the proper functioning of the Oracle
instance.
Several kinds of background jobs are
started at the instance start and perform a specific job function. Some of the examples
of background processes are process monitor, system monitor, and lock process.
Process Monitor (PMON)
For every end-user process there is a
1:1 Oracle shadow process. PMON monitors the Oracle shadow process. If a user process
crashes, PMON cleans up the orphaned Oracle shadow process and makes sure the
data consistency is maintained.
System Monitor (SMON)
SMON performs recovery functions at
instance start, writing an alert log when an instance process fails and
conducting cleanup of temporary segments when not required.
Lock Process
This background process works as a
lock manager monitor.
Recoverer (RECO)
Recoverer manages the in-doubt
distributed transactions in distributed databases.
Other Processes
There are other critical background
processes that operate in an Oracle database. The most important of these are covered
in the following sections.
Database Writer (DBWR)
The DBWR writes the data from the
database buffer cache to the data files.
Log Writer (LGWR)
The LGWR writes the redo log buffer to
redo log files on the disk.
Archiver (ARC0)
The archiver process will
automatically write the online redo logs to archive log files at an offline
storage location (initially, this is the local disk). This process does this
when the Oracle Database is configured to run with archive mode on.
Checkpoint (CKPT)
The CKPT process writes all modified
database cache buffers in SGA to the datafiles.
The following command at the operating
system level shows the Oracle background processes:
********************************************************************************************************************
moiz> ps -ef | grep ora_
moiz 1527 1 0 Aug30 00:00:26 ora_pmon_DX1
moiz 1533 1 0 Aug30 00:08:20 ora_dbw0_DX1
moiz 1535 1 0 Aug30 00:10:27 ora_lgwr_DX1
moiz 1537 1 0 Aug30 00:02:50 ora_ckpt_DX1
moiz 1539 1 0 Aug30 00:04:57 ora_smon_DX1
moiz 1541 1 0 Aug30 00:00:00 ora_reco_DX1
moiz 1594 1 0 Aug30 00:02:47 ora_arc0_DX1
********************************************************************************************************************
No comments:
Post a Comment