Você está na página 1de 23

Components of a DBMS

Programmers

Users

DBA

Application
Programs

Queries

Database
Schema

DML
preprocessor

Query
processor

DDL
compiler

Program
object code

Database
manager

Dictionary
manager

Access
methods

File
manager

System
buffers

Database and
system catalog

DBMS

Components of Database Manager


Authorization
control
Integrity
checker

Command
processor

Query
optimizer

Transaction
manager

Scheduler

Buffer
manager

Recovery
manager

Data
Manager

Conceptual Database Design


The process of constructing a model of the

information used in an enterprise, independent of all


physical considerations

Logical Database Design


The process of constructing a model of the

information used in an enterprise based on a specific


data model, but independent of a particular DBMS and
other physical considerations.

Physical Database Design


The process of producing a description of the

implementation of the database on secondary storage;


it describes the storage structures and access
methods used to archieve efficient access to the data

DML
SELECT
INSERT
UPDATE
DELETE

DDL
CREATE(DROP) SCHEMA
CREATE(ALTER, DROP) DOMAIN
CREATE(ALTER, DROP) TABLE
CREATE(DROP) VIEW
CREATE(DROP) INDEX

Part 2. Understanding Oracle Database


Overview of oracle Database Architecture
Memory Structure
Process Structure
Storage Structure
New Features

Overview of Oracle Architecture


PMON

SMON

D000

RECO

S000

Redo Log
Buffer

SGA
Shared SQL Area

P000

Database Buffer Cashe

* Total SGA Size :


1700 Mbyte
* Fixed Size :
70 Kbyte
* Variavle Size :
490 MByte

TL-812
4,000,000 KByte

Server

1,200,000 KByte

DBW0

CKPT

Data File
Raw Device

USER

2,100 KByte

LGWR

ARCH
Archive Log Mode(50M)

Memory Structure : Shared Pool


Shared Pool
Library Cache

Dictionary
Cache

Shared
SQL Area

PL/SQL Procedures
and Package

Control Structures
for examples;
Locks
Library
Cache handles
and so on ...

Control Structures
for example:
Character Set
Conversion
Memory
Network Security
Attributes
and so on ..

Reusable
Runtime
Memory

Shared Pool Contents


- Text of the SQL or PL/SQL statement
- Parsed form of the SQL or PL/SQL statement
- Execution plan for the SQL or PL/SQL
statements
- Data dictionary cache containing rows of data
dictionary information

Library Cache

- shared SQL area


- private SQL area
- PL/SQL procedures and package
- control structures : lock and library cache handles

Dictionary Cache

- names of all tables and views in the database


- names and datatypes of columns in database tables
- privileges of all Oracle users

SHARED_POOL_SIZE

Memory Structure :Database Buffer


Cache
Database Buffer Cache holds copies of data blocks read from disk
All users concurrently connected to the system share access to the buffer cache
Dirty List
LRU List
Size = DB_BLOCK_SIZE * DB_BLOCK_BUFFERS

SGA
Shared Pool
Shared SQL
Area

Database Buffer Cache

Memory Structure :Redo Log Buffer

Circular buffer containing information about changes made to the database

save it redo entry

Redo Entries is used when Database Recovery

DBWR write contents of Redo Log Buffer to Online Redo Log

LOG_BUFFER

change vector #1
redo record

change vector #1
change vector #1

Oracle Processes
SNPn

SMON

PMON

Pnnn

RECO

SGA
Database Buffer Cache

Snnn

Redo Log
Buffer
Offline
Storage
Device

Dedicated
Server
Process

DBWR
Dnnn

LCK0

User
Process

LGWR

ARCH

CKPT
Control
Files

Users

Data
Files

Redo Log
Files

Background Process
DBWR

(Database Writer)

- write all dirty buffers to datafiles


- Use a LRU algorithm to keep most recently used blocks in memory
- Defers write for I/O optimization
dirty list reaches a threshold length
A process scnas a specifed number of buffer in the LRU without finding free buffer
A time-out occurs
DBWR checkpoint occurs

LGWR

(Log Writer)

- writes redo log entries to disk


Commit occurs
The redo log buffers pool becomes one-third full
DBWR completes cleaning the buffer blocks at a checkpoint
LGWR time-out

- A commit confirmation is not issued until the tx has been recorded in the rego
log file

Contd
PMON

(Process Monitor)

- Cleans up abnormally terminated connection


