1. Trang chủ
  2. » Giáo Dục - Đào Tạo

An Introduction to Oracle DBMS Architecture and Server-Side Programming

442 789 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 442
Dung lượng 6,43 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Oracle Server – Database Dictionary The Database dictionary is a read-only set of tables and views that provides information about the database.. A data dictionary contains: ■ The defi

Trang 1

An Introduction to Oracle DBMS Architecture

and Server-Side Programming

Victor Matos

Department of Computer and Information Science

Cleveland State University

Trang 2

This document is a collage of notes taken from

1 Oracle Documentation Files (www.oracle.com)

2 Fundamentals of Database Systems by Elmasri & Navathe Ed

Addison Wesley

3 Oracle – The Complete Reference by Koch & Loney Ed Oracle Press

CONTENTS

Trang 3

What is ORACLE ?

Very robust implementation of a

Relational Database Management

System (RDBMS)

The relational model of data is simple to understand and has been extensively scrutinized since 1970’s

Trang 4

What else is good about ORACLE ?

• The company is solid and successful,

since 1994 revenues in the order

Trang 5

Reasons for the Oracle Success

Security Mechanisms users are given specific

rights to operate on the data.

Backup and Recovery minimizes data loss and idle time in the presence of failures

Space Management flexible allocation

Open Connectivity uninterrupted services

reachable from heterogeneous clients

Development Tools

many to choose from

Trang 6

Software Support on the Oracle Server

Procedural Option: built-in programming

capabilities based on the PL/SQL language

Stored Procedures: programs stored in the

server-side could be invoked using

Trang 7

ORACLE SERVER

Same set of Proc, functions, data- type, const, etc

Various Clients

Trang 8

Distributed Option:

• Data could be stored in different machines and

placed in different cities

• Oracle Distributed option provides location

transparency , the user does not need to be aware

of where the data is kept.

Trang 9

SELECT PartNumber, Price

FROM Ohio_inventory , suppliers

WHERE inv_sup = Sup_Numb;

Cleveland, Ohio

New York, NY.

Oracle Distributed Option

Trang 10

Oracle Distributed Option

Homogenous Distributed Database Systems

A homogenous distributed database system is a network of two or more

Oracle Databases that reside on one or more machines

Heterogeneous Distributed Database Systems

- In a heterogeneous distributed database system, at least one of the databases is a non-Oracle Database system

- To the application, the heterogeneous distributed database system appears as a single, local, Oracle Database

- The local Oracle Database server hides the distribution and heterogeneity of the data

Trang 11

You can also create synonyms for remote

objects in the distributed system so that users can access them with the same syntax as local objects

• For example, if you are connected to local

database MFG but want to access data on

remote database HQ, creating a synonym

on mfg for the remote emp table enables

you to issue this query:

SELECT * FROM emp;

same as

SELECT * FROM emp@HQ.ACME.COM;

• In this way, a distributed system gives the appearance of native data access

• Users on mfg do not have to know that the data they access resides on remote

databases

Trang 12

Parallel Server Option:

• Independent machines ( nodes ) which their own

Trang 13

Indians95 Oraccle Server Yankees96 ORACLE Server

NY data Ohio data

NODE 1

New York, NY.

Shared Database

Parallel Server Option

Trang 14

Parallel Query Option:

• Computers holding more than one CPU (such as

multiPentium Windows NT, XT, …) could use those processors in solving independent portions of a

query

• An Oracle control unit breaks the query into

pieces, and re-assembles the partial results.

Trang 15

SELECT LastName, Dno FROM Employee WHERE (salary > 70000)

SELECT LastName, Dno FROM Employee WHERE (sex = 'F')

Original SQL statement

Trang 16

TECHNOLOGY PRODUCTS

Database and Grids

Middleware | Data Hubs

Human Resources Supply Chain

Public Sector Applications Banking Applications

Retail Applications Telecom Applications Higher Education Applications Other Industries

ORACLE SERVICES Support | Education

On Demand Financing INSIGHT | Consulting

Links to ORACLE Products & Services

www.oracle.com

Trang 17

INDUSTRIES

Oracle has solutions for many industry segments such as

Automotive Banking Engineering &

Construction Government Government

       

       

               

               

               

               

Download (PDF) Download (PDF) Download (PDF) Download (PDF) Download (PDF)

Government Healthcare Human Capital

Management Manufacturing Retail

       

       

               

               

               

               

Download (PDF) Download (PDF) Download (PDF) Download (PDF) Download (PDF)

