41
Database system Database system concept and concept and Architecture Architecture

Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Embed Size (px)

Citation preview

Page 1: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Database system Database system concept and concept and ArchitectureArchitecture

Page 2: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Data Models, Schemas, and InstanceData Models, Schemas, and Instance– Categories of Data ModelsCategories of Data Models– Schemas, Instance, and Database StateSchemas, Instance, and Database State

Three-schema Architecture and Data Three-schema Architecture and Data IndependenceIndependence– The three levels of the ArchitectureThe three levels of the Architecture– Data IndependenceData Independence

Database languages and InterfaceDatabase languages and Interface– DBMS LanguageDBMS Language– DBMS InterfacesDBMS Interfaces

The Database System EnvironmentThe Database System Environment– DBMS component ModulesDBMS component Modules– Database system UtilitiesDatabase system Utilities

Centralize and Client/Server Architectures for Centralize and Client/Server Architectures for DBMSsDBMSs– Basic Client/ServerBasic Client/Server– Two-tier Client/Server Architecture for DBMSsTwo-tier Client/Server Architecture for DBMSs– Three-tier Client/Server Architectures for Web Three-tier Client/Server Architectures for Web

ApplicationsApplications Classification of Database Management SystemsClassification of Database Management Systems SummarySummary

Page 3: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Data Models, Schemas, Data Models, Schemas, and Instanceand Instance

Data ModelData Model:: a collection of concepts a collection of concepts that can be use to describes the that can be use to describes the structure of a databasestructure of a database – provides – provides the necessary means to achieve this the necessary means to achieve this abstractions. abstractions.

Structure of DatabaseStructure of Database mean the data mean the data types, relationships, and constraints types, relationships, and constraints that should hold for the data.that should hold for the data.

Page 4: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Categories of Data ModelsCategories of Data Models

Categorize by the type of concepts Categorize by the type of concepts they use to describe the database they use to describe the database structurestructure

High level or Conceptual Data High level or Conceptual Data ModelModel

Low-level or Physical Data ModelLow-level or Physical Data Model

Representational or Representational or Implementation Data ModelImplementation Data Model

Page 5: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Low Level Data Low Level Data ModelModel provide concepts that provide concepts that

describe the details of how describe the details of how data is stored in the data is stored in the computer. Usually provided computer. Usually provided for specialists, not for typical for specialists, not for typical end users.end users.

Page 6: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

High Level or Conceptual High Level or Conceptual Data ModelData Model

provide concepts that are closed provide concepts that are closed to the way many users perceive to the way many users perceive data.data.

Example: use concepts such as Example: use concepts such as entities, attributes, and relationships entities, attributes, and relationships among two or more entities.among two or more entities.

Faculty

Fcode F_name

Department

Dcode D_name

Compose of1 N

Student

D_code D_name

in

1

N

Page 7: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Representation or Representation or Implementation Data ModelsImplementation Data Models

provide concepts that may be provide concepts that may be understood by end users but they understood by end users but they are not too far removed from the are not too far removed from the way data is organized with in the way data is organized with in the computer. This hide some details of computer. This hide some details of data storage but can be data storage but can be implemented on a computer system implemented on a computer system in a direct way.in a direct way.

FcodeFcode F_name FcodeFcode DcodeDcode D_name

FcodeFcode DcodeDcodeS_AddS_nameSIDSID

Faculty

Student

Department

Page 8: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Schemas, Instances, and Schemas, Instances, and Database StateDatabase State

Database Schema – is the description of a data baseis the description of a data base– specified during database design specified during database design – and is not expect to change frequencyand is not expect to change frequency

Schema DiagramSchema Diagram– A displayed schema example the diagram displays the A displayed schema example the diagram displays the

structure of each record type but not the instance records.structure of each record type but not the instance records.– It displays only some aspect schema, for example name of It displays only some aspect schema, for example name of

record types and data items and some type of constraintsrecord types and data items and some type of constraints

Database stateDatabase state or snapshot or snapshot– is the data in the database at a particular moment in time.is the data in the database at a particular moment in time.– Also called the current set of occurrences or instances in Also called the current set of occurrences or instances in

