38
Overview of Oracle Database Overview of Oracle Database

Oracle archi ppt

Embed Size (px)

Citation preview

Page 1: Oracle archi ppt

Overview of Oracle DatabaseOverview of Oracle Database

Page 2: Oracle archi ppt

Part 1. Introduction to Database System

Introduction to Database

History of RDBMS

Entity-Relationship Modeling

Database Language

Page 3: Oracle archi ppt

Introduction to Database

File-Based Approach Each program defines and manages its own data

Limitation Separation and isolation of data

Duplication of data

Data dependence

Incompatibility of files

Fixed queries/proliferation of application program

Database Approach A shared collection of logically related data, designed

to meet the information needs of an organization

Page 4: Oracle archi ppt

Database Management System(DBMS) A software system that enables users to define, create and

maintain the database and provides controlled access to database

DDL

DML : procedural, non-procedural

Control : security, integrity, concurrency control, recovery control, user-accessible catalog

Components of the DBMS Environment Hardware - Software - Data - Procedures - People

Page 5: Oracle archi ppt

Advantages of DBMS- Control of data redundancy - Economy of scale

- Data consistency - Balance of conflicting requirements

- More information from the same amount of data

- Sharing of data - Improved data accessibility and responsiveness

- Improved data integrity - Increased productivity

- Improved security - Improved maintenance through data independence

- Enforcement of standards - Increased concurrency

- Improved backup and recovery services

Disadvantages of DBMS- Complexity, Size, Cost of DBMSs, Additional H/W costs

- Cost of conversion, Performance, Higher impact of a failure

Page 6: Oracle archi ppt

Three-Level Database Architecture External Level

The users’ view of the database

Conceptual LevelThe community view of the database

Internal LevelThe physical representation of the database on the computer

Page 7: Oracle archi ppt

Functions of a DBMS

1. Data storage, retrieval, and update

2. A user-accessible catalog

3. Transaction support

4. Concurrency control services

5. Recovery services

6. Authorization services

7. Support for data communication

8. Integrity services

9. Services to promote data independence

10. Utility services

Page 8: Oracle archi ppt

Components of a DBMS

Application

Programs

Application

ProgramsQueriesQueries

Database

Schema

Database

Schema

DML

preprocessor

DML

preprocessor

Query

processor

Query

processor

DDL

compiler

DDL

compiler

Program

object code

Program

object code

Database

manager

Database

manager

Dictionary

manager

Dictionary

manager

Access

methods

Access

methods

File

manager

File

manager

System

buffers

System

buffers

DBMS

Programmers Users DBA

Database and

system catalog

Page 9: Oracle archi ppt

Components of Database Manager

Authorization

control

Authorization

control

Integrity

checker

Integrity

checker

Command

processor

Command

processor

Query

optimizer

Query

optimizer

Transaction

manager

Transaction

managerSchedulerScheduler

Buffer

manager

Buffer

manager

Recovery

manager

Recovery

manager

Data

Manager

Page 10: Oracle archi ppt

History of RDBMS

History of DBMS 1960s - Apollo moon-landing project, GUAM

mid 1960s - IMS by IBM (hierarchical DBMS)

mid 1960s - IDS by GE (network DBMS)

1965 - CODASYL(Conference on Data SYStems Language)

1967 -DBTG(Data Base Task Group)

1970 - E.F.Codd of the IBM Research Lab.

Late 1970s - System R project at IBM

1980s - commercial relational DBMS(DB2, Oracle, Informix..)

Now - OODBMS, ORDBMS

Page 11: Oracle archi ppt

Terminology Relation : a relation is a table with columns and rows

Attribute : an attribute is a named column of a relation

Domain : a domain is the set of allowable values for one or more attributes

Tuple : a tuple is a row of a relation

Degree : the degree of a relation is the number of attributes it contrains

Cardinality : the cardinality of a relation is the number of tuples it contains

Relational database : a collection of normalized relation

Page 12: Oracle archi ppt

Properties of Relations The relation has a name that is distinct from all other

relation names

Each cell of the relation contains exactly on atomic value

Each attribute has a distinct name

The values of an attribute are all from the same domain

The order of attributes has no significance

Each tuple is distinct; there are no duplicate tuples

The order of tuples has no significance, theoretically

Page 13: Oracle archi ppt

When is a DBMS Relational? Foundational rules

Rule 0 : Foundational rule Rule 12 : Nonsubversion rule

Structural rulesRule 1 : Information representation Rule 6 : View updateing

Integrity rulesRule 3 : Systematic treatment of null values Rule 10 : Integrity independance

Data manipulation rulesRule2 : Guaranteed access Rule 4 : Dynamic online catalog based on the

relational model

Rule5 : Comprehensive data sublanguage Rule7 : High-level insert, update, delete

Data independence rulesRule8 : Physical data independence Rule 9 : Logical data independence

Rule11 : Distribution independence

Page 14: Oracle archi ppt

Entity-Relationship Modeling

Concepts of the E-R Modeling Entity Types

An object or concept that is identified by the enterprise as having an independent existence

AttributesA property of an entity or a relationship type

Relationship TypesA meaningful association among entity types

Page 15: Oracle archi ppt

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

Page 16: Oracle archi ppt

Database Language

SQL 1974 - SEQUEL by D.Chamberlin (IBM)

1975 - SQUARE by Boyce (System R project)

