Download presentation
1
Database system concept and Architecture
2
Data Models, Schemas, and Instance
Categories of Data Models Schemas, Instance, and Database State Three-schema Architecture and Data Independence The three levels of the Architecture Data Independence Database languages and Interface DBMS Language DBMS Interfaces The Database System Environment DBMS component Modules Database system Utilities Centralize and Client/Server Architectures for DBMSs Basic Client/Server Two-tier Client/Server Architecture for DBMSs Three-tier Client/Server Architectures for Web Applications Classification of Database Management Systems Summary
3
Data Models, Schemas, and Instance
Data Model: a collection of concepts that can be use to describes the structure of a database – provides the necessary means to achieve this abstractions. Structure of Database mean the data types, relationships, and constraints that should hold for the data.
4
Categories of Data Models
Categorize by the type of concepts they use to describe the database structure High level or Conceptual Data Model Low-level or Physical Data Model Representational or Implementation Data Model
5
Low Level Data Model provide concepts that describe the details of how data is stored in the computer. Usually provided for specialists, not for typical end users.
6
High Level or Conceptual Data Model
provide concepts that are closed to the way many users perceive data. Example: use concepts such as entities, attributes, and relationships among two or more entities. Faculty Fcode F_name Department Dcode D_name Compose of 1 N Student D_code in
7
Representation or Implementation Data Models
provide concepts that may be understood by end users but they are not too far removed from the way data is organized with in the computer. This hide some details of data storage but can be implemented on a computer system in a direct way. Faculty Department Fcode F_name Fcode Dcode D_name Student Fcode Dcode S_Add S_name SID
8
Schemas, Instances, and Database State
Database Schema is the description of a data base specified during database design and is not expect to change frequency Schema Diagram A displayed schema example the diagram displays the structure of each record type but not the instance records. It displays only some aspect schema, for example name of record types and data items and some type of constraints Database state or snapshot is the data in the database at a particular moment in time. Also called the current set of occurrences or instances in the database
9
Distinction between database schema and database state
When define a new database => 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-data) in DBMS Catalog
10
The three levels of the Architecture
…….. External level (Individual user Views) Conceptual level (community user View) Internal level (Storage View) The ANSI/SPARE architecture is divided into 3 levels Internal Level External Level Conceptual Level
11
External View External level is individual user lever.
Each user has a language For application programmer, the language will be either conventional programming language (e.g. Java, C++) Fourth-generation language For the end user, the language will be either a query language (SQL) Special purpose language perhaps forms, or menu driven, tailored to that user’s requirements and supported by some application
12
Conceptual Level Conceptual view is a representation of the entire information content of the database. The conceptual view consists of many types of conceptual record. The conceptual view is defined by means of the conceptual schema, which includes definitions of each of the various conceptual record types. The conceptual schema is written using another data definition language, the conceptual DDL. The conceptual DDL definitions must not involve any considerations of physical representation or access techniques at all. They must be no reference in the conceptual schema to stored field representation, stored record sequence, indexes, hashing schemas, pointer, or any storage and access details.
13
Internal Level Internal View is a low-level representation of the entire database; it consist of many occurrences of many types of internal record. Internal record is the ANSI/SPARE term for the construct that we have been calling a stored record. The internal view is described by means of the internal schema, which not only defines the various stored record types but also specifics what indexes exist, how stored fields are represented, what physical sequence the stored record are in, and so on. The internal schema is written using yet another data definition language – the internal DDL.
14
Example External 1 DCL 1 EMPP, 01 EMPC.
2 EMP# CHAR(6) EMPNO PIC X(6). 2 SAL FIXED BN(31); DEPTNO PIC X(4). External 1 Employee Employee_number Char(6) Department_Number Char(4) Salary Decimal(5) Conceptual Stored_Emp Bytes=20 PREFIX BYTES=6,OFFSET=0 EMP# BYTES=6,OFFSET=6, INDEX=EMPX DEPT# BYTES=4,OFFSET=12, PAY# BYTES=4,ALIGN=FULLWORD,OFFSET=16 Internal จากตัวอย่างที่แสดงในภาพนั้นจะพบว่า ในระดับหลักการฐานข้อมูลประกอบด้วยข้อมูลของเอนติตีพนักงาน (Employee) โดยที่ข้อมูลของพนักงานแต่ละคนประกอบด้วย รหัสประจำตัวพนักงาน (Employee_number) ซึ่งเป็นตัวอักษร 6 หลัก รหัสแผนก (Department_number) เก็บในรูปตัวอักษรขนาด 4 หลัก และเงินเดือน (Salary) ซึ่งจัดเก็บบันทึกโดยมีชนิดของข้อมูลเป็นตัวเลขขนาด 5 หลัก ในระดับภายในแสดงของข้อมูลที่เก็บบันทึกในสื่อที่เก็บบันทึกจริง ในรูปของ stored record ชื่อ Stored_emp มีความยาวในการจัดเก็บทั้งสิ้น 20 ไบต์ โดยใช้ 6 ไบต์สำหรับ prefix ซึ่งเก็บรายละเอียดเกี่ยวกับ Control Information และมี Stored_emp มีการสร้างดัชนีเรียงตาม EMP# โดยเก็บในแฟ้มดัชนีชื่อ empx ซึ่งรายละเอียดในส่วนนี้ผู้ใช้ไม่เป็นต้องทราบ ระดับภายนอกเป็นส่วนของผู้ใช้แต่ละกลุ่มมองเห็นข้อมูล ซึ่งจะแตกต่างกันไปขึ้นกับสิทธิในการมองเห็นและลักษณะการใช้งานแตกต่างกันไปด้วย เช่นกรณีตัวอย่างผู้ใช้ภาษา C ทำการประมวลผลกับข้อมูลในฐานข้อมูลโดยใช้ภาษา C สิ่งที่ผู้ใช้สนใจคือระเบียน emp ที่แสดงในรูปของภาษา C ประกอบด้วย 2 ฟิลด์ คือ empno และ salary ผู้ใช้ COBOL ซึ่งทำการประมวลผลโดยใช้ภาษา COBOL สิ่งที่ผู้ใช้สนใจคือระเบียน EMPC ซึ่งประกอบด้วย 2 ฟิลด์คือ empno และ deptno
15
Stored Database (Internal View)
User A1 User A2 User B1 User B2 User B3 Host Language +DSL Host Language +DSL Host Language +DSL Host Language +DSL Host Language +DSL External View A *External Schema B External View B *External Schema A External/conceptual Mapping A Conceptual/Internal Mapping B Schemas And mappings built and maintained by the database administrator (DBA) Database Management System (DBMS) Conceptual View Conceptual/Internal mapping Storage Structure Definition (internal Schema) Stored Database (Internal View) *User interface
16
Mappings Conceptual/Internal mappings
defines the correspondence between the conceptual view and the stored database; It specified how conceptual records and fields are represented at the internal level. If the stored database is changes If the change has effect to the stored database definition – then the conceptual/Internal mapping must be changes accordingly The effects of changes must be isolated below the conceptual level, in order to preserve physical data independence.
17
External/Conceptual mapping
Defines the correspondence between a particular external view and the conceptual view. Example field and record name change
18
Data Independence Defines as the capacity to change the schema at one level of a database system without having to change the schema at the next higher level. Define 2 types of data independence. Logical Data independence Physical Data independence
19
Logical Data independence
Logical Data independence is the capacity to change the conceptual schema without have to change external schemas or application program. Example Expand the database by adding record type or data item. To change the constraints To reduce the database by removing a record type The external schemas that refer only to the database should not be affected.
20
Example Fcode F_name Dcode D_name S_Add S_name SID Tcode Fcode Dcode
Faculty S_Add S_name SID Student Department Tcode Fcode Dcode S_Add T_name Teacher
21
Example 2 Teach Fcode F_name Dcode D_name S_Add S_name SID Tcode
Faculty S_Add S_name SID Student Department Tcode T_name Teach Teacher Create view teacher1 as select sid ,sname, T_name from student, teach where student.tcode = teach.tcode Create view teacher1 as select sid ,sname, T_name from student, teacher where student.tcode = teacher.tcode Select sid, sname, T_name from teacher1
22
Physical Data independence
Physical Data independence is the capacity to change the conceptual schema, the external schemas need not be changed. Change may be needed because some physical files had to be reorganized Example Creating additional access structures to improve the performance of retrieval or update
23
Database language and interface
DBMS language Data definition language (DDL) is used by DBA and database designer to define schemas. Storage Definition Language (SDL) is used to specify internal schema Data Manipulation Language (DML) is a set of operation for retrieval insertion deletion and modifies the data.
24
DBMS Interfaces Menu Based Interfaces for web Clients or Browsing.
Form Based Interfaces Graphical User Interfaces Natural Languages Interfaces Interface of Parametric Users Interfaces for the DBA
25
The Database System Environment
DBMS Component Modules
26
Component modules of a DBMS and their interactions
Application Programmers DBA staff APPLICATION PROGRAMS Casual users Parametric users DDL STATEMENTS PRIVILEGED COMMANDS Precompiled INTERACTIVE Query Host Language Compiler DML STATEMENTS Query Complier COMPILES Transaction System Catalog/ Data Dictionary A E DDL Complier B DML Complier C Run-time Database Processor execution execution create table student (fCode varchar2(2), fname varchar2(30) primary key fcode); Stored Data Manager D Concurrency control/ Backup/Recovery subsystem Stored Database
27
Data Dictionary The DBMS must provide a data dictionary function.
The data dictionary is a system database (not user database) It contains “data about the data” called “meta-data or descriptor” – that is, definitions of those objects in the system, instead of just “raw data”. It will keep all of various schemas and mapping and all of the various security and integrity constraints, both source and object form. Other terms are “dictionary”, “catalog”, “data repository”.
28
Database System Utilities
Database Utility helps the DBA in managing the Database system Loading : to create the initial version of the database from regular data file Backup/Restore File reorganization Performance Monitoring
29
Tool and Application Environments, and Communications Facilities
Case tool Application Development environment Provide an environment for developing database applications including database design, GUI development, querying and updating and application program development. Power Builder (Sybase) JBuilder (Borland) Communication software Function allow users at location to remote from the database system site to access the database through the computer terminals, workstation, local computer. Case – Computer aided software engineering, used in primary for database design
30
Centralized and Client/Server Architecture for DBMSs
Centralized DBMSs Architecture Centralized DBMS => all DBMS function All processing was performed remotely on the computer system, only display information and controls were sent from the computer to display terminal
31
Basic Client/Server Idea is to define specialized servers with specific functionalities. Client machines provide the user with the appropriate interfaces to utilize the server, and local processing power to run local application. Client is a user machine that provide user interface capabilities and local processing. When requires process not in that machine it connects to a server that provide the needed functions. Server is a machine that can provide service to the client machine.
32
Two main type of basic DBMS architectures on client/server frame work
Two-tier Client/Server Architecture Three-tier Client/Server Architecture
33
Two-tier Client/Server
site1 Site2 Server Site3 Site n …… Communication Network Program establishes a connection to the DBMS ODBC : Open Database Connectivity (ODBC) provides an Application Programming Interface (API), which allows client-side program to call the DBMS
34
Three-tier Client/Server Architecture
Client contain GUI interface and some additional business rule GUI Web Interface Application Program Web Pages Database Management System Client Application Server Or Web server Server 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.
35
Classification of DBMS
By Data Model Relational Data Model Object Data Model Hierarchical and Network Data Models By numbers of users supported by the system Single User system Multi User system Number of Sites Centralized => the data stored at a single computer site Distributed DBMS (DDBMS) => have the actual database and DBMS software distributed over many sites Homogenous DDBMSs Heterogeneous DBMSs Purpose General Purpose Special Purpose
36
Summary Introduces the main concepts used in database systems
Define Data model & distinguished three main categories of data models: High-level/Conceptual Low Level Representation/Implementation Schema -> description of a database Describe the three-schema DBMS architecture Internal, Conceptual and External Main types of languages and interfaces that DBMSs support DDL - define Database conceptual schema DSL – specifying views and storage structures DML – retrieval, update Classified DBMS
37
Figure illustrates a typical variation of Oracle's memory and process structures
38
Memory Structures and Processes
The mechanisms of ORACLE execute by using memory structures and processes. All memory structures exist in the main memory of the computers that constitute the database system. Processes are jobs or tasks that work in the memory of these computers. Memory Structures ORACLE creates and uses memory structures to complete several jobs. For example, memory is used to store program code being executed and data that is shared among users. Several basic memory structures are associated with ORACLE: the system global area (which includes the database and redo log buffers, and the shared pool) and the program global area. System Global Area (SGA) is a shared memory region allocated by ORACLE that contains data and control information for one ORACLE instance. An ORACLE instance contains the SGA and the background processes. The SGA is allocated when an instance starts and deallocated when the instance shuts down. Each instance that is started has its own SGA. The Program Global Area (PGA) is a memory buffer that contains data and control information for a server process. A PGA is created by ORACLE when a server process is started. The information in a PGA depends on the configuration of ORACLE.
39
The relational model has three major aspects: Structures
Database Structures The relational model has three major aspects: Structures Structures are well-defined objects that store the data of a database. Structures and the data contained within them can be manipulated by operations. Operations Operations are clearly defined actions that allow users to manipulate the data and structures of a database. The operations on a database must adhere to a pre-defined set of integrity rules. Integrity Rule Integrity rules are the laws that govern which operations are allowed on the data and structures of a database. Integrity rules protect the data and the structures of a database.
40
An ORACLE database has both a physical and a logical structure
An ORACLE database has both a physical and a logical structure. By separating physical and logical database structure, the physical storage of data can be managed without affecting the access to logical storage structures. Logical Database Structure An ORACLE database's logical structure is determined by: one or more tablespaces. the database's schema objects (e.g., tables, views, indexes, clusters, sequences, stored procedures). The logical storage structures, including tablespaces, segments, and extents, dictate how the physical space of a database is used. The schema objects and the relationships among them form the relational design of a database.
41
databases and tablespaces
Tablespaces and Data Files Tablespaces are the primary logical storage 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 associated with the corresponding tablespace. Figure 2 illustrates this relationship. Although databases, tablespaces, data files, and segments are closely related, they have important differences: databases and tablespaces 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. tablespaces and data files 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 associated database data on disk. databases and data files 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 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). schema objects, segments, and tablespaces 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 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 more of the data files that constitute the specified tablespace. An object's segment allocates space in only one tablespace of a database.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.