Telecommunications

Download (PDF)

Links to ORACLE Products & Services

www.oracle.com

Trang 18

Components of Typical Oracle Server

Data Dictionary Permanent Storage Memory & Processes

Trang 19

Oracle Server – Database Dictionary

The Database dictionary is a read-only set of tables and

views that provides information about the database

A data dictionary contains:

■ The definitions of all schema objects in the database (tables, views, indexes,

clusters, synonyms, sequences, procedures, functions, packages, triggers, and so on)

■ How much space has been allocated for, and is currently used by, the schema objects

■ Default values for columns

■ Integrity constraint information

■ The names of Oracle users

■ Privileges and roles each user has been granted

■ Auditing information, such as who has accessed or updated various schema objects

■ Other general database information

The data dictionary tables and views for a given database are stored in that database’s

SYSTEM tablespace.

Trang 20

Oracle Server – Database Dictionary

How the Data Dictionary Is Used

The data dictionary has three primary uses:

■ Oracle accesses the data dictionary to find information about users, schema objects, and storage structures.

■ Oracle modifies the data dictionary every time that a data

definition language (DDL) statement is issued.

■ Any Oracle user can use the data dictionary as a read-only

reference for information about the database.

Data Dictionary View Prefixes

Prefix Scope

USER User’s view (what is in the user’s schema)

ALL Expanded user’s view (what the user can access)

DBA Database administrator’s view (what is in all users’ schemas)

Trang 21

ORACLE Architecture

A What is inside of the database dictionary?

SYSTEM SQL> column COMMENTS format a35 wrap

SYSTEM SQL> select * from DICTIONARY;

TABLE_NAME COMMENTS

-

-DBA_ROLES All Roles which exist in the database DBA_PROFILES Display all profiles and their limits

USER_RESOURCE_LIMITS Display resource limit of the user

USER_PASSWORD_LIMITS Display password limits of the user

USER_CATALOG Tables, Views, Synonyms and Sequences

owned by the user

ALL_CATALOG All tables, views, synonyms, sequences

accessible to the user

DBA_CATALOG All database Tables, Views, Synonyms,

Sequences

USER_CLUSTERS Descriptions of user's own clusters

ALL_CLUSTERS Description of clusters accessible

to the user

DBA_CLUSTERS Description of all clusters in the

database

DBA_SQLSET_DEFINITIONS Synonym for DBA_SQLSET

USER_SQLSET_DEFINITIONS Synonym for USER_SQLSET

1821 rows selected.

Trang 22

SCOTT_SQL> describe Employee

Name Null? Type

- -

FNAME VARCHAR2(10)

MINIT CHAR(1)

LNAME NOT NULL VARCHAR2(15)

SSN NOT NULL CHAR(9)

Trang 24

• Every Oracle database has one or more physical datafiles

• The datafiles contain all the database data

• The data of logical database structures, such as tables and indexes, is physically stored in the datafiles allocated for a database

The characteristics of datafiles are:

■ A datafile can be associated with only one database

Datafiles can have certain characteristics set to let them automatically extend when the database

runs out of space

■ One or more datafiles form a logical unit of database storage called a tablespace.

■ Data in a datafile is read, as needed, during normal database operation and stored in the memory cache of Oracle

Physical Database Structures

Example

Assume that a user wants to access some data in a table of a database If the requested information is not already in the memory cache for the database, then it is read from the appropriate datafiles and stored in memory Modified or new data is not necessarily written to a datafile immediately To reduce the amount

of disk access and to increase performance, data is pooled in memory and written to the appropriate

datafiles all at once, as determined by the database writer process (DBWn) background process.

Trang 25

ORACLE Architecture

•A database consists of one

or more logical storage units

called tablespaces, which

collectively store all of the database’s data.

•Each tablespace consists of

one or more files called

datafiles.

•Datafiles are physical

structures that conform to the operating system in which Oracle is running.

Trang 26

ORACLE Architecture

Exploring TABLESPACE definitions

SYSTEM SQL> desc v$tablespace

SYSTEM SQL> select * from v$tablespace;

TS# NAME INC BIG FLA ENC

-

0 SYSTEM YES NO YES

1 UNDO YES NO YES

2 SYSAUX YES NO YES

4 USERS YES NO YES

3 TEMP NO NO YES

This DATABASEinstance is calledXE

Trang 27

ORACLE Architecture

Enlarging a Database by Adding a New Tablespace Enlarging a Database by Adding a Datafile to a Tablespace

