18
CSCI 453 -- DBMS Environm ent 1 The Database System Environment Dr. Awad Khalil Dr. Awad Khalil Computer Science Department Computer Science Department AUC AUC

The Database System Environment

  • Upload
    haig

  • View
    40

  • Download
    0

Embed Size (px)

DESCRIPTION

The Database System Environment. Dr. Awad Khalil Computer Science Department AUC. Content. DBMS Environment DBMS Utilities The System Catalog The Data Dictionary The System Catalog for Relational DBMS Accessing Catalog Information. Database System. DBMS Components. - PowerPoint PPT Presentation

Citation preview

Page 1: The Database System Environment

CSCI 453 -- DBMS Environment 1

The Database SystemEnvironment

Dr. Awad KhalilDr. Awad Khalil

Computer Science DepartmentComputer Science Department

AUCAUC

Page 2: The Database System Environment

CSCI 453 -- DBMS Environment 2

Content

DBMS EnvironmentDBMS Environment

DBMS UtilitiesDBMS Utilities

The System CatalogThe System Catalog

The Data DictionaryThe Data Dictionary The System Catalog for Relational DBMSThe System Catalog for Relational DBMS Accessing Catalog InformationAccessing Catalog Information

Page 3: The Database System Environment

CSCI 453 -- DBMS Environment 3

Database System

Ap p lic atio n P ro grams /Q ueries

S o ftware to P ro c es s Q ueries /P ro grams

S o ftware to Ac c ess S to red Data

DBMSSof tw are

Users /P ro grammers

DATABASESY STEM

S to red Datab aseDefinitio n

(M eta-Data)

S to redDatab ase

Page 4: The Database System Environment

CSCI 453 -- DBMS Environment 4

DBMS Components

Page 5: The Database System Environment

CSCI 453 -- DBMS Environment 5

A Database Schema in SQL - DDLCREATE TABLECREATE TABLE EMPLOYEE EMPLOYEE(FNAME(FNAME VARCHAR(15) VARCHAR(15) NOT NULL,NOT NULL,MINITMINIT CHAR,CHAR,LNAMELNAME VARCHAR(15) VARCHAR(15) NOT NULL,NOT NULL,SSNSSN SSN_TYPE SSN_TYPE NOT NULL,NOT NULL,BDATEBDATE DATEDATEADDRESSADDRESS VARCHAR(30),VARCHAR(30),SEXSEX CHAR,CHAR,SALARYSALARY DECIMAL(10,2),DECIMAL(10,2),SUPERSSNSUPERSSN SSN_TYPE,SSN_TYPE,DNODNO INTINT NOT NULL,NOT NULL,PRIMARY KEYPRIMARY KEY (SSN), (SSN),FOREIGN KEYFOREIGN KEY (SUPERSSN) (SUPERSSN) REFERENCESREFERENCES

EMPLOYEE(SSN),EMPLOYEE(SSN),FOREIGN KEYFOREIGN KEY (DNO) (DNO) REFERENCES REFERENCES

DEPARTMENT(DNUMBER));DEPARTMENT(DNUMBER));CREATE TABLECREATE TABLE DEPARTMENT DEPARTMENT(DNAME(DNAME VARCHAR(15) VARCHAR(15) NOT NULL,NOT NULL,DNUMBERDNUMBER INT,INT, NOT NULL,NOT NULL,MGRSSNMGRSSN SSN_TYPESSN_TYPE NOT NULL,NOT NULL,MGRSTARTDATEMGRSTARTDATE DATEDATEPRIMARY KEYPRIMARY KEY (DNUMBER), (DNUMBER),UNIQUEUNIQUE (DNAME) (DNAME)FOREIGN KEYFOREIGN KEY (MGRSSN) (MGRSSN) REFERENCES REFERENCES

EMPLOYEE(SSN));EMPLOYEE(SSN));CREATE TABLECREATE TABLE DEPT_LOCATIONS DEPT_LOCATIONS(DNUMBER(DNUMBER INTINT NOT NULL,NOT NULL,DLOCATIONDLOCATION VARCHAR(15) VARCHAR(15) NOT NULL,NOT NULL,PRIMARY KEYPRIMARY KEY (DNUMBER, DLOCATION), (DNUMBER, DLOCATION),FOREIGN KEYFOREIGN KEY (DNUMBER) (DNUMBER) REFERENCES REFERENCES

DEPARTMENT(DNUMBER));DEPARTMENT(DNUMBER));

