ORACLE ARCHITECTURE
OVERVIEW
ORACLE ARCHITECTURE OVERVIEW.
1. Which is the difference between an Oracle database and an Oracle
instance?
Oracle database = Data files + Control Files + Redo log files
Note: The archive log files, the parameter files and password files are not part of the
database. The archive logs are copies of redo log files, Init.ora is a configuration file for
the Oracle instance and the password file is a place to store the password for "sysdba"
accounts.
ORACLE ARCHITECTURE OVERVIEW.
2. Which are the main Oracle background processes?
Database writer (DBWn) The database writer writes modified blocks from the
database buffer cache to the datafiles.
Log writer (LGWR) The log writer process writes redo log entries to disk.
Checkpoint (CKPT) All modified database buffers in the system global area are
written to the datafiles by DBWn. This event is called a
checkpoint. The checkpoint process is responsible for
signalling DBWn at checkpoints and updating all the
datafiles and control files of the database to indicate the
most recent checkpoint.
System monitor (SMON) The system monitor performs recovery when a failed
instance starts up again.
Process monitor (PMON) The process monitor performs process recovery when a
user process fails. PMON is responsible for cleaning up
the cache and freeing resources that the process was
using.
Archiver (ARCn) One or more archiver processes copy the redo log files to
archival storage when they are full or a log switch
occurs.
3. Data Dictionary Cache.
Data Dictionary is a part of the Shared Pool and holds information about:
a> Database objects;
b> Table descriptions;
c> Datafile names;
d> Block locations;
e> Information concerning Accounts and their privileges.
Every time a statement is processed by Oracle, the Dictionary Cache is accessed
for the relevant information in order that the statement can be properly executed.
ORACLE ARCHITECTURE OVERVIEW.
4. Library cache.
The library cache is the area in the shared pool in which SQL and PL/SQL statements
are parsed (One time the SQL statement is parsed, Oracle knows what to do and how to
do it, because the execution plan is created). If the SQL (or PL/SQL) statement is found in
the Library Cache, the parsing is bypassed. However, to be found in the Library Cache,
the statement must be identical (down to the number of spaces, tabs, capital or small
letters) with another one which run before.
5. Redo Log Buffer.
Before the information is written to the log file, Oracle first writes data in redo log
buffer. If the redo buffers are not large enough, the Oracle LGWR process waits for
space to become available. This wait time becomes wait time for the end user.
Larger Log Buffer Cache values reduce log file I/O, but may increase the time
OLTP users have to wait for write operations to complete. In general, the Log Buffer
Cache is between 1 to 3MB. However, for bulk data loading or to accommodate a
system with fast CPUs and slow disks the Log Buffer Cache could be increased.
6. PGA.
-Session Memory
-Private SQL Area
Session memory is the memory allocated to hold a session's variables (logon
information) and other information related to the session. For a shared server, the
session memory is shared and not private.
The Private SQL area contains data such as bind variable values, query execution
state information, and query execution work areas. Each session that issues a SQL
statement has a private SQL area. Each user that submits the same SQL statement
has his or her own private SQL area that uses a single shared SQL area. Thus, many
private SQL areas can be associated with the same shared SQL area.
- Hash code is generated in PGA.
- Used for sorting Purpose.
- State of cursor. ( Open/closed)
- Session specific defined variables.
7. OPTIMIZER.
Optimizer is the heart of SQL processing engine. There are often many different ways
to execute a SQL statement. The optimizer determines the most efficient way to
execute a SQL statement. This is an important step in the processing of any data
manipulation language (DML) statement.
ORACLE ARCHITECTURE OVERVIEW.
In older versions of the database this execution plan could be generated using one of
two optimizers.
1> Rule Based Optimizer
2> Cost Based Optimizer
The Rule Based Optimizer (RBO) is now obsolete in Oracle 10g.
8. Parser .
Here Syntax and Semantic check functions are performed.
Syntax for correct syntax of SQL statement and Semantic for correct object
references mentioned in SQL.
9. Database Buffer Cache.
Database Buffer cache is one of the most important components of System Global
Area (SGA). Database Buffer Cache is the place where data blocks are copied from
datafiles to perform SQL operations. Buffer Cache is shared memory structure and it
is concurrently accessed by all server processes.
Oracle allows different block size for different tablespaces. A standard block
size is defined in DB_BLOCK_SIZE initialization parameter.
ORACLE ARCHITECTURE OVERVIEW.
Buffers are categorized as follows:
1> Pinned - Pinned Buffers are currently being used
2> Clean / Free - Clean buffer are available for use. Although Clean buffers
contain some data but it is sync with block content stored in datafiles, so there
is no need to write these buffer to disk.
3> Free - Free buffer are empty and haven’t been used yet.
4> Dirty - Dirty buffers are those which needed to be moved to write list.