the databasethe database

Page 9: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Distinction between database Distinction between database schema and database stateschema and database state– When define a new database => When define a new database =>

specify only specify only database schema to DBMS

– At this point “database state is empty state” no data.

– Get initial state => loaded with initial data

– At any point in time, the database has a current state (current snapshot)

– DBMS stores the descriptions of the schema constructs and constraints (called meta-datameta-data) in DBMS CatalogDBMS Catalog

Page 10: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

The three levels of the The three levels of the ArchitectureArchitecture

The The ANSI/SPARE ANSI/SPARE architecture is architecture is divided into 3 divided into 3 levelslevels

Internal LevelInternal Level

External LevelExternal Level

Conceptual Conceptual LevelLevel

……..External level

(Individual user Views)

Conceptual level(community user

View)

Internal level(Storage View)

Page 11: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

External ViewExternal View

External level is individual user lever.External level is individual user lever. Each user has a language Each user has a language

– For application programmer, the language For application programmer, the language will be either will be either

conventional programming language (e.g. Java, conventional programming language (e.g. Java, C++) C++)

Fourth-generation languageFourth-generation language

– For the end user, the language will be either For the end user, the language will be either a query language (SQL) a query language (SQL) Special purpose language perhaps forms, or Special purpose language perhaps forms, or

menu driven, tailored to that user’s requirements menu driven, tailored to that user’s requirements and supported by some applicationand supported by some application

Page 12: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Conceptual Conceptual LevelLevel Conceptual view is aConceptual view is a representation of the representation of the entire information content of the database.entire information content of the database.

The conceptual view consists of many types of The conceptual view consists of many types of conceptual record. conceptual record.

The conceptual view is The conceptual view is defined by means of the defined by means of the conceptual schemaconceptual schema, which , which includes definitions includes definitions of each of the various conceptual record types.of each of the various conceptual record types.

The conceptual schema is written using another data The conceptual schema is written using another data definition language, the definition language, the conceptual DDLconceptual DDL. .

The conceptual DDL definitions The conceptual DDL definitions must not involve must not involve any considerations of physical representationany considerations of physical representation or access techniques at all.or access techniques at all.

They must be They must be no referenceno reference in the conceptual in the conceptual schema to stored field representation, stored record schema to stored field representation, stored record sequence, indexes, hashing schemas, pointer, or any sequence, indexes, hashing schemas, pointer, or any storage and access details.storage and access details.

Page 13: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Internal LevelInternal Level Internal View is a low-level representation of Internal View is a low-level representation of

the entire database; it consist of many the entire database; it consist of many occurrences of many types of occurrences of many types of internal recordinternal record..

Internal record is the ANSI/SPARE term for the Internal record is the ANSI/SPARE term for the construct that we have been calling a construct that we have been calling a stored stored recordrecord. .

The internal view is The internal view is described by meansdescribed by means of of the the internal schema, internal schema, which which not only defines not only defines the various stored record types but also the various stored record types but also specifics what indexes exist, how stored specifics what indexes exist, how stored fields are representedfields are represented, what physical , what physical sequence the stored record are in, and so on.sequence the stored record are in, and so on.

The internal schema is written using yet The internal schema is written using yet another another data definition language – the data definition language – the internal DDLinternal DDL..

Page 14: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

ExampleExample

Employee

Employee_number Char(6)Department_Number Char(4)Salary Decimal(5)

Conceptual

Stored_Emp Bytes=20

PREFIX BYTES=6,OFFSET=0EMP# BYTES=6,OFFSET=6, INDEX=EMPXDEPT# BYTES=4,OFFSET=12,PAY#

BYTES=4,ALIGN=FULLWORD,OFFSET=16

Internal

DCL 1 EMPP, 01 EMPC.

2 EMP# CHAR(6) 02 EMPNO PIC X(6).

2 SAL FIXED BN(31); 02 DEPTNO PIC X(4).

External 1 External 1

Page 15: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Host Language

+DSL

Host Language

+DSL

Host Language

+DSL

Host Language

+DSL

Host Language

+DSL

