Sei sulla pagina 1di 47

What Is a DBMS? A very large, integrated collection of data. Models real-worldenterprise.

Entities Relationships ADatabase Management System (DBMS) is a software package designed to store and manage databases. Why Use a DBMS? Data independence and efficient access. Reduced application development time. Data integrity and security. Uniform data administration. Concurrent access, recovery from crashes. Data Models A data model is a collection of concepts for describing data. A schema is a description of a particular collection of data, using the a given data model. Therelational model of data is the most widely used model today. Main concept: relation, basically a table with rows and columns. Every relation has aschema, which describes the columns, or fields. Page 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke

7 Levels of Abstraction Manyviews, single conceptual (logical) schema andphysical schema. Views describe how users see the data. Conceptual schema defines logical structure Physical schema describes the files and indexes used. * Schemas are defined using DDL; data is modified/queried using DML. Physical Schema Conceptual Schema View 1 View 2 View 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 8 Example: University Database Conceptual schema: Students(sid: string, name: string, login: string, age: integer, gpa:real) Courses(cid: string, cname:string, credits:integer) Enrolled(sid:string, cid:string, grade:string) Physical schema: Relations stored as unordered files. Index on first column of Students. External Schema (View): Course_info(cid:string,enrollment:integer) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke

9 Data Independence * Applications insulated from how data is structured and stored. Logical data independence: Protection from changes inlogicalstructure of data. Physical data independence: Protection from changes inphysical structure of data. * One of the most important benefits of using a DBMS! Page 4 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 10 Concurrency Control Concurrent execution of user programs is essential for good DBMS performance. Because disk accesses are frequent, and relatively slow, it is important to keep the cpu humming by working on several user programs concurrently. Interleaving actions of different user programs can lead to inconsistency: e.g., check is cleared while account balance is being computed. DBMS ensures such problems dont arise: users can pretend they are using a single-user system. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 11 Transaction: An Execution of a DB Program

Key concept istransaction, which is anatomic sequence of database actions (reads/writes). Each transaction, executed completely, must leave the DB in aconsistent state if DB is consistent when the transaction begins. Users can specify some simpleintegrity constraints on the data, and the DBMS will enforce these constraints. Beyond this, the DBMS does not really understand the semantics of the data. (e.g., it does not understand how the interest on a bank account is computed). Thus, ensuring that a transaction (run alone) preserves consistency is ultimately the users responsibility! Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 12 Scheduling Concurrent Transactions DBMS ensures that execution of {T1, ... , Tn} is equivalent to someserial execution T1 ... Tn. Before reading/writing an object, a transaction requests a lock on the object, and waits till the DBMS gives it the lock. All locks are released at the end of the transaction. (Strict 2PL locking protocol.) Idea: If an action of Ti (say, writing X) affects Tj (which perhaps reads X), one of them, say Ti, will obtain the lock on X first and Tj is forced to wait until Ti completes; this effectively orders the transactions. What if Tj already has a lock on Y and Ti later requests a lock on Y? (Deadlock!) Ti or Tj is aborted and restarted! Page 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 13 Ensuring Atomicity

DBMS ensuresatomicity (all-or-nothing property) even if system crashes in the middle of a Xact. Idea: Keep alog (history) of all actions carried out by the DBMS while executing a set of Xacts: Before a change is made to the database, the corresponding log entry is forced to a safe location. (WAL protocol; OS support for this is often inadequate.) After a crash, the effects of partially executed transactions areundone using the log. (Thanks to WAL, if log entry wasnt saved before the crash, corresponding change was not applied to database!) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 14 The Log The following actions are recorded in the log: Ti writes an object: the old value and the new value. Log record must go to diskbefore the changed page! Ti commits/aborts: a log record indicating this action. Log records chained together by Xact id, so its easy to undo a specific Xact (e.g., to resolve a deadlock). Log is often duplexed andarchived on stable storage. All log related activities (and in fact, all CC related activities such as lock/unlock, dealing with deadlocks etc.) are handled transparently by the DBMS. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 15 Databases make these folks happy ... End users and DBMS vendors