CREATE TABLECREATE TABLE PROJECT PROJECT(PNAME(PNAME VARCHAR(15)VARCHAR(15)

NOT NULL,NOT NULL,PNUMBERPNUMBER INTINT

NOT NULL,NOT NULL,PLOCATIONPLOCATION VARCHAR(15)VARCHAR(15)DNUMDNUM INTINT

NOT NULL,NOT NULL,PRIMARY KEYPRIMARY KEY (PNUMBER), (PNUMBER),UNIQUEUNIQUE (PNAME) (PNAME)FOREIGN KEYFOREIGN KEY (DNUM) (DNUM) REFERENCES REFERENCES

DEPARTMENT(DNUMBER));DEPARTMENT(DNUMBER));CREATE TABLECREATE TABLE WORKS_ON WORKS_ON(ESSN(ESSN SSN_TYPESSN_TYPE NOT NULL,NOT NULL,PNOPNO INTINT NOT NULL,NOT NULL,HOURSHOURS DECIMAL(3,1) DECIMAL(3,1) NOT NULL,NOT NULL,PRIMARY KEYPRIMARY KEY (ESSN, PNO), (ESSN, PNO),FOREIGN KEYFOREIGN KEY (ESSN) (ESSN) REFERENCES REFERENCES EMPLOYEE(SSN),EMPLOYEE(SSN),FOREIGN KEYFOREIGN KEY (PNO) (PNO) REFERENCES REFERENCES PROJECT(PNUMBER));PROJECT(PNUMBER));CREATE TABLECREATE TABLE DEPENDENT DEPENDENT (ESSN(ESSN SSN_TYPE SSN_TYPE NOT NULL,NOT NULL, DEPENDENT_NAME VARCHAR(15) DEPENDENT_NAME VARCHAR(15) NOT NULL,NOT NULL, SEXSEX CHAR,CHAR,    BDATE BDATE DATE,DATE,    RELATIONSHIPRELATIONSHIP VARCHAR(8)VARCHAR(8)    PRIMARY KEYPRIMARY KEY (ESSN, DEPENDENT_NAME), (ESSN, DEPENDENT_NAME), FOREIGN KEYFOREIGN KEY (ESSN) (ESSN) REFERENCES REFERENCES EMPLOYEE(SSN));EMPLOYEE(SSN));

Page 6: The Database System Environment

CSCI 453 -- DBMS Environment 6

DBMS Components (Cont’d)

A DBMS is a complex software system. 

The database and the system catalog are usually stored on disk.

 

Access to the disk is controlled primarily by the operating system (OS), which schedules disk input/output..

A higher-level stored data manager module of the DBMS controls access to DBMS information stored on disk.

 

The precompiler extracts DML commands from an application program written in a host language. These commands are sent to the DML compiler for compilation into object code for database access.

Page 7: The Database System Environment

CSCI 453 -- DBMS Environment 7

DBMS Components (Cont’d)

The DDL compiler processes schema definitions and stores descriptions of the schemas (meta-data) in the DBMS catalog.

The run-time database processor handles database accesses at run time.

 

The query compiler handles high-level queries that are entered interactively.

 

Page 8: The Database System Environment

CSCI 453 -- DBMS Environment 8

DBMS Components (Cont’d)