User A1 User A2 User B1 User B2 User B3

External View A External View B

Conceptual View

Stored Database (Internal View)

Conceptual/Internalmapping

Conceptual/InternalMapping B

External/conceptualMapping A

Database Management

System(DBMS)

StorageStructureDefinition(internalSchema)

SchemasAnd

mappingsbuilt and

maintainedby

the databaseadministrator

(DBA)

*ExternalSchema

A

*ExternalSchema

B

*User interface

Page 16: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

MappingsMappings Conceptual/Internal mappingsConceptual/Internal mappings

– defines the correspondence between the defines the correspondence between the conceptual view and the stored database; conceptual view and the stored database;

– It specified how conceptual records and It specified how conceptual records and fields are represented at the internal level.fields are represented at the internal level.

– If the stored database is changes If the stored database is changes If theIf the change change has effect to the stored database has effect to the stored database

definition – then the conceptual/Internal definition – then the conceptual/Internal mapping must be changes accordinglymapping must be changes accordingly

The effects of changes must be isolated below The effects of changes must be isolated below the conceptual level, in order to preserve the conceptual level, in order to preserve physical data independencephysical data independence..

Page 17: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

External/Conceptual mappingExternal/Conceptual mapping– Defines the correspondence between a Defines the correspondence between a

particular external view and the particular external view and the conceptual view.conceptual view.

– Example field and record name change Example field and record name change

Page 18: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Data Data IndependenceIndependence Defines as the capacity to change Defines as the capacity to change

the schema at one level of a the schema at one level of a database system without having to database system without having to change the schema at the next change the schema at the next higher level.higher level.

Define 2 types of data independence.Define 2 types of data independence. Logical Data independenceLogical Data independence

Physical Data independencePhysical Data independence

Page 19: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Logical Data Logical Data independenceindependence

Logical Data independenceLogical Data independence is the is the capacity to change the conceptual capacity to change the conceptual schema without have to change external schema without have to change external schemas or application program. schemas or application program. – ExampleExample

Expand the database by adding record type or Expand the database by adding record type or data item.data item.

To change the constraintsTo change the constraints To reduce the database by removing a record To reduce the database by removing a record

typetype

– The external schemas that refer only to the The external schemas that refer only to the database should not be affected. database should not be affected.

Page 20: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

ExampleExample

FcodeFcode F_name FcodeFcode DcodeDcode D_name

Faculty

FcodeFcode DcodeDcodeS_AddS_nameSIDSID

Student

Department

TcodeTcode

FcodeFcode DcodeDcodeS_AddT_nameTcodeTcode

Teacher

Page 21: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Example 2Example 2

FcodeFcode F_name FcodeFcode DcodeDcode D_name

Faculty

FcodeFcode DcodeDcodeS_AddS_nameSIDSID

Student

Department

TcodeTcode

FcodeFcode DcodeDcodeS_AddT_nameTcodeTcode

Teach

Select sid, sname, T_name from teacher1

Create view teacher1 as select sid ,sname, T_name from student, teachwhere student.tcode = teach.tcode

Create view teacher1 as select sid ,sname, T_namefrom student, teacher where student.tcode = teacher.tcode

Teacher

Page 22: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Physical Data Physical Data independenceindependence

Physical Data independencePhysical Data independence is is the capacity to change the the capacity to change the conceptual schema, the external conceptual schema, the external schemas need not be changed. schemas need not be changed. – Change may be needed because some Change may be needed because some

physical files had to be reorganized physical files had to be reorganized – ExampleExample

Creating additional access structures to Creating additional access structures to improve the performance of retrieval or improve the performance of retrieval or updateupdate

Page 23: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Database language and Database language and interfaceinterface DBMS languageDBMS language

– Data definition language (DDL) is Data definition language (DDL) is used by DBA and database designer used by DBA and database designer to define schemas.to define schemas.

– Storage Definition Language (SDL) is Storage Definition Language (SDL) is used to specify internal schemaused to specify internal schema

– Data Manipulation Language (DML) Data Manipulation Language (DML) is a set of operation for retrieval is a set of operation for retrieval insertion deletion and modifies the insertion deletion and modifies the data.data.