DB application programmers E.g. smart webmasters Database administrator (DBA) Designs logical /physical schemas Handles security and authorization Data availability, crash recovery Database tuning as needs evolve Must understand how a DBMS works! Page 6 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 16 Structure of a DBMS A typical DBMS has a layered architecture. The figure does not show the concurrency control and recovery components. This is one of several possible architectures; each system has its own variations. Query Optimization and Execution Relational Operators Files and Access Methods Buffer Management Disk Space Management

DB These layers must consider concurrency control and recovery Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 17 Summary DBMS used to maintain, query large datasets. Benefits include recovery from system crashes, concurrent access, quick application development, data integrity and security. Levels of abstraction give data independence. A DBMS typically has a layered architecture. DBAs hold responsible jobs and are well-paid! DBMS R&D is one of the broadest, most exciting areas in CS.
This is the html version of the file http://www.rrcap.unep.org/male/manual/dataRepoting/05AnnexIII.pdf. Google automatically generates html versions of documents as we crawl the web. Page 1

Data Base Management System DBMS-1

What is Data Base Management System DBMS Softwares

Data Base Structure Creating Data Base Editing Data Base Querying Data Base Relational Power of Data Base Integration of Numeric and Spatial Data

Annex III: Data Base Management System

Page 2

Data Base Management System DBMS-2

.
Bio-Physical Applications Socio-Economic Applications DBMS Data Base Reporting

Fig. 1: Data Base Management System in Environmental Reporting

Page 3

Data Base Management System DBMS-3

What is Data Base Management System Data base management system (DBMS) is a program that serves as an interface between application programs and a set of coordinated and integrated files called a data base. Before the use of DBMS there was little, if any, integration or data sharing among the functional information systems. However, there are many opportunities for these systems to share the same data. For instance, the deforestation application could share data with the land use information system. Data base management systems are an interface between the functional applications and the data base, as shown in fig. 1. The DBMS allows the various functional systems to access the same data. The DBMS can pool together related data from deferent files. DBMS is perhaps the most important tool in decision making for sustainable development

Page 4

Data Base Management System DBMS-4

DBMS Softwares

There are many softwares which can do the job required in DBMS. These softwares are based on the same basic structures but may have different outlooks. Some commands may be available only in one or a few number versions. The syntax, menu system, and filenames may be somewhat different. Thus it takes a little time but not much to get familiar to another version another similar software. For numeric data: dBASE II, dBASE III, dBASE III+, dBASE IV, dBASE V Foxbase, Foxbase+, Foxpro Access Paradox, etc. For spatial data: ARC/INFO ARCVIEW MAPINFO SPANS, etc. In exercise Foxpro will be used as an example to illustrate the database structure

Page 5

Data Base Management System DBMS-5

Data Base Structure

A database consists of a number of tables Each row is a record Each column is a field COUNTRY YEAR CH4_EMISSN SO2_EMISS N Bangladesh 1980 52369 13370 Bhutan 1980 9372 420 India 1980 4986 34 Each table is kept in a database file with the extension name .DBF Each field has: Field name (10 characters) Field width (fixed for each field) Field type : 5 types (Character, Numeric, Date, Logical, Memo, General, Float) Character: A combination of letters, numbers, spaces, and/or punctuation marks that are treated as

a text string. Numeric: A number consisting of a number, a decimal point, and, if it exists, the decimal part of the number. For example, the number 9999.99 requires a field with of 7 Date: An 8 character wide field having the format mm/dd/yy. Logical: A 1 character wide field containing a .T.(true or yes) or .F.(false or no). Memo: A memo field contains ASCII text. General: This field type stores data like pictures and graphs. Float: A floating field especially is just a special case of the numeric field type.
a field a record

Page 6

Data Base Management System DBMS-6

Creating Database Basic commands in creating a database file CREATE :Create a new database file BROWSE