DBMS EngineDBMS Engine Interface Subsystem (DDL, DML, DCL, Graphical User Interface Subsystem (DDL, DML, DCL, Graphical User

Interface, Forms Interface, Natural Language InterfaceInterface, Forms Interface, Natural Language Interface System CatalogSystem Catalog Concurrency Control SubsystemConcurrency Control Subsystem Backup and Recovery SubsystemBackup and Recovery Subsystem Query Optimization SubsystemQuery Optimization Subsystem Performance Management SubsystemPerformance Management Subsystem   Data Integrity Management SubsystemData Integrity Management Subsystem   Application Development SubsystemApplication Development Subsystem   Security Management SubsystemSecurity Management Subsystem

Page 9: The Database System Environment

CSCI 453 -- DBMS Environment 9

DBMS Utilities

Loading: A loading utility is used to load existing data files - such as text files or sequential files - into the database.

 

Backup: A backup utility creates a backup copy of the database, usually by dumping the entire database onto tape.

 

File reorganization: This utility can be used to reorganize a database file into a different file organization to improve performance.

 

Performance monitoring: Such a utility monitors database usage and provides statistics to the DBA.

Page 10: The Database System Environment

CSCI 453 -- DBMS Environment 10

The System Catalog

TheThe System CatalogSystem Catalog is at the heart of any general- is at the heart of any general-purpose DBMS.purpose DBMS.

   It is a “It is a “minidatabaseminidatabase” itself, and its function is to ” itself, and its function is to

store the store the schemasschemas, or descriptions, of the databases that , or descriptions, of the databases that the the DBMSDBMS maintains. maintains.

   The The catalog catalog stores data that describes each database; stores data that describes each database;

such data is often called such data is often called meta-datameta-data. It includes a . It includes a description of the conceptual database schema, the description of the conceptual database schema, the internal schema, any external schemas, and the internal schema, any external schemas, and the mappings between the schemas at different levels.mappings between the schemas at different levels.

Page 11: The Database System Environment

CSCI 453 -- DBMS Environment 11

Data Dictionary versus System Catalog

The term The term data dictionarydata dictionary is often used to indicate a more is often used to indicate a more general software utility than a catalog.general software utility than a catalog.

A A catalogcatalog is closely coupled with the DBMS software; is closely coupled with the DBMS software; it provides the information stored in it to users and the it provides the information stored in it to users and the DBA, but it is mainly accessed by the various software DBA, but it is mainly accessed by the various software modules of the DBMS itself, such as DDL, and DML modules of the DBMS itself, such as DDL, and DML compilers, the query optimizer, the transaction compilers, the query optimizer, the transaction processor, report generators, and the constraint enforcer.processor, report generators, and the constraint enforcer.

  

A A data dictionarydata dictionary software package may interact with software package may interact with the software modules of the DBMS but is mainly used the software modules of the DBMS but is mainly used by the designers, users, and administrators of a computer by the designers, users, and administrators of a computer system for information management.system for information management.

Page 12: The Database System Environment

CSCI 453 -- DBMS Environment 12

Data Dictionary

Page 13: The Database System Environment

CSCI 453 -- DBMS Environment 13

Catalogs for Relational DBMSs

The information stored in a catalog of a relational DBMS includes description of the following:

Relation names,Relation names, Attribute names,Attribute names, Attribute domains (data types),Attribute domains (data types), Primary keys,Primary keys, Secondary key attributes,Secondary key attributes, Foreign keys,Foreign keys, Other types of constraints.Other types of constraints. Descriptions of views.Descriptions of views. Internal-level description,Internal-level description, Security/authorization information.Security/authorization information.

Page 14: The Database System Environment

CSCI 453 -- DBMS Environment 14

Catalogs for Relational DBMSs (Cont’d)

In relational DBMSs it is common practice to store the In relational DBMSs it is common practice to store the catalog itself as relations and to use the DBMS software catalog itself as relations and to use the DBMS software for querying, updating, and maintaining the catalog.for querying, updating, and maintaining the catalog.

Page 15: The Database System Environment

CSCI 453 -- DBMS Environment 15

Catalogs for Relational DBMSs (Cont’d)

Page 16: The Database System Environment

CSCI 453 -- DBMS Environment 16

Catalogs for Relational DBMSs (Cont’d)

Page 17: The Database System Environment

CSCI 453 -- DBMS Environment 17

Accessing Catalog Information

The following The following DBMSDBMS modules use and access a modules use and access a catalogcatalog very frequently; that is why it is important to implement very frequently; that is why it is important to implement access to the catalog as efficiently as possible.access to the catalog as efficiently as possible. DDL compilers.DDL compilers.  

Query and DML parser and verifier.Query and DML parser and verifier.  

Query and DML compiler.Query and DML compiler.  

Query and DML optimizer.Query and DML optimizer.  

Authorization and security checking.Authorization and security checking.  

External-to-conceptual mapping of queries and DML External-to-conceptual mapping of queries and DML commands.commands.

Page 18: The Database System Environment

CSCI 453 -- DBMS Environment 18

Thank you