Trang 28

ORACLE Architecture

Enlarging a Database by Dynamically Sizing Datafiles

Trang 30

ORACLE Architecture

The logical organization and operation of Oracle DBMS is very similar to the IBM370 Virtual Memory, Multitasking computers of

Trang 31

ORACLE Architecture

LOGICAL DATA STRUCTURES

• Oracle stores data in data blocks One data

block corresponds to a specific number of bytes

of physical database space on disk

• The next level of logical database space is an

extent An extent is a specific number of contiguous data blocks allocated for storing a

specific type of information

• The level of logical database storage greater

than an extent is called a segment A segment

is a set of extents, each of which has been allocated for a specific data structure and all of which are stored in the same tablespace

• For example, each table’s data is stored in its

own data segment, while each index’s data is stored in its own index segment If the table or

index is partitioned, each partition is stored in its own segment

Trang 32

Data Block Format

The Oracle data block format is similar

regardless of whether the data block

contains table, index, or clustered data.

ORACLE Architecture

Trang 33

Physical Database Structures

Control Files

Every Oracle database has a control file A control file contains entries that specify the

physical structure of the database For example, it contains the following information:

■ Database name

■ Names and locations of datafiles and redo log files

■ Time stamp of database creation

Oracle can multiplex the control file, that is, simultaneously maintain a number of identical control file

copies, to protect against a failure involving the control file

Every time an instance of an Oracle database is started, its control file identifies the database and redo log

files that must be opened for database operation to proceed

If the physical makeup of the database is altered (for example, if a new datafile or redo log file is created), then the control file is automatically modified by Oracle to reflect the change

A control file is also used in database recovery

Trang 34

Physical Database Structures

GROUP 1 SIZE 51200K, GROUP 2 SIZE 51200K, RESETLOGS;

Trang 35

Redo Log Files

• Every Oracle database has a set of two or more redo log files

• The primary function of the redo log is to record all changes made to data If a failure prevents modified

data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost

• To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two

or more copies of the redo log can be maintained on different disks

• The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles

Physical Database Structures

Trang 36

Other Control Files

Archive Log Files

Permanent (disk) images of REDO logs

Parameter Files

Parameter files contain a list of configuration parameters for that instance and database.

Alert and Trace Log Files

The alert file, or alert log, is a special trace file The alert log of a database is a

chronological log of messages and errors Each server and background process can write to

an associated trace file When an internal error is detected by a process, it dumps

information about the error to its trace file

Trang 37

■ Information that is shared and communicated among Oracle

processes (for example, locking information)

■ Cached data that is also permanently stored on peripheral memory

(for example, data blocks and redo log entries)

Oracle Memory & Transactions

Trang 38

The basic memory structures associated with Oracle include:

■ System Global Area (SGA), which is shared by all server and

background processes.

■ Program Global Areas (PGA), which is private to each server and

background process; there is one PGA for each process.

Oracle Memory & Transactions

Trang 39

System Global Area

• The System Global Area (SGA) is a shared memory region that contains

data and control information for one Oracle instance

• Oracle allocates the SGA when an instance starts and deallocates it when the instance shuts down

• Each instance has its own SGA.

• Users currently connected to an Oracle database share the data in the SGA

• For optimal performance, the entire SGA should be as large as possible (while still fitting in real memory) to store as much data in memory as

possible and to minimize disk I/O

Oracle Memory & Transactions

Trang 40

System Global Area

The information stored in the SGA is divided into several types of memory structures

• Database Buffer Cache of the SGA Database buffers store the most recently used

blocks of data The set of database buffers in an instance is the database buffer cache The

buffer cache contains modified as well as unmodified blocks Because the most recently (and often, the most frequently) used data is kept in memory, less disk I/O is necessary, and performance is improved.

• Redo Log Buffer of the SGA The redo log buffer stores redo entries—a log of changes

made to the database The redo entries stored in the redo log buffers are written to an

online redo log table, which is used if database recovery is necessary

• Shared Pool of the SGA The shared pool contains shared memory constructs, such as

shared SQL areas A shared SQL area is required to process every unique SQL statement submitted to a database A shared SQL area contains information such as the parse tree and execution plan for the corresponding statement A single shared SQL area is used by

multiple applications that issue the same statement, leaving more shared memory for other uses.

Oracle Memory & Transactions

Ngày đăng: 06/06/2018, 20:20

TỪ KHÓA LIÊN QUAN

w