Page 24: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

DBMS InterfacesDBMS Interfaces Menu Based Interfaces for web Menu Based Interfaces for web

Clients or Browsing.Clients or Browsing. Form Based InterfacesForm Based Interfaces Graphical User InterfacesGraphical User Interfaces Natural Languages InterfacesNatural Languages Interfaces Interface of Parametric UsersInterface of Parametric Users Interfaces for the DBAInterfaces for the DBA

Page 25: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

The Database System The Database System EnvironmentEnvironment

DBMS Component ModulesDBMS Component Modules

Page 26: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Component modules of a DBMS and their Component modules of a DBMS and their interactionsinteractions

Stored DatabaseStored Database

Concurrency control/Backup/Recovery subsystem

Stored Data Manager

Run-timeDatabaseProcessor

System Catalog/

DataDictionary

QueryComplier

DDLComplier

COMPILESTransaction

DMLSTATEMENTS

DMLComplier

Host LanguageCompiler

Precompiled

APPLICATIONPROGRAMS

Application Programmers

A

E

B

C

D

execution

INTERACTIVEQuery

DDLSTATEMENTS

PRIVILEGEDPRIVILEGEDCOMMANDSCOMMANDS

execution

Parametricusers

DBA staffCasualusers

Page 27: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Data DictionaryData Dictionary The DBMS must provide a data dictionary The DBMS must provide a data dictionary

function.function. The data dictionary is a system database (not The data dictionary is a system database (not

user database)user database) It contains “data about the data” called “meta-It contains “data about the data” called “meta-

data or descriptor” – that is, definitions of those data or descriptor” – that is, definitions of those objects in the system, instead of just “raw objects in the system, instead of just “raw data”.data”.

It will keep all of various schemas and mapping It will keep all of various schemas and mapping and all of the various security and integrity and all of the various security and integrity constraints, both source and object form.constraints, both source and object form.

Other terms are “dictionary”, “catalog”, “data Other terms are “dictionary”, “catalog”, “data repository”.repository”.

Page 28: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Database System Database System UtilitiesUtilitiesDatabase Utility helps the DBA in Database Utility helps the DBA in

managing the Database systemmanaging the Database systemLoading : Loading : to create the initial version of the to create the initial version of the database from regular data filedatabase from regular data file

Backup/RestoreBackup/Restore

File reorganizationFile reorganization

Performance MonitoringPerformance Monitoring

Page 29: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Centralized and Centralized and Client/Server Architecture Client/Server Architecture for DBMSsfor DBMSs Centralized DBMSs Centralized DBMSs

ArchitectureArchitecture– Centralized DBMS => all DBMS Centralized DBMS => all DBMS

functionfunction– All processing was performed All processing was performed

remotely on the computer system, remotely on the computer system, only display information and controls only display information and controls were sent from the computer to were sent from the computer to display terminaldisplay terminal

Page 30: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Basic Client/ServerBasic Client/Server Idea is to define specialized servers with Idea is to define specialized servers with

specific functionalities.specific functionalities.

Client machines provide the user with the Client machines provide the user with the appropriate interfaces to utilize the server, appropriate interfaces to utilize the server, and local processing power to run local and local processing power to run local application.application.

Client is a user machineClient is a user machine that provide user that provide user interface capabilities and local processing. interface capabilities and local processing. When requires process not in that machine it When requires process not in that machine it connects to a server that provide the needed connects to a server that provide the needed functions.functions.

Server is a machineServer is a machine that can provide service that can provide service to the client machine.to the client machine.

Page 31: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Two main type of basic Two main type of basic DBMS architectures on DBMS architectures on client/server frame workclient/server frame work

Two-tier Client/Server Architecture

Three-tier Client/Server Architecture

Page 32: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Two-tier Client/ServerTwo-tier Client/Server

Clientsite1

ClientSite2

ServerSite3

ServerClientSite n

……

Communication Network

Page 33: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Three-tier Client/Server Three-tier Client/Server ArchitectureArchitecture

GUIWeb Interface

ApplicationProgram

Web Pages

Database Management

System

