Sie sind auf Seite 1von 32

Oracle Database Structure: A collection of inter-

related data that is stored as a Unit. The database


stores the data and retrieves the required information.
o Logical Database Structure:

o Physical database structure


The Logical Structure of Oracle consists of Schema, data
blocks, extents, segments and tablespace.
A Schema is a collection of database objects such as tables,
views, indexes.
A database user owns the Schema and Schema has the same
name as that of the user.
Various Schema objects:
•Tables: It is basic logical unit that consists of rows and
columns. A table is stored in tablespace and one or more
tables can share a single tablespace.
•Views: It is defined as virtual tables that derive data from
one or more tables. The Views are not stored physically, but
retrieves data dynamically at runtime from data dictionary.
•Indexes: It is a logical structure that helps to retrieve data
quickly from tables. You can define an index on one or more
columns of a table to retrieve data quickly.
Generally index is created on the column that frequently
appears in the WHERE clause.
A Tablespace consists of
One or more data files,
Which physically stores
Data in the form of tables.
When Oracle database is
Installed, default tablespace is created called
SYSTEM.
A tablespace is either offline or online. User can access
tablespace if it is online.
The logical database structure also consists of Segments,
extents and data blocks. Oracle stores data physically in
data blocks. Each block consist of specific bytes.

Segment
[30 KB]

Extent [10 KB] Extent [20 KB]

2KB 2KB 2KB 2KB 2KB 2KB 2KB 2KB


2KB 2KB
2KB 2KB 2KB 2KB
2KB
1. Stores information about
1. Common and
Block address, segment type, Variable Header

Size of data blocks 2. Table Directory

3. Row Directory
2. Information about tables
4. Free Space
Having rows in this block.
3. Information of numbers of
Rows in the block.
4. Used to insert/update/delete
Row that requires free space. 5. Row Data
5.Contains the table or data.
Extents is a logical unit that comprise of number of
contiguous data blocks.

Oracle allocates new segment When existing space in


the segment becomes full.
Physical Database Structure of Oracle consists of data files, redo log
files and control file.
Oracle consists of one or more data files that stores data physically.
The Schema objects such as tables, index, and clusters are physically
stored in data files.
A Single data file can span a single database and single table space only.
Oracle also creates temporary data files to store the data for temporary
tables [knows as temp files].
The physical database structure of Oracle also consists of a set of one
or more redo log files. A redo log file contains redo entries also knows
as redo records.
If failure occurs and oracle not able to write into data files, one can
always recover the data from redo log files.
To make data more secure, Oracle allows multiple redo log files. It
makes 2 or more redo log file and stores them on different disks.
The redo log files helps in recovering the modified data that is not yet
written to database…………..
The process of using the redo log files for recovery is known as
Rolling forward.

Oracle consists of Control files that contains the entries that


specify the physical structure of the database.
A control file contains the information such as
Database name.
Names and locations of the data file, redo log files.

Oracle allows multiple control files.


If all the control files on different disks are lost, one can recover
the data by using the backup copy of the control files.

One can not edit control file.


•Name of the database.
•The timestamp of database creation.
•Name and location of associated data files and redo log
files.
•Table space information.
•The log history.
•Archived log information.
•Backup Information.
•Backup data file and redo log information.
•Data file copy information.
•Current log sequence number.
•Data files offline ranges.
•Check point information.
•The memory structure of an Oracle Instance is made
up of SGA and PGA.

•SGA: SYSTEM GLOBAL AREA.


•PGA: PROCESS GLOBAL AREA.
•The SGA is defined as Shared memory that contains
the data and control information about a single Oracle
instance.
•Every Oracle Instance has its own SGA.
•All Users connected to the Oracle Server share the
data in SGA. The SGA is comprised of database buffers,
redo log buffers and shared pool.
•The database buffers in the SGA stores the most recently used [MRU]
blocks.
•The collection of database buffers in the SGA is knows as buffer
Cache.
•The redo log buffer in the SGA contains the redo log entries that are
the changes made to the data.
•Changes made using INSERT, UPDATE, DELETE, ALTER, DROP
statement.
•The Shared pool in the SGA contains the shared memory
constructors, such as shared SQL area. A single shared area can be
shared by multiple applications.

•LOG_BUFFER: :: determine log buffer size in initialize parameter.


•SHARED_POOL_SIZE ::: determine memory of shared SQL area.
•The PGA is defined as memory area that contains the
data and controls information for a single process. It is
also called Process Global Area.
•Oracle allocates the PGA, when a user process
connects with the database and a new session is
created.
•A process is a thread of mechanism that executes a set
of instructions. A process has its own memory area
where it runs. Oracle can be single process or multiple
processes Oracle Instance.
•A Single process is a system is which the Oracle code is
executed by a single process. [ Can be accessed by
single user ]
•A Multiple process Oracle instance uses several
processes to executes the Oracle code. One or more
user can access the multiple processes Oracle Instance.
•User Processes: It is created and maintained to execute
application program. E.g. OEM [Oracle Enterprise
Manager]
•Oracle Processes: It is generally invoked by other
processes such as background processes.