:Edit and append in a similar manner to worksheet MODIFY STRUCTURE :Change the database structure USE :Open a database file CLOSE DATABASE :Close all database files CLEAR :Erase the screen QUIT :Exit the program

Page 7

Data Base Management System DBMS-7

Editing Database This section introduces you to commands used in editing database files APPEND :Adds a new record to the bottom of the current database and displays an entry mask to accommodate data input APPEND BLANK :Adds a new blank record but a data entry mask is not displayed when the BLANK clause is used INSERT : Place a new record after the current record.

INSERT BEFORE : The BEFORE clause adds the record before the current one. INSERT BLANK : Insert a blank record after the current one. EDIT :Edit the current record EDIT RECORD n :Edit the designated record EDIT FIELD Field1,Field2.. :Restrict the data entry mask to the named fields BROWSE Field1,Field2.. :Display a table that is restricted to the named fields DELETE : Mark the current record for deletion DELETE FOR Condition :Mark all records for deletion that meet the given condition PACK :Remove those records that have been marked for deletion

Page 8

Data Base Management System DBMS-8

COPY TO Dbfile :Copy the current database to the named file COPY STRUCTURE TO Filename : Copy the structure of the open database file to a new database file having the given name SORT ON Field TO Filename :Performing an ascending alphanumeric sort of the current database using one or more named fields as basis for the sort. The sorted output is copied to the named database file SORT ON Field TO Filename DESCENDING : The sorted database will be arranged in descending order

INDEX ON Field TO Indexname : Create an alphanumeric index based on the named (key) field. An index file, which has an extension like IDX, jumps the record pointer to the first record that contain the given value in the key field. REINDEX : Reindex an open index file; required when records are records are added or deleted without the index being open. USE Dbfile INDEX Indexfile : Open the database and index file together REPLACE Field WITH Value : Replace the content of the named field with the given value

Page 9

Data Base Management System DBMS-9

Querying Database Following is a list of math operators that are commonly used in querying data Symb ol Operator Example + Addition 3+5

Subtraction 5-3 * Multiplication 3*5 / Divide by 5/3 = Equal to X=3 > Greater than X>Y < Less than X<Y >= Greater than or equal to X>=Y <=

Less than or equal to X<=Y <> Not equal to X<>Y ^ Exponent 3^2 Commands commonly used in query operation. LOCATE FOR Field=value:Locates the first record in the open database file that contains a give value in the named field SET FILTER TO: This command is used to designate a group of records with in the current table COPY TO Dbfile FOR Condition :Copy those records matching the given condition to the named file COPY TO Dbfile WHILE Condition :Copy records to the specified database while a certain condition exits

Page 10

Data Base Management System DBMS-10

CREATE QUERY :Activate a query dialog box to

select the data of interest

Page 11

Data Base Management System DBMS-11

Relational Power of Database The real power of the database management system comes into play when you are using two or more related databases. For example, a typical air pollution database uses many different kinds of information including: Wet deposition Air concentration Land use These databases can be open at the same time and information can be extracted form different files. Each concurrently open file and any corresponding index files are maintained in what is called a work area. A work area is accessed using the SELECT command, described in the following command summary. The key to a successful exchange of information between open database files is to place the record pointer at the right record position within the involved database files. The record pointer stays in place

within each database until moved by a command. Work Area File Record No. The record pointer is moved within each database file by first selecting a database and then issuing a command such as LOCATE or GOTO.
1 wetdep 1 2 <-pointer 3 4 2 aircon 1 2 3 4 <-pointer 3 Landuse 1 <-pointer 2 3 4

Page 12

Data Base Management System DBMS-12

Command Summary The following command summary describes how multiple databases are opened. SELECT n :This command is used to select a work area into which a database file and corresponding index files are maintained. The expression n is the work area number. Example: SELECT 1 USE wetdep SELECT 2 USE aircon SELECT 3 USE landuse SELECT 1 BROWSE SELECT 2 BROWSE SELECT 3 BROWSE

Page 13

Data Base Management System DBMS-13