1976 - SEQUEL/2 (SQL) by Chamberlin and Boyce)

late 1970 - SQL(Oracle), QUEL(Ingres)

1982 - Relational Database Language(RDL) : ANSI

1987 - ISO standard

1989 - Integrity Enhancement Feature (ISO)

1992 - SQL2(SQL92) : ISO

Page 17: Oracle archi ppt

DML SELECT

INSERT

UPDATE

DELETE

DDL CREATE(DROP) SCHEMA

CREATE(ALTER, DROP) DOMAIN

CREATE(ALTER, DROP) TABLE

CREATE(DROP) VIEW

CREATE(DROP) INDEX

Page 18: Oracle archi ppt

Advanced SQL View

Integrity Enhancement Feature Primary key

Unique

Foreign key

Access Control

Embedded SQL

Host Language Variables

Application Programming Interface

Dynamic SQL

Page 19: Oracle archi ppt

Part 2. Understanding Oracle Database

Overview of oracle Database Architecture

Memory Structure

Process Structure

Storage Structure

New Features

Page 20: Oracle archi ppt

Overview of Oracle Architecture

SGAShared SQL Area Database Buffer Cashe

KByte1,200,000 KByte

Redo LogBuffer

KByte2,100 KByte

PMON

LGWR

Data File Raw Device

Server

USERARCH

TL-812

Archive Log Mode(50M)

* Fixed Size : 70 Kbyte

* Variavle Size : 490 MByte

4,000,000 KByte

* Total SGA Size : 1700 Mbyte

DBW0 CKPT

SMON RECO D000 S000 P000

Page 21: Oracle archi ppt

Memory Structure : Shared Pool

Shared Pool

Library Cache

Shared SQL Area

PL/SQL Procedures

and Package

Control Structuresfor examples;

LocksLibraryCache handlesand so on ...

Dictionary Cache

Control Structuresfor example:

Character SetConversion MemoryNetwork Security Attributes

and so on ..

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

ReusableRuntimeMemory

Page 22: Oracle archi ppt

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 ListLRU ListSize = DB_BLOCK_SIZE * DB_BLOCK_BUFFERS

SGAShared Pool

Shared SQL Area

Database Buffer Cache

Page 23: Oracle archi ppt

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

change vector #1

change vector #1

redo record

Page 24: Oracle archi ppt

Oracle Processes

Snnn

Users

DBWR

SGA

Database Buffer Cache Redo Log Buffer

Data Files

Redo Log Files

Control Files

Offline Storage Device

Dedicated Server

Process

LCK0RECOPMONSMON

CKPTUser

Process

Dnnn

LGWR ARCH

SNPn

Pnnn

Page 25: Oracle archi ppt

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 redo

log file

Page 26: Oracle archi ppt

Cont’d

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

Page 27: Oracle archi ppt

Cont’d

CKPT (Check Point) - is enabled by setting the parameter CHECKPOINT_PROCESS=TRUE

- If enabled, take over LGWR’s 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(Snapshot process)(Job Queue),

QMNn(Queue Monitor),

Page 28: Oracle archi ppt

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)

Page 29: Oracle archi ppt

Oracle Files

Datafile

Redo Log Files

Control Files

Parameter File

Archive File

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

Trace File

Page 30: Oracle archi ppt

Storage Architecture

Physical storage structures Data files

Segments

Extents

Blocks

Logical storage structures Tablespaces

Tables / Clusters / Indexes

Rows

Columns

Page 31: Oracle archi ppt

Physical Storage Architecture

Relationship among Segments, Extents, and Blocks

Extent24K

2K2K2K2K2K2K2K2K2K2K

2K2K2K2K2K2K2K2K2K2K

2K2K2K2K2K2K2K2K2K2K

2K2K2K2K2K2K2K2K2K2K

2K2K

Extent72K

Segment96K

Database Blocks

Page 32: Oracle archi ppt

Logical Storage Architecture

Relationship between tablespaces and datafiles

USER TablespaceSystem Tablespace

Database

DATA3.ORADATA1.ORA DATA2.ORA

Page 33: Oracle archi ppt

Cont’d

Objects stored in tablespaces

Table Table

Table

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

INDEX

Tablespace (one or more datafiles)

Database Files(Physical structures associatedwith only one tablespace)

Objects(stored in tablespace mayspan serveral datafiles)

Page 34: Oracle archi ppt

Block

HeaderTable Dictionary

Row Dictionary

Free Space

Row DataRow Data

General Block Information(Block add, Segment type)85 ~ 100 bytes

Table info in Cluster

Row info in Block

(2 byte per row)

using when New Row Insert or Update

(pctfree, pctused)

Table or Index Data

Page 35: Oracle archi ppt

PCTFREE / PCTUSED

PCTFREEPCTFREE PCTFREEPCTFREE

20%20% Free spaceFree space

PCTUSEDPCTUSED PCTUSEDPCTUSED

PCTFREE = 20 PCTUSED = 40

61%61% Free spaceFree space

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

Page 36: Oracle archi ppt

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

Page 37: Oracle archi ppt

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.

Page 38: Oracle archi ppt

Oracle Client/Server Architecture

NETWORK

Server A

Server bClientApplication

Server/ServerClient/Server

Benefit of Client/Server Component - Database S/W work on Server - Minimize network resource - concurrency, consistency, transparency

- Only Server upgrade to increase size - Minimize Client H/W spec - concurrency, consistency, transparency