Beruflich Dokumente
Kultur Dokumente
Database
A database can be defined as an organized collection of non-redundant data which can be shared by different application systems , typically describing the activities of one or more organizations.
Software designed to assist in maintaining and utilizing large collections of data. Collection of interrelated files and set of programs that allow users to access and modify these files.
Data redundancy and inconsistency Difficulty in accessing data Data isolation Integrity problems Atomicity problems Concurrent access anomalies Security problems
Advantages of DBMS
Data administration Sophisticated techniques for storage and retrieval Data types Check on bounds Uniqueness on data items Restricting unauthorized access
Security
Flexibility, abstract view of data, no details of storage Feeling as one user access at a time Effects of system failures Quick application development time
Concurrent access
Crash recovery
DBMS components
Data: numerical data, non-numerical data and complicated data entities such as pictures and images Data definition language (DDL): used to describe the contents of the database- attribute names , data types, location in the database, etc. Data manipulation and query language: commands for input, edit, analysis, output, reformatting, etc. SQL - Structured Query Language.
application programs through function calls (subroutine calls) in conventional programming languages.
Data Model
Collection of high level data description constructs that hide many low-level storage details.
More abstract, high level data model helps users to come up with a good initial design contains wide variety of constructs that help describe a real application scenario Semantic model design subsequently translated into a data model
Eg Relational model The data description model used is the relation or a set of records.
A description of data in terms of a data model is the schema. Students (sid:string,name:string,login:string,age:integer,gpa:re al)
DBMS s/w
Stored DB Defn
Stored DB
Schema : Description of data in terms of a data model Schema of a relation in Relational model
Students(sid:string,name:string,login:string, age:integer)
Relational model of data Main concept: relation, basically a table with rows and columns. Every relation has a schema, which describes the columns, or fields.
Conceptual Schema
Physical Schema
Disk
Conceptual Schema
Logical Schema Describes the stored data in terms of the data model of the DBMS Process of arriving at a good conceptual design is called conceptual database design Eg University Database
Physical Schema
Specifies additional storage details w.r.t. secondary storage devices Physical schema describes the files and indexes used.
External Schema
Views conceptually a relation (without storage) Describe how the user sees the data Allow Data access to be customized and authorized at the level of individual users or groups of users Several external schemas possible for a database Collection of one or more relation
Physical schema: Relations stored as unordered files. Index on first column of Students.
Data Independence
Applications insulated from how data is structured and stored. Achieved using the 3 levels of abstraction. Logical data independence: Protection from changes in logical structure of data. Physical data independence: Protection from changes in physical structure of data.
Transaction Management
Transaction: An Execution of a DB Program Key concept is transaction, which is an atomic sequence of database actions (reads/writes). Each transaction, executed completely, must leave the DB in a consistent state if DB is consistent when the transaction begins.
Concurrent execution of user programs is essential for good DBMS performance. Actions of various users are interleaved by DBMS in such a way that they do not interfere with each other Users are given the feel of using a singleuser system.
Locking Protocol (set of rules) Ensures that concurrent execution of {T1, ... , Tn} is equivalent to some serial execution T1 ... Tn using some locking protocol Lock mechanism to control access to database objects
Exclusive lock - can be held by one and only one transaction at a time Shared lock - can be held by many different transactions at the same time
Every transaction begins by obtaining a shared lock on each data object that it needs to read and an exclusive lock on each data object that it needs to modify After completing all actions all the locks are released
Ensuring Atomicity - DBMS ensures atomicity (all-or-nothing property) even if system crashes in the middle of a Xact. DBMS maintains a log (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 write ahead log protocol After a crash, the effects of partially executed transactions are undone using the log.
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 disk before 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 Log is often duplexed and archived 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. Time required to recover from crash can be reduced by introducing periodic checkpoints (where information is forced (saved) onto disk)
End users and DBMS implementers (vendors) DB application programmers Database administrator (DBA)
Designs logical /physical schemas Handles security and authorization Data availability, recovery from failures Database tuning as needs evolve
Web forms
SQL Interface
Plan Executor
Operator Evaluator
Parser
Optimizer
Transaction Manager
A r c h i t e c t u r e o f a D B M S
Lock Manager
Concurrency control
Recovery Manager
Exercise
Scrooge McNugget wants to store information (names, addresses, descriptions of embarrassing moments, etc.) about the many ducks on his payroll. Not surprisingly, the volume of data compels him to buy a database system. To save money, he wants to buy one with the fewest possible features, and he plans to run it as a stand-alone application on his PC clone. Of course, Scrooge does not plan to share his list with anyone. Indicate which of the following DBMS features Scrooge should pay for; in each case, also indicate why Scrooge should (or should not) pay for that feature in the system he buys. 1. A security facility. 2. Concurrency control. 3. Crash recovery. 4. A view mechanism. 5. A query language.
1. 2. 3. 4.
Which of the following plays an important role in representing information about the real world in a database? Explain briefly. The data definition language. The data manipulation language. The buffer manager. The data model.