SET RELATION TO Fieldname INTO n : This command establishes a relationship between the currently elected database and the named database (using work area number). The relationship is established based on a common key field. Example: SELECT 1 USE wetdep INDEX wetdep SELECT 2 USE aircon INDEX aircon SET RELATION TO sitename INTO 1 BROWSE FIELDS wetdep.ph , aircon.so2

Page 14

Data Base Management System DBMS-14

JOIN WITH n TO newdatabasename FOR condition :This JOIN command creates a third database using fields from each of the two open database files. A common field, such as sitename, exists in the two supporting database files and can be used as a basis for joining records in the resulting database file.

Example: Put the two databases in work area 1 and 2: SELECT 1 USE landuse SELECT 2 USE wetdep With the two databases in work areas, you are ready to use the JOIN command. You join the two databases to see all values associated with landuse and wet deposition having matching names in the sitename field. Note that the population database was the last database selected, so it is presently active. JOIN WITH landuse TO both FOR sitename = landuse.sitename Joins the information into a new database named both. Now you can place the joined database, named both, in use and check the contents with the BROWSE command.

Page 15

Data Base Management System DBMS-15

Integration of Numeric and Spatial data Numeric data tables created in DBF file format can be joined with spatial data created by GIS softwares.

Foxpro also have the facility to edit the spatial coverages up to some extent. Following example explain entering numeric data into an ARC/INFO coverage. 1. open the file called pat.dbf using database program 2. Add one additional filed (so2) to accommodate SO2 data MODIFY STRUCTURE <Enter> 5. Enter SO2 concentrations of given monitoring sites 6. Complete the data entry and exit from database program 7. Examine the modification in GIS software ARC/VIEW
This is the html version of the file http://www.cs.sfu.ca/cc/354/zaiane/material/postscript/Chapter1.pdf. Google automatically generates html versions of documents as we crawl the web. Page 1
Chapter 1 Introduction

CMPT-354-Han-95.3 Lecture Notes September 10, 1995

1.0 Database Management Systems


1. A database management system DBMS , or simply a database

system DBS , consists of


A collection of interrelated and persistent data usually referred to as the database DB .

A set of application programs used to access, update and manage that data which form the data

management system MS . 2. The goal of a DBMS is to provide an environment that is both convenientand e cientto use in

Retrieving information from the database. Storing information into the database.

3. Databases are usually designed to manage large bodies of information. This involves

Definition of structures for information storage data modeling .

Provision of mechanisms for the manipulation of information file and systems structure, query process

ing . Providing for the safety of information in the database crash recovery and security .

Concurrency control if the system is shared by users.

1.1 Purpose of Database Systems


1. To see why database management systems are necessary, let's look at a typical file-processing system" supported by a conventional operating system. The application is a savings bank: Savings account and customer records are kept in permanent system files.

Application programs are written to manipulate files to perform the following tasks:

Debit or credit an account. Add a new account. Find an account balance. Generate monthly statements. 2. Development of the system proceeds as follows:

New application programs must be written as the need arises. New permanent files are created as required.

Page 2

2
CHAPTER 1. INTRODUCTION

but over a long period of time files may be in different formats, and
Application programs may be in different languages.

3. So we can see there are problems with the straight file-processing approach:

Data redundancy and inconsistency

Same information may be duplicated in several places. All copies may not be updated properly.

Difficulty in accessing data

May have to write a new application program to satisfy an unusual request. E.g. find all customers with the same postal code. Could generate this data manually, but a long job...

Data isolation

Data in different files. Data in different formats. Difficult to write new application programs.

Multiple users

Want concurrency for faster response time. Need protection for concurrent updates. E.g. two customers withdrawing funds from the same account at the same time | account has $500 in it, and they withdraw $100 and $50. The result could be $350, $400 or $450 if no protection.

Security problems

Every user of the system should be able to access only the data they are permitted to see. E.g. payroll people only handle employee records, and cannot see customer accounts; tellers only access account data and cannot see payroll data. Difficult to enforce this with application programs.

Integrity problems