- Rolls back uncommited transactions
- Releases locks held by a terminated process
- Frees SGA resources allocated to the failed processes
- Database maintenance

SMON

(System Monitor)

- Performs automatic instance recovery


- Reclaims space used by temporary segments no longer in use
- Merges contiguous area of free space in the datafile

Contd
CKPT (Check

Point)

- is enabled by setting the parameter CHECKPOINT_PROCESS=TRUE


- If enabled, take over LGWRs task of updating files at a checkpoint
- Updates header of datafiles and control files at the end of checkpoint
- More frequent checkpoint reduce recovery time from instance failure
- CKPT improve the performance of database with many database files
ARCH

(Archiver)

- Copies redo log files to tape or disk for media failure


- Operates only when a log switch occurs
- Is optional and is only needed when in ARCHIVELOG mode
- May write to a tape drive or to a disk
LCKn

(Lock), Dnnn (Dispatcher), Snnn (Server),


RECO (Recover), Pnnn(Parallel), SNPn(Job Queue),
QMNn(Queue Monitor),

Server/User Process
User Processes
- A user process is used when a user runs an application program
- Runs the tool/application and is considered the client
- Passes SQL to the server process and receives the results
Server Processes
- A server process must place the data in the database buffer cache
- Parce and execute SQL statements
- Read data blocks from disk into the shred database buffers of the SGA
- Return the results of SQL statements to the user process
Parse : check syntax, security access, object resolution, optimization
Execute : applies the parse tree to the data, perform a physical read and
change
Fetch : Passes data to the user (only SELECT)

Oracle Files

Datafile

Redo Log Files

Control Files

Parameter File

Archive File

Log File (alert*.log, sqlnet.log, listener.log...)

Trace File

Storage Architecture

Physical storage structures


Data files
Segments
Extents
Blocks

Logical storage structures


Tablespaces
Tables / Clusters / Indexes
Rows
Columns

Physical Storage Architecture

Relationship among Segments, Extents, and Blocks

Segment
96K

Extent

Extent

24K

72K
2K
2K
2K
2K
2K
2K
2K
2K
2K
2K

2K
2K
2K
2K
2K
2K
2K
2K
2K
2K

2K
2K
2K
2K
2K
2K
2K
2K
2K
2K

Database Blocks

2K
2K
2K
2K
2K
2K
2K
2K
2K
2K
2K
2K

Logical Storage Architecture

Relationship between tablespaces and datafiles

Database
System Tablespace

DATA1.ORA

DATA2.ORA

USER Tablespace

DATA3.ORA

Contd

Objects stored in tablespaces


Tablespace (one or more datafiles)

Table
INDEX
INDEX

Table

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX
Table

Database Files

Objects

(Physical structures associated


with only one tablespace)

(stored in tablespace may


span serveral datafiles)

Block
Header

Table Dictionary

Row Dictionary
Free Space

General Block Information


(Block add, Segment type)
85 ~ 100 bytes
Table info in Cluster

Row info in Block


(2 byte per row)

Row Data
using when New Row
Insert or Update
(pctfree, pctused)
Table or Index Data

PCTFREE / PCTUSED
PCTFREE
PCTFREE

PCTUSED
PCTUSED

20% Free space


61% Free space

PCTUSED = 40

PCTFREE = 20

Insert new row until 80%

20% use when Update

Can insert new row when below 60%


When Usage is below 40% (61% Free
space), block is listed in FREELIST

Extent
A set

of contiguous database blocks within a datafile.

Extent

are allocated when.

- The segment is created (INITIAL EXTENT)


- The segments grows (NEXT EXTENT)
- The table is altered to allocate extents.

Extent

are de-allocated when the

- The segment is dropped and truncated.


- The segment is larger than optimal and contains free extents
(for rollback segments only)

Each

segment is created with at least on extend( initial extent )

( Rollback segment : 2)

ALTER TABLE

table_name DEALLOCATE UNUSED

Segment
a set of one or more extents that contains all the data for a specific type of logical storage
structure within a tablespace
Data Segment
- A collection of extents that holds all of the data for a table or a cluster
Index Segment
- A collection of extents that holds all of the index data for search optimization on large tables
and clusters
Rollback Segment
- A collection of extents that holds rollback data for rollback, read-consistency, or recovery
Temporary segment
- A collection of extents that holds data belonging to temporary tables created during a sort
operation
Bootstrap segment
- An extent that contains dictionary definitions for dictionary tables to be loaded when the
database is opened.

Você também pode gostar