Beruflich Dokumente
Kultur Dokumente
ORACLE ARCHITECTURE
STRUCTURE
1.1
INTRODUCTION
1.2
1.3
1.4
Global Areas
1.4.2
Background Processes
1.5
EXTERNAL STRUCTRES
1.6
ARCHITECTURE OVERVIEW
1.7
EXERCICES
1.8
ANSWERS
1.1
INTRODUCTION
Development of Relational databases started in the early 70s. By 1980, relational
databases were the most spoken of RDBMSs. Along with the development of relational
databases, SQL also gained wide popularity.
For any RDBMS to be accepted as a full-fledged RDBMS, it has to follow the
twelve codds rules. There are number of products called RDBMSs attempting to meet
all the 12 codd's rules, but all the 12 rules are until now not been satisfied by any
RDBMS. ORACLE also, not 100% relational, since it does not obey all codds rules.
1.2 AN OVERVIEW OF DATABASES AND INSTANCES:
Two basic concepts have to be understood in order to make any sense out of the
ORACLE architecture: database and instance.
i. exe
Data bases: Database is a set of data. Since ORACLE is a RDBMS, data in the database
is stored in tables. ORACLE database stores its data in files. Internally there are database
structures that provide a logical mapping of data files, allowing different types of data to
be stored separately. These logical divisions are called Table spaces.
Table spaces: A table space is a logical division of a database. Each database has at least
one table space (called the SYSTEM Table Space). Other table spaces may be used to
group users or applications together for ease of maintenance and for performance
benefits. A table space can belong to only one database.
Files: Each table spaces is constituted of one or more files, called Data Files, on a disk.
A data file can belong to one and only one table space.
The relation ship among databases, table spaces and data files are illustrated
below in figure 1.1.
DATABASE:
TABLESPACE
SYSTEM
SYSTEM
Tablespce
Table Space
Second
Second
Tablespace
Table Space
Third
Third
Table
Tablespace
Space
DATAFILES
:
Figure 1.1 : Relationship between database, table space and Data files.
Instances:
process that are shared by all users. In addition, there are memory structures that are used
to store most recently required data from database.
A database instance (also known as a Server) is a set of memory structures and
background processes that access a set of database files. The relationship between
instances and database is illustrated below in the fig 1.2.
INSTANCE 1
(SGA + Processes)
INSTANCE 2
(SGA + Processes)
DATABASE FILES
ORACLE database. They contain a fixed set of columns. Each column has a name and
specific characteristics. The characteristic of a column is made up of 2 parts: Its data
type and its length. The ORACLE has a set of data type like NUMBER for numeric,
VARCHAR for variable length character strings, DATE for storing date in the form of
DD-MM-YY etc. In addition to the data types user can create his own abstract data types.
For example, he may create a data type that contains the multiple parts of a address
House-Number, Main, Cross, Extension, City, State etc - as single data type and can be
called by a name address which can be treated as a data type.
Constraints:
applied to a table, every row in the table must satisfy the conditions specified in the
constraint definition.
Constraints can be applied at the time of creating a table.
Example:
Create table EMPLOYEE
( emp_no
Number (10)
PRIMARY KEY,
name
dept_no
Number (2)
DEFAULT 10,
salary
Number (7,2)
soc_sec_no
Char(9)
UNIQUE );
In the above example, NOT NULL is a constraint applied to a name column. This
means that every rows that is stored in the table must have a value for that column; it
cannot be left NULL.
A column can have a default constraint (In above example column dept_no). This
constraint is used to insert value 10 when row is inserted with a NULL value to the
dept_no column.
The CHECK constraint is used to ensure that values in a specified column meet
a certain criterion (in the above example, salary columns value is less than 1000000).
The UNIQUE, is used to specify uniqueness for columns that should be unique
but are not part of the primary key. In the above example, every record in the table must
have a unique value for the column soc_sec_no.
Views:
Views are masks placed upon tables. Views appear to be a table containing
columns. Columns in views are found in one or more underlying tables. The view does
not use physical storage to store data.
Partitions:
Larger tables can be splited into smaller ones, these smaller tables are
called partitions.
Users:
Users own the database objects. When objects are created in database in
A set of objects (such as table and views) owned by a user account is called
Clusters:
The tables that are frequently accessed together may be physically stored
dictionary and is called by applications. Procedures allow you to store frequently used
application logic within the database. A procedure does not return any value to the
calling program.
Functions:
Functions like procedures, are blocks of code that are stored in the
Triggers are procedures that are executed when a specified data base event
functions, packages and sequences. They can point to objects within the local databases
or in remote database.
Privileges and Roles:
access an object owned by another account. Privileges need to be granted for nonowners. Roles or groups of privileges, can be used to simplify this process. Privileges can
be granted to a Role, and the Role in turn can be granted to multiple users.
Database links:
remote database.
Segments, Extents and Blocks: Segments are the physical counterparts to logical
database objects. Segments store data. Index segments, for example, store the data
associated with indexes. A segment is made up of sections called extents - contiguous
sets of ORACLE blocks.
Rollback segment: Rollback means getting previous image or state of the object.
ORACLE have a mechanism for reconstructing the Before image of data for
uncommitted transactions. ORACLE uses rollback segments within the database to
accomplish this.
1.4
database.
Global areas
Background Processes
Dictionary cache.
Context areas.
users. It also holds the most commonly requested structural information about the
database.
Data block buffer cache:
blocks that are read from the data segments in database, such as tables, indexes and
clusters. Typically, the data block buffer cache is about 1 to 2% of the size of database.
Dictionary cache:
user account data, data file names, segment names, etc. are stored in data dictionary
tables. These data dictionary tables are stored in cache memory called Directory Cache.
Redo Log buffer:
These transitions are recorded in files called Online Redo Log files. Redo entries
describes the changes that are made to the database. Redo entries are written to the
online redo log files.
transactions are first recorded in the SGA in an area called Redo Log Buffer. The
database then periodically writes batches of redo entries to the online redo log files.
Library cache:
database. While the data block buffer and directory cache enable sharing of structural
and data information between the users in the database, the library cache allows the
sharing of commonly used SQL statements.
Shared SQL pool:
It stores the data dictionary cache and the library cache. The
shared SQL pool contains the execution plan and parse tree for SQL statements run
against the database.
Context Areas:
Within the shared SQL areas, there are both public and private
areas. Every SQL statement issued by the user requires a private SQL area. Composition
of the SGA is shown in the figure 1.3.
DATA BLOCK
BUFFER
REDO LOG
BUFFER
DICTIONARY
CHACHE
SHARED SQL
POOL
BACKGROUND PROCESS:
The relationships between databases physical and memory structures are
maintained and enforced by the background process. These processes are managed by the
database and require little administrative work.
The Relationships between the physical structures and memory structures in the
database along with the major background process are shown in the figure 1.4.
Memory:
PGA
Data
Buffer
Cache
Context
Areas
Dedicated or
Shared Server
Processes
Files
USER
Data
Files
Redo
Log
Buffers
PMON
DBWR
Control
Files
CKPT
Online
Redo
Logs
LGWR
SMON
ARCH
Archived
Redo
Logs
CKPT:
It is a short form used for Checkpoints. Checkpoints help to reduce the amount of
the time needed to perform instance recovery. Checkpoints cause DBWR to write all the
blocks that have been modified since the last checkpoint to the data files and update the
data file header and control files to record the checkpoints.
Checkpoints occur
automatically when an online Redo Log file fills. CKPT is an optional background
process.
ARCH:
It is a short form used for Archiving Function. LGWR background process
writes to online Redo Log files in a cyclical fashion i.e. after filling the current log files,
it begins writing the next. Once the last online Redo Log file is filled, LGWR begins to
overwrite the contents of first redo log file.
When ORACLE is run in ARCHIEVE LOG mode, the database makes a copy of
each Redo Log file before overwriting it. The ARCH background process performs this
archiving function.
RECO:
It is a short form used for Recovery. The RECO background process is used to
resolve failures in distributed databases. RECO attempts to access databases involved
In-doubt distributed transactions and resolve the transactions.
SNPn:
It is a short form used for Snapshot. ORACLE's Snapshot refreshes and internal
job queue scheduling relay on background processes for their execution. These
background processes names start with the letters SNP and end with a number or letter.
LCKn:
It is a short form used for Locking. Multiple LCK processes, named LCK0
through LCK9, are used for inter instance locking when the ORACLE parallel server
option is used.
Dnnn:
It is a short form used for Dispatcher Processes. Dispatcher processes are part of the
MTS (multi threaded server) architecture; they help to minimize resource needs by
handling multiple connections.
Snnn:
It is a short form used for Server Process. Server Processes are created to manage
connections to the database that require a dedicated server. Server process may perform
I/O against the data files.
1.5
EXTERNAL STRUCTURES:
The databases data files provide the physical storage for the databases data.
Thus they are both Internal structures, since they are tied directly to table spaces and
External, since they are physical files.
The following types of files although related to the database are separate from the
data files. These files include
Redo Logs
Control files
Redo logs:
Redo log files are defined in the previous section 1.4.1.
recover the databases transactions in their proper order in the event of database cache.
The Redo log information is stored external to the databases data files.
When a transaction occurs in the database it is entered in the Redo log buffers,
while the data blocks affected by the transactions are not immediately written to disk.
This allows the database to perform batch writes to disks thus optimizing the
performance of this functions.
Each ORACLE database will have two or more online Redo log files. ORACLE
writes to online Redo log files in a cyclical fashion: after the first log file is filled, it
writes to the second log file, until that one is filled. When all the online Redo log files
have been filled, it returns to the first log file and begins overwriting its contents with
new transaction data. If the database is running in ARCHIEVE LOG mode, then the
database will make a copy of the online Redo log files before over writing them. These
Archived Redo log files can then be used to recover any part of the database to any point
in time.
Control files:
Control files record control information about all of the files within the database.
A databases overall physical architecture is maintained by its control files. They are
used to maintain internal consistency and guide recovery operations.
Since the control files are critical to the database, multiple copies are stored
online. These files are typically stored on separate disks to minimize the potential damage
due to disk failures. The database will create and maintain the control files specified at
database creation.
Trace files and Alert log:
Each of the background process running in an instance has a trace file associated
with it. The trace file will contain information about significant events encountered by the
background process.
In addition to the trace files ORACLE maintains a file called the Alert Log. The
Alert log records the commands and command results of major events in the life of the
database.
Alert log is a vital source of information for day to day management of the
database; trace files are most useful when attempting to discover the cause of a major
failure. In the simplest form an ORACLE database consists of
One or more Data files
One or more Control files
Two or more Online Redo Logs
data between the SGA and data files, ORACLE uses a set of background process that are
shared by all users.
A database server also known as an instance is a set of memory structures and
background process that accesses a set of database files. The relationship between the
servers and databases is illustrated in figure 1.5
The characteristics of the database server such as the size of the SGA and the
number of the background process -- are specified during startup. These parameters are
stored in a file called init . ora.
SERVER
BACKGROUND PROCESSES
DATABASE
REFERENCES:
1. ORACLE - Oracle Press book.
2. Teach Yourself ORACLE in 21 days - SAMS Publications.
1.7
EXERCISE :-
5. Information about statements that are run against the database resides in
__________ memory area.
6. __________ performs batch writes of changed block to the datafiles.
7. Control files record _____________ about all the files within the database.
8. ORACLE database consists of _________ Online Redo logs in the simplest
form.
9. Main memory area in ORACLE database is called as _______________.
10. Set of memory structures and background processes constitute
a _________________.
ANSWERS :A.
1. False
B. 1. Relational.
2. True
2. Tables.
3. False
3.
Server.
4. True
4.
Privileges.
5. False
5.
Library Cache.
6. True
6.
DBWR.
7. False
7.
Control Information.
8. False
8.
Two or more.
9. False
9.
10. True
10.
==============
********
Database Server.
==================