+ All Categories

dbms

Date post: 24-Nov-2015
Category:
Upload: narmathagce3424
View: 6 times
Download: 0 times
Share this document with a friend
Description:
Data Base Management System
Popular Tags:
60
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.
Transcript

What Is a DBMS?A very large, integrated collection of data.Models real-worldenterprise.Entities Relationships ADatabase Management System (DBMS) is asoftware 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 ModelsA data model is a collection of concepts for describing data.A schema is a description of a particularcollection of data, using the a given datamodel.Therelational model of data is the most widelyused model today. Main concept: relation, basically a table with rowsand columns. Every relation has aschema, which describes thecolumns, or fields.

Page 3

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke7Levels of AbstractionManyviews, singleconceptual (logical) schemaandphysical schema. Views describe how userssee the data. Conceptual schema defineslogical structure Physical schema describesthe files and indexes used.* Schemas are defined using DDL; data is modified/queried using DML.Physical SchemaConceptual SchemaView 1View 2View 3Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke8Example: University DatabaseConceptual 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. Gehrke9Data Independence *Applications insulated from how data isstructured and stored.Logical data independence: Protection fromchanges inlogicalstructure of data.Physical data independence: Protection fromchanges inphysical structure of data.* One of the most important benefits of using a DBMS!

Page 4

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke10Concurrency ControlConcurrent execution of user programsis essential for good DBMS performance. Because disk accesses are frequent, and relativelyslow, it is important to keep the cpu humming byworking on several user programs concurrently.Interleaving actions of different user programscan lead to inconsistency: e.g., check is clearedwhile account balance is being computed.DBMS ensures such problems dont arise: userscan pretend they are using a single-user system.Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke11Transaction: An Execution of a DB ProgramKey concept istransaction, which is anatomicsequence of database actions (reads/writes).Each transaction, executed completely, mustleave the DB in aconsistent state if DB isconsistent when the transaction begins. Users can specify some simpleintegrity constraints onthe data, and the DBMS will enforce these constraints. Beyond this, the DBMS does not really understand thesemantics of the data. (e.g., it does not understandhow the interest on a bank account is computed). Thus, ensuring that a transaction (run alone) preservesconsistency is ultimately the users responsibility!Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke12Scheduling Concurrent TransactionsDBMS ensures that execution of {T1, ... , Tn} isequivalent to someserial execution T1 ... Tn. Before reading/writing an object, a transaction requestsa lock on the object, and waits till the DBMS gives it thelock. 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 (whichperhaps reads X), one of them, say Ti, will obtain thelock 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 alock on Y? (Deadlock!) Ti or Tj is aborted and restarted!

Page 5

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke13Ensuring AtomicityDBMS ensuresatomicity (all-or-nothing property)even if system crashes in the middle of a Xact.Idea: Keep alog (history) of all actions carried outby the DBMS while executing a set of Xacts: Before a change is made to the database, thecorresponding log entry is forced to a safe location.(WAL protocol; OS support for this is often inadequate.) After a crash, the effects of partially executedtransactions areundone using the log. (Thanks to WAL, iflog entry wasnt saved before the crash, correspondingchange was not applied to database!)Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke14The LogThe 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 toundo 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 relatedactivities such as lock/unlock, dealing with deadlocksetc.) are handled transparently by the DBMS.Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke15Databases make these folks happy ...End users and DBMS vendorsDB application programmers E.g. smart webmastersDatabase administrator (DBA) Designs logical /physical schemas Handles security and authorization Data availability, crash recovery Database tuning as needs evolveMust understand how a DBMS works!

Page 6

Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke16Structure of a DBMSA typical DBMS has alayered architecture.The figure does notshow the concurrencycontrol and recoverycomponents.This is one of severalpossible architectures;each system has its ownvariations.Query Optimizationand ExecutionRelational OperatorsFiles and Access MethodsBuffer ManagementDisk Space ManagementDBThese layersmust considerconcurrencycontrol andrecoveryDatabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke17SummaryDBMS used to maintain, query large datasets.Benefits include recovery from system crashes,concurrent access, quick applicationdevelopment, data integrity and security.Levels of abstraction give data independence.A DBMS typically has a layered architecture.DBAs hold responsible jobsand 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 SystemDBMS-1What is Data Base Management SystemDBMS SoftwaresData Base StructureCreating Data BaseEditing Data BaseQuerying Data BaseRelational Power of Data BaseIntegration of Numeric and Spatial DataAnnex III: Data Base Management System