Data may be required to satisfy constraints. E.g. no account balance below $25.00. Again, difficult to enforce or to change constraints with the fileprocessing approach. These problems and others led to the development of database

management systems.

1.2 Data Abstraction


1. The major purpose of a database system is to provide users with an abstract view of the system. The system hides certain details of how data is stored and maintained Complexity should be hidden from database users. 2. There are several levels of abstraction: a Physical Level:

How the data are stored. E.g. index, B-tree, hashing. Lowest level of abstraction. Complex low-level structures described in detail.

b Conceptual Level:

Next highest level of abstraction.

Page 3
1.3. DATA MODELS

3
view 1 view 2 view n conceptual level physical level

...
Figure 1.1: The three levels of data abstraction

Describes what data are stored. Describes the relationships among data. Database administrator level.

c View Level:

Highest level. Describes part of the database for a particular group of users. Can be many different views of a database.

E.g. tellers in a bank get a view of customer accounts, but not of payroll data.

Fig. ?? figure 1.1 in the text illustrates the three levels.

1.3 Data Models


1. Data modelsare a collection of conceptual tools for describing data, data relationships, data semantics and data constraints. There are three different groups: a Object-based Logical Models. b Record-based Logical Models. c Physical Data Models. We'll look at them in more detail now.

1.3.1 Object-based Logical Models


1. Object-based logical models:

Describe data at the conceptual and view levels. Provide fairly flexible structuring capabilities. Allow one to specify data constraints explicitly. Over 30 such models, including

Entity-relationship model.

Page 4

4
CHAPTER 1. INTRODUCTION

customer CustAcct account

name street city number balance

Figure 1.2: A sample E-R diagram. Object-oriented model. Binary model. Semantic data model. Infological model. Functional data model. 2. At this point, we'll take a closer look at the entity-relationship E-R and object-orientedmodels.

The E-R Model


1. The entity-relationship model is based on a perception of the world as consisting of a collection of basic

objects entities and relationshipsamong these objects.

An entityis a distinguishable object that exists. Each entity has associated with it a set of attributesdescribing it. E.g. number and balance for an account entity. A relationshipis an association among several entities.

e.g. A cust acct relationship associates a customer with each account he or she has.

The set of all entities or relationships of the same type is called the entity set or relationship set.

Another essential element of the E-R diagram is the mapping

cardinalities, which express the number


of entities to which another entity can be associated via a relationship set. We'll see later how well this model works to describe real world situations. 2. The overall logical structure of a database can be expressed graphically by an E-R diagram:

rectangles: represent entity sets. ellipses: represent attributes. diamonds: represent relationships among entity sets. lines: link attributes to entity sets and entity sets to relationships.

See figure ?? for an example.

The Object-Oriented Model


1. The object-oriented model is based on a collection of objects, like the E-R model. An object contains values stored in instance variables within the object.

Unlike the record-oriented models, these values are themselves objects.

Page 5
1.3. DATA MODELS

Thus objects contain objects to an arbitrarily deep level of nesting. An object also contains bodies of code that operate on the the object. These bodies of code are called methods.

Objects that contain the same types of values and the same methods are grouped into classes.

A class may be viewed as a type definition for objects. Analogy: the programming language concept of an abstract data type.

The only way in which one object can access the data of another object is by invoking the method of

that other object.

This is called sending a message to the object.

Internal parts of the object, the instance variables and method code, are not visible externally.

Result is two levels of data abstraction.

For example, consider an object representing a bank account.

The object contains instance variables number and balance.

The object contains a method pay-interest which adds interest to the balance.

Under most data models, changing the interest rate entails changing code in application programs.

In the object-oriented model, this only entails a change within the payinterest method.

2. Unlike entities in the E-R model, each object has its own unique identity, independent of the values it contains:

Two objects containing the same values are distinct.

Distinction is maintained in physical level by assigning distinct object identifiers.

1.3.2 Record-based Logical Models


1. Record-based logical models:

Also describe data at the conceptual and view levels. Unlike object-oriented models, are used to