Client

Application ServerOr

Web server

DatabaseDatabaseServerServer

This server plays an intermediate role by storing business rule (procedure/constraints) that are used to access data from the database server. Also improve database security.

Client contain GUI interface and some additional business rule

Page 34: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Classification of DBMSClassification of DBMS By Data ModelBy Data Model

– Relational Data ModelRelational Data Model– Object Data ModelObject Data Model– Hierarchical and Network Data ModelsHierarchical and Network Data Models

By numbers of users supported by the systemBy numbers of users supported by the system– Single User systemSingle User system– Multi User systemMulti User system

Number of SitesNumber of Sites– Centralized => the data stored at a single computer siteCentralized => the data stored at a single computer site– Distributed DBMS (DDBMS) => have the actual database Distributed DBMS (DDBMS) => have the actual database

and DBMS software distributed over many sitesand DBMS software distributed over many sites Homogenous DDBMSsHomogenous DDBMSs Heterogeneous DBMSsHeterogeneous DBMSs

PurposePurpose– General PurposeGeneral Purpose– Special PurposeSpecial Purpose

Page 35: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

SummarySummary Introduces the main concepts used in database Introduces the main concepts used in database

systemssystems Define Data model & distinguished three main Define Data model & distinguished three main

categories of data models:categories of data models:– High-level/ConceptualHigh-level/Conceptual– Low LevelLow Level– Representation/ImplementationRepresentation/Implementation

Schema -> description of a databaseSchema -> description of a database Describe the three-schema DBMS architectureDescribe the three-schema DBMS architecture

– Internal, Conceptual and ExternalInternal, Conceptual and External Main types of languages and interfaces that DBMSs Main types of languages and interfaces that DBMSs

supportsupport– DDL - define Database conceptual schemaDDL - define Database conceptual schema– DSL – specifying views and storage structuresDSL – specifying views and storage structures– DML – retrieval, updateDML – retrieval, update

Classified DBMSClassified DBMS

Page 36: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Figure illustrates a typical variation of Oracle's memory and process structures

Page 37: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Memory Structures and Processes Memory Structures and Processes The mechanisms of ORACLE execute by using memory structures and The mechanisms of ORACLE execute by using memory structures and

processes. All memory structures exist in the main memory of the processes. All memory structures exist in the main memory of the computers that constitute the database system. Processes are jobs or computers that constitute the database system. Processes are jobs or tasks that work in the memory of these computers. tasks that work in the memory of these computers.

Memory Structures Memory Structures ORACLE creates and uses memory structures to complete several ORACLE creates and uses memory structures to complete several

jobs. For example, memory is used to store program code being jobs. For example, memory is used to store program code being executed and data that is shared among users. Several basic executed and data that is shared among users. Several basic memory structures are associated with ORACLE: the system global memory structures are associated with ORACLE: the system global area (which includes the database and redo log buffers, and the area (which includes the database and redo log buffers, and the shared pool) and the program global area. shared pool) and the program global area.

SystemSystem Global Area (SGA)Global Area (SGA) is a shared memory region is a shared memory region allocated by allocated by ORACLE that contains data and control information for one ORACLE ORACLE that contains data and control information for one ORACLE instance. instance.

An ORACLE instance contains the SGA and the background An ORACLE instance contains the SGA and the background processes. processes.

The SGA is allocated when an instance starts and deallocated when The SGA is allocated when an instance starts and deallocated when the instance shuts down. Each instance that is started has its own the instance shuts down. Each instance that is started has its own SGA. SGA.

The The Program Global Area (PGA)Program Global Area (PGA) is a memory buffer that contains is a memory buffer that contains data and control information for a server processdata and control information for a server process. A PGA is created by . A PGA is created by ORACLE when a server process is started. The information in a PGA ORACLE when a server process is started. The information in a PGA depends on the configuration of ORACLE. depends on the configuration of ORACLE.

Page 38: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Database Structures Database Structures The relational model has three major aspects: The relational model has three major aspects: StructuresStructures

– Structures are well-defined objects that store the data of Structures are well-defined objects that store the data of a database. Structures and the data contained within a database. Structures and the data contained within them can be manipulated by operations. them can be manipulated by operations.