•Server Processes: Handles request of currently


connected user processes.
•Background Processes: Oracle creates set of
background processes for each instance. Background
processes communicates with the SGA.
•DBWR Database Writer
•LGWR Log Writer
•CKPT Check point
•SMON System Monitor
•PMON Process Monitor
•ARCH Archiver
•RECO Recoverer
•LCKnn Lock
•Dnnn Dispatcher
•Snnn Server
•DBWR: Database Writer writes data from database
buffers to data files, when the checkpoints occurs. The
DBWR is responsible for buffer cache management.
The Buffer cache in SGA stores the database
information. The buffers store the copies of the data
blocks that are read from the data files. When a buffer
is modified, Oracle marks it as Dirty. The purpose of
DBWR is to clean the buffer cache by writing the dirty
buffers to the disk.
•LGWR: The Log Writer writes the redo log buffer into
the redo log files on the disk. The LGWR is responsible
for performing redo log buffer management. The
LGWR process writes all the redo entries into the buffer
since the last time it wrote. The conditions under which
the LGWR process performs the write operations are:
When a user process commits a transaction.
After every three seconds.
When the redo log buffer is one-third full.
When the DBWR process writes the modified buffer
to the disk.
•The DBWR writes all the modified database buffers
into the data files at a specific interval of time. The
event is known as Check Point. The primary
responsibility of CKPT is to signal DBWR to update the
data files and control files. You can enable or disable a
CKPT using the initializing parameter
CHECKPOINT_PROCESS. By default, the CKPT is
FALSE.
•SMON – The System Monitor performs instance
recovery when the failed instance starts. The SMON
process is responsible to clean the temporary segments
that are no longer being used. It coalesces the smaller
contiguous free extents to make a large and empty
block. The SMON process also recovers the terminated
transaction while recovering the Oracle Instance.
SMON process checks for the failure of instance at
regular intervals or can be called by another process
when required.
•PMON – The Process Monitor process performs
recovery when a user process fails. The primary
responsibility of PMON is to clean the cache and to free
the resources that the process is using. It reset the
status of active transaction table, releases locks and
deletes the process ID from the active processes list.
•ARCH: The Archiver process is responsible for copying
the online redo log files to a storage device when redo
log files become full. The ARCH process performs its
function only when redo log is used in ARCHIVELOG
mode and automatic archiving is enabled.

•A single ARCH process is considered to be efficient for


a system. However you can specify number of ARCH
process max up to 10.

•LOG_ARCHIVE_MAX_PROCESSES parameter.
•RECO: The Recoverer process is responsible to resolve
failures, which involve distributed transactions in
which multiple users are simultaneously working on
the Oracle database.

•A distributed transaction failure occurs due to a


network or system failure.
•The RECO process automatically tries to establish
connection at a regular intervals.
•LCNn: The Lock is responsible for inter-instance
locking in Real Application Clusters (RAC). An RAC
allows multiple Oracle instance to access-shared
database.

•Dnnn: the Dispatcher is an optional background


process, which allows user processes to share limited
number of server processes. In absence of Dispatcher,
each user processes will require a single server process.
When Dnnn is used in a milti-threaded environment, a
large number of user processes can be supported by
less number of server process.
• The Oracle instance starts on the Oracle database server.
•The user on the Oracle client initiates connection with the server.
(client sent request)
•The database server verifies the request and start separate dedicated
server process for the user process.
•The user on client execute SQL query.
•The Server receives the query, search in SGA, if found, checks for
privileges of the user and executes the previously existing query. If not
found it created a space in sql area to process.
•The server reads required data from the data files.
•The server process modifies the data in SGA and the DBWR process
writes the modified data to the disk. As user commits the transaction,
the LGWR writes modified data into online redo log files.
•If server process successfully , it send message across network. If not
successful then send message across network.
•Client/Server Architecture:
•Consists of
•Server
•Client
Through network.

The client computer does not perform any processing.


The client computer is concerned about the physical
layout of the data.
Client/server architecture provides concurrency, data
integrity and improves performance.
•Multi-tier Architecture
•Suitable for big org.
•Where DB is too large.
•Where security is concern
•Application Server: Allows
Access to data for client.
Database Server: Where Data resides.
Client computer: Request for data.
2015
•Explain Physical database structure in detail.
•Explain Oracle memory structure in detail.
•Explain Oracle database architecture in details.
2014
Explain logical structure of the database in details.
List all oracle process and explain any three in detail.
Write short notes on memory structure.
Administering an Oracle server includes installing and
upgrading Oracle server, creating and managing databases
and table spaces, determining storage requirements and
taking backup of database at regular interval.

A database in Oracle consists of one or more table spaces,


which stores the user data physically in data files. One can
add / remove table space from database and add / remove
data files from table space.
Types of Oracle user depends on the size of the Oracle
database. If the size is large, you need more than one DBA.
Types of Oracle Users:
•Database Administrators: Installs and upgrades Oracle
database server and front-end application tools.
•Application Developers: Design and develop database
applications using front-end application tools. Responsible
for designing database structure for the application,
determining space requirement for an application.

Das könnte Ihnen auch gefallen