Specify overall logical structure of the database, and Provide a higher-level description of the implementation. Named so because the database is structured in fixed-format records of several types.

Each record type defines a fixed number of fields, or attributes. Each field is usually of a fixed length this simplifies the implementation

Record-based models do not include a mechanism for direct representation of code in the database.

Separate languages associated with the model are used to express database queries and updates.

The three most widely-accepted models are the relational, network, This course will concentrate on the relationalmodel.

and hierarchical.

The network and hierarchicalmodels are covered in appendices in the text.

The Relational Model

Data and relationships are represented by a collection of tables.

Each tablehas a number of columns with unique names, e.g. customer, account.

Figure ?? shows a sample relational database.

Page 6

6
CHAPTER 1. INTRODUCTION

name street city number Lowery Maple Queens

900 Shiver North Bronx 556 Shiver North Bronx 647 Hodges Sidehill Brooklyn 801 Hodges Sidehill Brooklyn 647 name balance 900 55 556 100000 647 105366 801 10533 Figure 1.3: A sample relational database.
Lowery Maple Queens 900 55 Shiver North Bronx Hodges Sidehill

Brooklyn 100000 105366 647 801 10533 556

Figure 1.4: A sample network database

The Network Model

Data are represented by collections of records. Relationships among data are represented by links. Organization is that of an arbitrary graph. Figure ?? shows a sample network database that is the equivalent of the

relational database of Figure ??.

The Hierarchical Model

Similar to the network model.

Organization of the records is as a collection of trees, rather than arbitrary graphs.

Figure ?? shows a sample hierarchical database that is the equivalent of the relational database of Figure

??.
Lowery Queens Maple

Hodges Sidehill Brooklyn Shiver North Bronx 900 55 556 100000 647 105366 801 10533 647 105366

Figure 1.5: A sample hierarchical database

Page 7
1.4. INSTANCES AND SCHEMES

7 The relational model does not use pointers or links, but relates records by the values they contain. This allows a formal mathematical foundation to be defined.

1.3.3 Physical Data Models


1. Are used to describe data at the lowest level. 2. Very few models, e.g.

Unifying model. Frame memory.

3. We will not cover physical models.

1.4 Instances and Schemes


1. Databases change over time. 2. The information in a database at a particular point in time is called an instanceof the database. 3. The overall design of the database is called the database scheme. 4. Analogy with programming languages:

Data type definition scheme Value of a variable instance

5. There are several schemes, corresponding to levels of abstraction:

Physical scheme Conceptual scheme Subscheme can be many

1.5 Data Independence


1. The ability to modify a scheme definition in one level without affecting a scheme definition in a higher level is called data independence. 2. There are two kinds:

Physical data independence

The ability to modify the physical scheme without causing application programs to be rewritten

Modifications at this level are usually to improve performance

Logical data independence

The ability to modify the conceptual scheme without causing application programs to be rewritten Usually done when logical structure of database is altered 3. Logical data independence is harder to achieve as the application programs are usually heavily dependent on the logical structure of the data. An analogy is made to abstract data types in programming languages.

1.6 Data De nition Language DDL


1. Used to specify a database scheme as a set of definitions expressed in a DDL 2. DDL statements are compiled, resulting in a set of tables stored in a special file called a data dictionary or data directory.

Page 8

8
CHAPTER 1. INTRODUCTION

3. The data directory contains metadata data about data 4. The storage structure and access methods used by the database system are specified by a set of definitions

in a special type of DDL called a data storage and

definitionlanguage
5. basic idea: hide implementation details of the database schemes from the users

1.7 Data Manipulation Language DML


1. Data Manipulationis:

retrievalof information from the database insertionof new information into the database deletionof information in the database modificationof information in the database

2. A DML is a language which enables users to access and manipulate data. The goal is to provide efficient human interaction with the system. 3. There are two types of DML:

procedural: the user specifies what data is needed and how to get it nonprocedural: the user only specifies what data is needed

Easier for user May not generate code as efficient as that produced by procedural languages 4. A query languageis a portion of a DML involving information retrieval only. The terms DML and query