OperationsOperations – Operations are clearly defined actions that allow users to Operations are clearly defined actions that allow users to

manipulate the data and structures of a database. The manipulate the data and structures of a database. The operations on a database must adhere to a pre-defined operations on a database must adhere to a pre-defined set of integrity rules. set of integrity rules.

Integrity RuleIntegrity Rule – Integrity rules are the laws that govern which operations Integrity rules are the laws that govern which operations

are allowed on the data and structures of a database. are allowed on the data and structures of a database. Integrity rules protect the data and the structures of a Integrity rules protect the data and the structures of a database.database.

Page 39: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

An ORACLE database has both a physical and a logical An ORACLE database has both a physical and a logical structurestructure. By separating physical and logical database . By separating physical and logical database structure, the physical storage of data can be managed without structure, the physical storage of data can be managed without affecting the access to logical storage structures. affecting the access to logical storage structures.

Logical Database Structure Logical Database Structure An ORACLE database's logical structure is determined by: one or An ORACLE database's logical structure is determined by: one or

more tablespaces. more tablespaces.

the database's schema objects (e.g., tables, views, indexes, the database's schema objects (e.g., tables, views, indexes, clusters, sequences, stored procedures). clusters, sequences, stored procedures).

The logical storage structures, including tablespaces, segments, The logical storage structures, including tablespaces, segments, and extents, dictate how the physical space of a database is and extents, dictate how the physical space of a database is used. The schema objects and the relationships among them used. The schema objects and the relationships among them form the relational design of a database.form the relational design of a database.

Page 40: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data

Tablespaces and Data Files Tablespaces and Data Files Tablespaces are the primary logical storage Tablespaces are the primary logical storage structures of any ORACLE database. The usable data of an ORACLE database structures of any ORACLE database. The usable data of an ORACLE database is logically stored in the tablespaces and physically stored in the data files is logically stored in the tablespaces and physically stored in the data files associated with the corresponding tablespace. Figure 2 illustrates this associated with the corresponding tablespace. Figure 2 illustrates this relationship. relationship.

Although databases, tablespaces, data files, and segments are closely Although databases, tablespaces, data files, and segments are closely related, they have important differences: related, they have important differences:

databases and tablespaces databases and tablespaces – An ORACLE database is comprised of one or more logical storage units called An ORACLE database is comprised of one or more logical storage units called

tablespaces. The database's data is collectively stored in the database's tablespaces. The database's data is collectively stored in the database's tablespaces. tablespaces.

tablespaces and data files tablespaces and data files – Each tablespace in an ORACLE database is comprised of one or more operating Each tablespace in an ORACLE database is comprised of one or more operating

system files called data files. A tablespace's data files physically store the system files called data files. A tablespace's data files physically store the associated database data on disk. associated database data on disk.

databases and data files databases and data files – A database's data is collectively stored in the data files that constitute each A database's data is collectively stored in the data files that constitute each

tablespace of the database. For example, the simplest ORACLE database would tablespace of the database. For example, the simplest ORACLE database would have one tablespace, with one data file. A more complicated database might have have one tablespace, with one data file. A more complicated database might have three tablespaces, each comprised of two data files (for a total of six data files). three tablespaces, each comprised of two data files (for a total of six data files).

schema objects, segments, and tablespaces schema objects, segments, and tablespaces – When a schema object such as a table or index is created, its segment is created When a schema object such as a table or index is created, its segment is created

within a designated tablespace in the database. For example, suppose a table is within a designated tablespace in the database. For example, suppose a table is created in a specific tablespace using the CREATE TABLE command with the created in a specific tablespace using the CREATE TABLE command with the TABLESPACE option. The space for this table's data segment is allocated in one or TABLESPACE option. The space for this table's data segment is allocated in one or more of the data files that constitute the specified tablespace. An object's segment more of the data files that constitute the specified tablespace. An object's segment allocates space in only one tablespace of a database. allocates space in only one tablespace of a database.

Page 41: Database system concept and Architecture. Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data Models, Schemas, and Instance Data