Page 2

Data Base Management SystemDBMS-2.Bio-PhysicalApplicationsSocio-EconomicApplicationsDBMSDataBaseReportingFig. 1: Data Base Management System in Environmental Reporting

Page 3

Data Base Management SystemDBMS-3What is DataBaseManagementSystemData base management system (DBMS) is a program that serves as an interface between applicationprograms and a set of coordinated and integrated files called a data base. Before the use of DBMS therewas little, if any, integration or data sharing among the functional information systems. However, there aremany opportunities for these systems to share the same data. For instance, the deforestation applicationcould 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 DBMScan pool together related data from deferent files. DBMS is perhaps the most important tool in decisionmaking for sustainable development

Page 4

Data Base Management SystemDBMS-4DBMS SoftwaresThere are many softwares which can do the job required in DBMS. These softwares are based on thesame basic structures but may have different outlooks. Some commands may be available only in one or afew 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 VFoxbase, Foxbase+, FoxproAccessParadox, etc.For spatial data:ARC/INFOARCVIEWMAPINFOSPANS, etc.In exercise Foxpro will be used as an example to illustrate the database structure

Page 5

Data Base Management SystemDBMS-5Data BaseStructureA database consists of a number of tablesEach row is a recordEach column is a fieldCOUNTRY YEAR CH4_EMISSN SO2_EMISSNBangladesh 19805236913370Bhutan19809372420India1980498634Each table is kept in a database file with the extension name .DBFEach 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 7Date: 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 fielda record

Page 6

Data Base Management SystemDBMS-6CreatingDatabaseBasic commands in creating a database fileCREATE:Create a new database fileBROWSE:Edit and append in a similar manner to worksheetMODIFY STRUCTURE:Change the database structureUSE:Open a database fileCLOSE DATABASE:Close all database filesCLEAR:Erase the screenQUIT:Exit the program

Page 7

Data Base Management SystemDBMS-7Editing DatabaseThis section introduces you to commands used in editing database filesAPPEND :Adds a new record to the bottom of the current database and displays an entry mask toaccommodate data inputAPPEND BLANK :Adds a new blank record but a data entry mask is not displayed when the BLANKclause is usedINSERT : 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 recordEDIT RECORD n :Edit the designated recordEDIT FIELD Field1,Field2.. :Restrict the data entry mask to the named fieldsBROWSE Field1,Field2.. :Display a table that is restricted to the named fieldsDELETE : Mark the current record for deletionDELETE FOR Condition :Mark all records for deletion that meet the given conditionPACK :Remove those records that have been marked for deletion

Page 8

Data Base Management SystemDBMS-8COPY TO Dbfile :Copy the current database to the named fileCOPY STRUCTURE TO Filename : Copy the structure of the open database file to a new database filehaving the given nameSORT ON Field TO Filename :Performing an ascending alphanumeric sort of the current database usingone or more named fields as basis for the sort. The sorted output is copied to the named database fileSORT ON Field TO Filename DESCENDING : The sorted database will be arranged in descendingorderINDEX ON Field TO Indexname : Create an alphanumeric index based on the named (key) field. Anindex file, which has an extension like IDX, jumps the record pointer to the first record that contain the givenvalue in the key field.REINDEX : Reindex an open index file; required when records are records are added or deleted withoutthe index being open.USE Dbfile INDEX Indexfile : Open the database and index file togetherREPLACE Field WITH Value : Replace the content of the named field with the given value

Page 9

Data Base Management SystemDBMS-9QueryingDatabaseFollowing is a list of math operators that are commonly used in querying dataSymbolOperatorExample+Addition3+5-Subtraction5-3*Multiplication3*5/Divide by5/3=Equal toX=3>Greater thanX>Y=Y


Recommended