language are often used synonymously.

1.8 Database Manager


1. The database manager is a program module which provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. 2. Databases typically require lots of storage space gigabytes . This must be stored on disks. Data is moved between disk and main memory MM as needed. 3. The goal of the database system is to simplify and facilitate access to data. Performance is important. Views provide simplification. 4. So the database manager module is responsible for

Interaction with the file manager: Storing raw data on disk using

the file system usually provided by a conventional operating system. The database manager must translate DML statements into low-level file system commands for storing, retrieving and updating data in the database .

Integrity enforcement: Checking that updates in the database do not

violate consistency constraints e.g. no bank account balance below $25

Security enforcement: Ensuring that users only have access to Backup and recovery: Detecting failures due to power failure, disk

information they are permitted to see

crash, software errors, etc., and restoring the database to its state before the failure

Concurrency control: Preserving data consistency when there are

concurrent users. 5. Some small database systems may miss some of these features, resulting in simpler database managers. For example, no concurrency is required on a PC running MS-DOS. These features are necessary on larger systems.

Page 9
1.9. DATABASE ADMINISTRATOR

1.9 Database Administrator


1. The database administrator is a person having central control over data and programs accessing that data. Duties of the database administrator include:

Scheme definition: the creation of the original database scheme. This

involves writing a set of

definitions in a DDL data storage and definition language , compiled by the DDL compiler into a set of tables stored in the data dictionary.

Storage structure and access method definition: writing a set of

definitions translated by the data storage and definition language compiler

Scheme and physical organization modification: writing a set of

definitions used by the DDL compiler to generate modifications to appropriate internal system tables e.g. data dictionary . This is done rarely, but sometimes the database scheme or physical organization must be modified.

Granting of authorization for data access: granting different types

of authorization for data access to various users

Integrity constraint specification: generating integrity constraints.

These are consulted by the database manager module whenever updates occur.

1.10 Database Users


1. The database users fall into several categories:

Application programmersare computer professionals interacting

with the system through DML calls

embedded in a program written in a host language e.g. C, PL 1, Pascal . These programs are called application programs. The DML precompiler converts DML calls prefaced by a special character like $, , etc. to normal procedure calls in a host language. The host language compiler then generates the object code. Some special types of programming languages combine Pascal-like control structures with control structures for the manipulation of a database. These are sometimes called fourth-generation languages. They often include features to help generate forms and display data.

Sophisticated usersinteract with the system without writing

programs. They form requests by writing queries in a database query language. These are submitted to a query processor that breaks a DML statement down into instructions for the database manager module.

Specialized users are sophisticated users writing special database

application programs. These may be CADD systems, knowledge-based and expert systems, complex data systems audio video , etc.

Naive users are unsophisticated users who interact with the system by

using permanent application programs e.g. automated teller machine .

1.11 Overall System Structure


1. Database systems are partitioned into modules for different functions. Some functions e.g. file systems may be provided by the operating system. 2. Components include:

File manager manages allocation of disk space and data structures

used to represent information on disk.

Page 10

10
CHAPTER 1. INTRODUCTION application interfaces application program query database scheme DDL compiler query

processor DML precompiler application program object code database manager file manager data files data dictionary disk storage programmers application naive users sophisticated users database administrator

Figure 1.6: Database system structure.

Database manager: The interface between low-level data and Query processor translates statements in a query language into low-

application programs and queries.

level instructions the database

manager understands. May also attempt to find an equivalent but more efficient form.

DML precompilerconverts DML statements embedded in an

application program to normal procedure calls in a host language. The precompiler interacts with the query processor.

DDL compiler converts DDL statements to a set of tables containing

metadata stored in a data dictionary. In addition, several data structures are required for physical system implementation:

Data files: store the database itself.

Data dictionary: stores information about the structure of the database. It is used heavily. Great

emphasis should be placed on developing a good design and efficient implementation of the dictionary.

Indices: provide fast access to data items holding particular values.

3. Figure ?? shows these components.

Potrebbero piacerti anche