【文档说明】数据库原理课件第一章.ppt,共(97)页,1.624 MB,由小橙橙上传
转载请保留链接:https://www.ichengzhen.cn/view-92515.html
以下为本文档部分文字说明:
DatabaseSystem-SSD7Spring,2012TanChang-gengSchoolofSoftware,CentralSouthUniversityTCG-CSU1.2DatabaseSystemsReferencesCMUSSD7E-resourceDat
abasesystemconcepts(5thed.)bySilberschatz,Korth,Sudarshan,2005,HigherEducationPress.ISBN7-04-019245-4数据库系统概念(上书中译本),原著:Silb
erschatz,杨冬青译,机械工业出版社,ISBN7-111-19687-2DatabaseSystems–ApracticalApproachtoDesign,Implementation,andManagement(ThomasConno
lly,CarolynBegg,PersonEducationInc.),ISBN7-5053-8784-7Instructor:TanChanggeng.Email:cgtan163QQ:327414529OfferingWorld-LeadingCurriculuminCo
mputerProgramming&SoftwareSystemsDevelopment(SSD)TCG-CSU1.4DatabaseSystemsTwoCertificatesCertificateinC
omputerProgrammingCourses1through5CertificateinSoftwareSystemsDevelopmentCourses1through10SSDCurriculumOverviewTCG-CSU1.5DatabaseSystemsiCarn
egieCurriculum1-5=CertificateinComputerProgramming1-10=CertificateinSoftwareSystemsDevelopment1:Intro
ductiontoInformationSystems2:IntroductiontoComputerSystems3:ObjectOrientedProgrammingandDesign5:DataStructuresandAlgorithms6:Sy
stemLevelProgramming10:SoftwareProjectOrganizationandManagement9:SoftwareSpecification,TestandMaintenance8:NetworksandDistribute
dComputing4:UserCenteredDesignandTesting7:DatabaseSystemsTCG-CSU1.6DatabaseSystemsWhatdoesiCarnegiedo?1
0CourseSequenceRootedintheexpertiseofCarnegieMellonUniversity‘sSchoolofComputerScienceApplied,industry-
orientedskillsSoftwareDevelopmentDisciplineSoftwareDevelopment!=ComputerScienceCStrainsscientists/researchersFocusonTheoryHigh
erMathematicsSoftwareDevelopersarenotresearchersApplied,industryorientedskillsFocusonfoundationalskillsTCG-CSU1.7DatabaseSystemsThepurpo
seofSSD7isforstudentstoBecomefamiliarwithfundamentalDBMSconceptsandwhatadatabasesystemisLearntouseSQL(structuredquerylanguage)Learntod
esigndatabasesystemsLearntodesignandmanagetransaction(事务)LearntoimprovequeryperformanceGainexposuretofuturetrendsi
ndatabasesTCG-CSU1.8DatabaseSystemsStudentssuccessfullycompletingSSD7willbeabletoPRODUCE(cont’d)Databasedesignsthatsupporta
givenapplicationDatamodelsusingE-RdiagramsSoundschemadesignsusingnormalization(使用规范化方法设计出合理的模式)Web-baseddatabaseap
plicationsusingSQLandJSP/ServletsTCG-CSU1.9DatabaseSystemsStudentssuccessfullycompletingSSD7willbeabletoUSEIndexstructuresofaDBMS
toimproveperformanceThetransactionfeaturesofaDBMStoachievefaultrecovery(故障恢复)andconcurrencycontrol(并发控制)Keyrelationaloperationstomanipulatedat
a(操纵数据)SQLDDLtomodeldata,constraints,andviews(视图)SQLDMLtowritecomplexqueriesTCG-CSU1.10DatabaseSystemsStudentswillbeabletoknowledge
ablyDISCUSSThebasicconceptsofobject-relationalandobject-orienteddatabasemanagementsystemsThebasicconceptsandapplicationofdatawarehousi
nganddatamining(datacubes,OLAP)ThebasicfunctionsandapplicationofmultimediadatabasesThebasicissueso
fdatabaseprivacyandsecurityTheDBMSofferingsofthemostimportantvendorsTCG-CSU1.11DatabaseSystemsDatabaseProgDistributedSysOSUIDataStruct&Algorithm
s数据库的地位TCG-CSU1.12DatabaseSystemsTopicsShallbeLearnedIntroductionRelationalModelSQLEntity-Relationship
ModelRelational-DatabaseDesignTransactionsConcurrencyControlRecoverySystem(IntegrityandSecurity)Dat
abaseSystemArchitectures……TCG-CSU1.13DatabaseSystemsChapter1:IntroductionPurposeofDatabaseSystemsView
ofDataDatabaseLanguagesRelationalDatabasesDatabaseDesignObject-basedandsemistructureddatabasesDataStorageandQ
ueryingTransactionManagementDatabaseArchitectureDatabaseUsersandAdministratorsOverallStructureHistoryof
DatabaseSystemsTCG-CSU1.14DatabaseSystems1.1DatabaseManagementSystem(DBMS)DBMScontainsinformationaboutaparticularenterpr
iseCollectionofinterrelateddataSetofprogramstoaccessthedataAnenvironmentthatisbothconvenientandeff
icienttouseDatabaseApplications?Banking:alltransactionsAirlines:reservations,schedulesUniversities:registration,gradesSales:customers,pr
oducts,purchasesOnlineretailers:ordertracking,customizedrecommendationsManufacturing:production,inventory,orders,supplychainHumanre
sources:employeerecords,salaries,taxdeductionsDatabasestouchallaspectsofourlivesTCG-CSU1.15DatabaseSystemsT
heExamplesofDatabaseSystemsPurchasesusingyourcreditcard信用卡AcreditcarddatabaseThecheckoutassistantAcreditcardreaderCheckyo
urcreditAddthepurchasestodatabaseMonthlystatementstoeachcardholderTCG-CSU1.16DatabaseSystems1.2PurposeofDatabaseSystemsIntheearlydays,databasea
pplicationswerebuiltdirectlyontopoffilesystemsDrawbacksofusingfilesystemstostoredata?TCG-CSU1.17DatabaseSystemsLimitationsoft
heFile-BasedApproachDataredundancyandinconsistency数据冗余与非一致性Multiplefileformats,duplicationofinformationindifferentfiles文件格式不
相容,数据冗余Program-datadependence程序依赖于数据NeedtowriteanewprogramtocarryouteachnewtaskDataisolation—multiplefilesandformats数据孤立;文件格式
不相容Integrityproblems完整性问题Integrityconstraints(e.g.accountbalance>0)become―buried‖inprogramcoderatherthanbeingstatedexplicitlyHar
dtoaddnewconstraintsorchangeexistingonesTraditionalFile-BasedSystems文件系统TCG-CSU1.18DatabaseSystemsD
rawbacksofusingfilesystems(cont.)Atomicityofupdates原子更新Failuresmayleavedatabaseinaninconsistentstatewithpartialupdates
carriedoutExample:TransferoffundsfromoneaccounttoanothershouldeithercompleteornothappenatallConcurrentaccessbymultipleusers并发访问C
oncurrentaccessedneededforperformanceUncontrolledconcurrentaccessescanleadtoinconsistencies–Example
:Twopeoplereadingabalanceandupdatingitatthesametime(sellticket)SecurityproblemsHardtoprovideuseraccesstosome,butnotall,dataDatabasesyst
emsoffersolutionstoalltheaboveproblemsTCG-CSU1.19DatabaseSystemsCharacteristicsoftheDatabaseApproach数据库方法Data:dataarerawfac
tsthatdescribepeople,objects,andeventsDatabase:AnintegratedcollectionofrelateddataconstitutesaDatabase(DB).相关数据集成relateddata,thedatarepresents
logicallycoherentfactsaboutsomeaspectsoftherealworldthatarerequiredbyanapplication.Integrated,thedataformultiple
applicationsisstoredtogetherandmanipulatedinauniformwayonasecondarystoragesuchasamagneticoranopticaldisk.TCG-CSU1.20DatabaseSystemsDatabaseMana
gementSystemsADatabaseManagementSystem(DBMS)isacollectionofprogramsthatcontrolsadatabase.General-purposesoftwaresystemDataDefinitionLanguage(D
DL)DataManipulationLanguage(DML)Controlledaccesstothedatabaseasecuritysystem(authorizedusers)安全性anintegritysystem(consistencyofstoreddata)完整性ac
oncurrencycontrolsystem(sharedaccess)并发控制arecoverycontrolsystem(whenH/Sfailure)恢复auser-accessiblecatalog(descriptionsof
data)数据字典TCG-CSU1.21DatabaseSystemsDatabaseSystemaDatabaseSystemconsistsofanapplicationspecificdatabase数据库theDBM
SthatmaintainsthatdatabaseDBMStheapplicationsoftwarethatmanipulatesthedatabase应用程序数据库系统的个体含义是指一个具体的数据库管理系统软件和用它建立起来的数据库;它的学科含义是指研究、开发、建立、维护和应用数据库系统
所涉及的理论、方法、技术所构成的学科。在这一含义下,数据库系统是软件研究领域的一个重要分支,常称为数据库领域。TCG-CSU1.22DatabaseSystemsTCG-CSU1.23DatabaseSys
temsCharacteristicsoftheDatabaseApproachDBMSsembodythethreedistinguishingcharacteristicsofthedatabaseapproach:dataabstraction,re
liability,andefficiency.数据抽象可靠性高效TCG-CSU1.24DatabaseSystemsCharacteristicsoftheDatabaseApproach2DataAbstraction
provideuserswithhigh-level,conceptualrepresentationsofthedata—atableinrelationalDBMSs提供高层、概念的数据表示hidestoragedetailsthatarenotofinterestto
mostdatabaseusers隐藏存储细节program-dataindependence数据独立性TCG-CSU1.25DatabaseSystemsCharacteristicsoftheDatabaseAppr
oach3Reliability.DBMSsprovidehighreliabilityEnforcingintegrityconstraints完整性约束Integrityconstraintsreflectthemeaning(or,thesemantics)o
fthedataandoftheapplicationEnsuringdataconsistencydespitehardwareorsoftwarefailures.数据一致性TansactionsW
ithinanapplicationprogram,oneormorequery-and-updaterequeststotheDBMScanbelogicallygroupedtogetherinordertoperformatas
k.Agroupofsuchrequestsiscalledatransaction.事务Examples:acustomerpayswithacreditcard,withdrawmoneyfromATMTCG-CSU1.26DatabaseSystemsCharacterist
icsoftheDatabaseApproach4Efficiency:DBMSssupportbothefficientspaceutilizationandefficientaccesstodata.Storingeachdataitemonlyonce减
少冗余Enhancingtheperformanceofqueriesbymeansofoptimizationsandtheuseofaccessmethodstodatabasedontheirvalues查询优化
Decreasingresponsetimeoftransactionsbyallowingmultipleuserstoaccessthedatabaseconcurrently并发提高效率TCG-CSU1.27DatabaseSystemsContrastingDatabasea
ndFileSystemsTCG-CSU1.28DatabaseSystemsFile1File2FilenProg1Prog2PrognFileSystemTCG-CSU1.29DatabaseSystemsDatabaseProg1Prog2PrognDBMSTC
G-CSU1.30DatabaseSystems人工管理文件系统数据库系统应用背景科学计算科学计算、管理大规模管理硬件背景无直接存取存储设备磁盘、磁鼓大容量磁盘软件背景没有操作系统有文件系统有数据库管理系统背景处理方式批处理联机实时处理批处理联机实时处理,分布处理批处理数据的管理者人文件系统数据
库管理系统数据面向的对象某一应用程序某一应用程序整个应用系统数据的共享程度无共享,冗余度极大共享性差,冗余度大共享性高,冗余度小数据的独立性不独立,完全依赖于程序独立性差具有高度的物理独立性和逻辑独立性数据的结构化无结构记录内有结构,整体无结构整体结构化,用数据模型描述特点数据控制能力
应用程序自己控制应用程序自己控制由数据库管理系统提供数据安全性、完整性、并发控制和恢复能力Comparethedifferentphasesofdatamanagement(Table1)TCG-CSU1.31Databas
eSystemsWhenIsaDatabaseManagementSystemNeeded?Advantages1ControlofdataredundancyDataconsistencyMo
reinformationfromthesameamountofdataSharingofdataImproveddataintegrityImprovedsecurityEnforcementofstandardsEconomyofscaleTCG-CSU1.32DatabaseSys
temsAdvantages2BalanceofconflictingrequirementsImproveddataaccessibilityandresponsivenessIncreasedproductivityImprovedmaintenancethroughd
ataindependenceIncreasedconcurrencyImprovedbackupandrecoveryservicesTCG-CSU1.33DatabaseSystemsDisadvantagesCo
mplexitySizeCostofDBMSsAdditionalhardwarecostsCostofconversionPerformanceHigherimpactofafailureTCG-CSU1.34DatabaseSystemsWhenI
saDatabaseManagementSystemNotNeeded?Thedatahasasimplestructureanditssizeissmall.Theapplication,althoughsimpleandunchanging,hasasp
ecialpurpose.Concurrentaccesstodatabymultipleusersisnotrequired.TCG-CSU1.35DatabaseSystemsFourConceptsDataDatabaseDBMS(DatabaseManagem
entSystems)DBS(DatabaseSystems)TCG-CSU1.36DatabaseSystemsDatabaseSystemsConceptsData(数据):Dataare
rawfactsthatdescribepeople,objects,andevents.Or数据实际上就是描述事物的符号记录。例如:文字、图形、图象、声音、学生的档案记录等。数据的形式本身并不能完全表达其内容,需要经过语义解释。数据与其
语义是不可分的。Information(信息):一般把信息理解为关于现实世界事物存在方式或运动状态的反映.TCG-CSU1.37DatabaseSystemsDifferencebetweenDataandInformation数据是信息的符号表示或称为载体;
信息则是数据的内涵,是对数据语义的解释;数据表示了信息,而信息只有通过数据形式才能被计算机理解和接受。TCG-CSU1.38DatabaseSystemsDatabaseAnintegratedcolle
ctionofrelateddataconstitutesaDatabase(DB).KeepdatalongtimeLargequantitiesofdataLogicallyrelatedSt
ructureddataShareTCG-CSU1.39DatabaseSystemsDatabaseManagementSystems(DBMS)ADatabaseManagementSystem(DBMS)isacollectionofprogramsthatcontrolsad
atabase.`Itenablesuserstodefine,create,maintain,andcontrolaccesstothedatabase.Wecanuseitnotonlytocreateandma
intainmultipledatabasesbutalsotoimplementdatabasesystemsfordifferentapplications.TCG-CSU1.40DatabaseSystems
DatabaseSystemsAdatabasesystemisdevelopedtosupporttheoperationsofaspecificorganizationoraspecificsetofapplicatio
ns.aDatabaseSystemconsistsof1)Anapplicationspecificdatabase2)TheDBMSthatmaintainsthatdatabase3)Theapplicati
onsoftwarethatmanipulatesthedatabaseThefigure1-4illustratesasimplifieddatabase-systemarchitectureTCG-CSU1.41DatabaseSystemsF
igure1-4database-systemarchitectureTCG-CSU1.42DatabaseSystemsRolesintheDatabaseEnvironmentDataandDatabaseAd
ministrators(DAandDBA)DatabaseDesignersLogicalDatabaseDesignersPhysicalDatabaseDesignersApplicationDevelopersEnd-Users
NaïveusersSophisticatedusersTCG-CSU1.43DatabaseSystems1.3DatabaseArchitectureThearchitectureofadatabasesystemsisgreatlyinfluencedbytheunderlyingcomp
utersystemonwhichthedatabaseisrunning:CentralizedClient-serverParallel(multi-processor)DistributedTCG
-CSU1.44DatabaseSystems1.4DatabaseUsersUsersaredifferentiatedbythewaytheyexpecttointeractwiththesystemApplicationprogrammers–interactwithsystemthrou
ghDMLcallsSophisticatedusers–formrequestsinadatabasequerylanguageSpecializedusers–writespecializeddatabaseapplicationsthatdonotfitin
tothetraditionaldataprocessingframeworkNaïveusers–invokeoneofthepermanentapplicationprogramsthathavebeenwrittenpreviouslyExamples,pe
opleaccessingdatabaseovertheweb,banktellers,clericalstaffTCG-CSU1.45DatabaseSystems1.5DatabaseAdministratorCoordinatesalltheactivitiesof
thedatabasesystem;thedatabaseadministratorhasagoodunderstandingoftheenterprise‘sinformationresourcesandneeds.Databaseadminist
rator'sdutiesinclude:Schemadefinition模式定义StoragestructureandaccessmethoddefinitionSchemaandphysicalorganizationmodificationGrantinguser
authoritytoaccessthedatabaseSpecifyingintegrityconstraintsActingasliaisonwithusersMonitoringperformanceandrespondingtochangesin
requirementsTCG-CSU1.46DatabaseSystemsOverallSystemStructureTCG-CSU1.47DatabaseSystems1.6Three-LevelArchitectureDBAshouldbeabletochangedatabasest
oragestructureswithoutaffectingtheusers’views.Internalstructureofdatabaseshouldbeunaffectedbychangestophysicalaspectsofstorage.DBAshouldbeab
letochangeconceptualstructureofdatabasewithoutaffectingallusers.Objectives:TCG-CSU1.48DatabaseSystemsANSI-SPARCThree-LevelArchitectureTCG-CSU1.49Da
tabaseSystemsANSI-SPARCThree-LevelArchitectureExternalLevel外部层Users’viewofthedatabase.用户视图Describesthatpartofdatabasethatisrelevanttoapar
ticularuser.ConceptualLevel概念层Communityviewofthedatabase.总体视图Describeswhatdataisstoredindatabaseandrelationshipsamongthedata.InternalLeve
l内部层Physicalrepresentationofthedatabaseonthecomputer.Describeshowthedataisstoredinthedatabase.TCG-CSU1.50DatabaseSystemsDifferencesbetweenTh
reeLevelsofANSI-SPARCArchitectureTCG-CSU1.51DatabaseSystems1.6.1DataIndependence数据依赖LogicalDataIndependenceRefer
stoimmunityofexternalschemastochangesinconceptualschema.概念模式变化不会影响外模式Conceptualschemachanges(e.g.addition/removalofentitie
s).Shouldnotrequirechangestoexternalschemaorrewritesofapplicationprograms.PhysicalDataIndependenceReferstoimmunityofconceptualschem
atochangesintheinternalschema.Internalschemachanges(e.g.usingdifferentfileorganizations,storagestructures/devices).Shouldno
trequirechangetoconceptualorexternalschemas.TCG-CSU1.52DatabaseSystemsDataIndependenceandtheANSI-SPARCThree-Leve
lArchitectureTCG-CSU1.53DatabaseSystemsViewofDataAnarchitectureforadatabasesystemTCG-CSU1.54DatabaseSystems现实世界Concep
tualmodel转换internalmodelabstractView1View2abstractFigure1-5threedatamodelsTCG-CSU1.55DatabaseSystemsLevelsofAbstractionPhysicallevel:describesh
owarecord(e.g.,customer)isstored.typecustomer=recordcustomer_id:string;customer_name:string;customer_street:string;customer_city:integer;end;Logic
allevel:describesdatastoredindatabase,andtherelationshipsamongthedata.Viewlevel:applicationprogramshidedetailsofdatatypes.Viewscan
alsohideinformation(suchasanemployee‘ssalary)forsecuritypurposes.TCG-CSU1.56DatabaseSystemsInstancesandSchemasSimilartovariab
lesandtypesinprogramminglanguagesSchema–thelogicalstructureofthedatabaseExample:Thedatabaseconsistsofinformationabouta
setofcustomersandaccountsandtherelationshipbetweenthem)AnalogoustotypeinformationofavariableinaprogramPhysicalschema:data
basedesignatthephysicallevelLogicalschema:databasedesignatthelogicallevelInstance–theactualcontentofthedata
baseataparticularpointintimeAnalogoustothevalueofavariableTCG-CSU1.57DatabaseSystemsInstancesandSchemasPhys
icalDataIndependence–theabilitytomodifythephysicalschemawithoutchangingthelogicalschemaApplicationsdependonthelogicalschemaIngeneral,theinte
rfacesbetweenthevariouslevelsandcomponentsshouldbewelldefinedsothatchangesinsomepartsdonotseriouslyinfluenceothers.TCG-CSU
1.58DatabaseSystems1.7DataModelsAcollectionoftoolsfordescribingDataDatarelationshipsDatasemanticsDataconstraints描述数
据、数据间联系、数据语义以及约束的概念工具的集合Adatamodelcanbethoughtofascomprisingthreecomponents:数据模型由三部分组成:DatastructureDatamanipu
lationConstraintsofdataintegrityTCG-CSU1.59DatabaseSystemsDataModelsDataModel:Relationalmodel(Table)Entity-Relationshipdatamodel(mainly
fordatabasedesign)Object-baseddatamodels(Object-orientedandObject-relational)Semistructureddatamod
el(XML)Otheroldermodels:NetworkmodelHierarchicalmodelTCG-CSU1.60DatabaseSystems1.8DataManipulationLanguage(DML)Languagefor
accessingandmanipulatingthedataorganizedbytheappropriatedatamodelDMLalsoknownasquerylanguageTwoclassesoflanguagesProcedural过程式–use
rspecifieswhatdataisrequiredandhowtogetthosedataDeclarative声明式(nonprocedural)–userspecifieswhatdataisre
quiredwithoutspecifyinghowtogetthosedataSQListhemostwidelyusedquerylanguageTCG-CSU1.61DatabaseSystemsDataDefinitionLan
guage(DDL)SpecificationnotationfordefiningthedatabaseschemaExample:createtableaccount(account-numberchar(10),bala
nceinteger)DDLcompilergeneratesasetoftablesstoredinadatadictionaryDatadictionarycontainsmetadata(i.e.,dataaboutdata)Databasesch
emaDatastorageanddefinitionlanguageSpecifiesthestoragestructureandaccessmethodsusedIntegrityconstraintsDom
ainconstraintsReferentialintegrity(referencesconstraintinSQL)AssertionsAuthorizationTCG-CSU1.62DatabaseSystemsRelatio
nalModelExampleoftabulardataintherelationalmodelAttributesTCG-CSU1.63DatabaseSystemsASampleRelationalDatabaseTCG-CSU1.64DatabaseSystems1.9SQ
LSQL:widelyusednon-procedurallanguageExample:Findthenameofthecustomerwithcustomer-id192-83-7465selectcustomer
.customer_namefromcustomerwherecustomer.customer_id=‗192-83-7465‘Example:Findthebalancesofallaccoun
tsheldbythecustomerwithcustomer-id192-83-7465selectaccount.balancefromdepositor,accountwheredepositor.customer_id=‗192-83-
7465‘anddepositor.account_number=account.account_numberTCG-CSU1.65DatabaseSystemsApplicationprogramsgenerallyaccessdatabasesthroughoneofLanguageext
ensionstoallowembeddedSQLApplicationprograminterface(e.g.,ODBC/JDBC)whichallowSQLqueriestobesenttoadatabaseTCG-CSU1.66DatabaseSy
stems1.10DatabaseDesignTheprocessofdesigningthegeneralstructureofthedatabase:LogicalDesign–Decidingonthedatabaseschema(acollectionofrelationsc
hemas).Databasedesignrequiresthatwefinda“good”collectionofrelationschemas.Businessdecision–Whatattributesshouldwer
ecordinthedatabase?ComputerSciencedecision–Whatrelationschemasshouldwehaveandhowshouldtheattributesbedistributedamongthevariousrel
ationschemas?PhysicalDesign–DecidingonthephysicallayoutofthedatabaseTCG-CSU1.67DatabaseSystemsTheEntity-RelationshipModelModelsanenterprise
asacollectionofentitiesandrelationships一单位建模为实体与联系的集合Entity:a―thing‖or―object‖intheenterprisethatisdistinguishablefromotherobjects
DescribedbyasetofattributesRelationship:anassociationamongseveralentitiesRepresenteddiagrammaticallybyanentity
-relationshipdiagram:TCG-CSU1.68DatabaseSystemsObject-RelationalDataModelsExtendtherelationaldatamodelbyincludingobjectorientatio
nandconstructstodealwithaddeddatatypes.Allowattributesoftuplestohavecomplextypes,includingnon-atomicvaluessuchasnestedrelations.Preserve
relationalfoundations,inparticularthedeclarativeaccesstodata,whileextendingmodelingpower.Provideupwar
dcompatibilitywithexistingrelationallanguages.TCG-CSU1.69DatabaseSystemsXML:ExtensibleMarkupLanguageDefinedbytheWWWConsorti
um(W3C)OriginallyintendedasadocumentmarkuplanguagenotadatabaselanguageTheabilitytospecifynewtags,andtocreatenestedtagstructuresmadeXMLagr
eatwaytoexchangedata,notjustdocumentsXMLhasbecomethebasisforallnewgenerationdatainterchangeformats.Awidevarietyoftoolsisavai
lableforparsing,browsingandqueryingXMLdocuments/dataTCG-CSU1.70DatabaseSystems1.11StorageManagementSt
oragemanagerisaprogrammodulethatprovidestheinterfacebetweenthelow-leveldatastoredinthedatabaseandtheapplicationprogramsandqueriessubmit
tedtothesystem.Thestoragemanagerisresponsibletothefollowingtasks:InteractionwiththefilemanagerEfficientstoring,retrievin
gandupdatingofdataIssues:StorageaccessFileorganizationIndexingandhashingTCG-CSU1.71DatabaseSystems1.12QueryProcessing1.Parsingandtranslat
ion语法分析与转换2.Optimization优化3.Evaluation评价TCG-CSU1.72DatabaseSystemsQueryProcessing(Cont.)AlternativewaysofevaluatingagivenqueryEquiva
lentexpressionsDifferentalgorithmsforeachoperationCostdifferencebetweenagoodandabadwayofevaluatingaq
uerycanbeenormousNeedtoestimatethecostofoperationsDependscriticallyonstatisticalinformationaboutrelation
swhichthedatabasemustmaintainNeedtoestimatestatisticsforintermediateresultstocomputecostofcomplexexpressionsTCG-CSU1.73DatabaseS
ystems1.12TransactionManagementAtransactionisacollectionofoperationsthatperformsasinglelogicalfunctioninadatabaseapplication
Withinanapplicationprogram,oneormorequery-and-updaterequeststotheDBMScanbelogicallygroupedtogetherinordertop
erformatask.Agroupofsuchrequestsiscalledatransaction.Examples:acustomerpayswithacreditcard,withdrawmoneyfromATMTransaction-managementcom
ponentensuresthatthedatabaseremainsinaconsistent(correct)statedespitesystemfailures(e.g.,powerfailuresan
doperatingsystemcrashes)andtransactionfailures.Concurrency-controlmanagercontrolstheinteractionamongtheconcurrenttransactions,toensuretheconsisten
cyofthedatabase.TCG-CSU1.74DatabaseSystemsTheDatabaseSystemEnvironmentDatabasesystemiscomposedof5mainparts:1.Hardware2.SoftwareOperatingsystemsoftw
areDBMSsoftwareApplicationprogramsandutilitysoftware3.People4.Procedures5.DataTCG-CSU1.75DatabaseSystemsTheDatabaseSystemEnvironment(con
tinued)TCG-CSU1.76DatabaseSystemsComponentsofaDBMSTCG-CSU1.77DatabaseSystemsComponentsofDatabaseManager(DM)
TCG-CSU1.78DatabaseSystemsMulti-UserDBMSArchitecturesTeleprocessingFile-serverClient-serverTCG-CS
U1.79DatabaseSystemsTeleprocessingTraditionalarchitecture.Singlemainframewithanumberofterminalsattached.Trendisnowtowardsdownsizi
ng.TCG-CSU1.80DatabaseSystemsTeleprocessingTopologyTCG-CSU1.81DatabaseSystemsFile-ServerFile-serverisconnectedto
severalworkstationsacrossanetwork.Databaseresidesonfile-server.DBMSandapplicationsrunoneachworkstatio
n.Disadvantagesinclude:Significantnetworktraffic.CopyofDBMSoneachworkstation.Concurrency,recoveryandintegritycontrolmorec
omplex.TCG-CSU1.82DatabaseSystemsFile-ServerArchitectureTCG-CSU1.83DatabaseSystemsClient-ServerServerholdsthedatabaseandtheDBMS.Clientmanagesus
erinterfaceandrunsapplications.Advantagesinclude:wideraccesstoexistingdatabases;increasedperforman
ce;possiblereductioninhardwarecosts;reductionincommunicationcosts;increasedconsistency.TCG-CSU1.84Datab
aseSystemsClient-ServerArchitectureTCG-CSU1.85DatabaseSystemsAlternativeClient-ServerTopologiesTCG-CSU1.86DatabaseSystemsHistoryofDatabaseSystems
1950sandearly1960s:DataprocessingusingmagnetictapesforstorageTapesprovideonlysequentialaccessPunchedcardsforinputLate1960san
d1970s:HarddisksallowdirectaccesstodataHierarchical(IMS)andNetwork(IDS、DBTG)datamodelsinwidespreaduse(1G)TedCodddefinestherelati
onaldatamodelWouldwintheACMTuringAwardforthisworkIBMResearchbeginsSystemRprototypeUCBerkeleybeginsIngresprototypeHigh
-performance(fortheera)transactionprocessingTCG-CSU1.87DatabaseSystemsHistory(cont.)1980s:Researchrelationalprototyp
esevolveintocommercialsystems(2G)SQLbecomesindustrialstandardParallelanddistributeddatabasesystemsObj
ect-orienteddatabasesystems(3G)1990s:Largedecisionsupportanddata-miningapplicationsLargemulti-terabytedatawarehou
sesEmergenceofWebcommerce2000s:XMLandXQuerystandardsAutomateddatabaseadministrationEndofChapter1TCG-CSU1.89DatabaseSystemsFigure1.4TCG-CSU1.90Da
tabaseSystemsFigure1.7TCG-CSU1.91DatabaseSystemsDatabase(con’t)人们收集并抽取出一个应用所需要的大量数据之后,应将其保存起来以供进一步加工处理,进一步抽取有用信息Def.ofDBAnintegratedcollecti
onofrelateddataconstitutesaDatabase(DB).是长期储存在计算机内、有组织的、可共享的大量数据集合TCG-CSU1.92DatabaseSystems二、数据库(续)数据库的特征数据按一定的数据模型组
织、描述和储存可为各种用户共享冗余度较小数据独立性较高易扩展TCG-CSU1.93DatabaseSystems三、数据库管理系统DBMSAcollectionofprogramsthatcontrolsadatabase.Specific
ally,itprovidesuswithaninterfacetocreate,maintain,andmanipulatemultipledatabases.Forgeneral-purpose,是位于用户与操作系统之间的一层数据管理软件。DBMS
的用途科学地组织和存储数据、高效地获取和维护数据TCG-CSU1.94DatabaseSystemsDBMS的主要功能数据定义功能提供数据定义语言(DDL)定义数据库中的数据对象数据操纵功能:提供数据操纵语言(DML)操纵数据实现对数据库的基本操作(查询、插入、删除和修改)T
CG-CSU1.95DatabaseSystemsDBMS的主要功能数据库的运行管理保证数据的安全性、完整性、多用户对数据的并发使用发生故障后的系统恢复数据库的建立和维护功能(实用程序)数据库数据批量装载数据库转储介
质故障恢复数据库的重组织性能监视等TCG-CSU1.96DatabaseSystems四、数据库系统DatabaseSystem:Bedevelopedtosupporttheoperationsofaspecificorganizationoraspecificsetofapplicati
ons.Consistsof1)anapplicationspecificdatabase,2)theDBMSthatmaintainsthatdatabase,and3)theapplicationsoftwarethatmanipulatesthedataba
se.(数据库系统(,简称DBS)是指在计算机系统中引入数据库后的系统构成。在不引起混淆的情况下常常把数据库系统简称为数据库。)数据库系统的构成由数据库、数据库管理系统(及其开发工具)、应用系统、数据库管理员(和用户)构成。TCG-CSU1.97DatabaseSystem
sInstructor:谭长庚.(cgtan163)Textbook:Database–systemconcepts(5thed.)bySilberschatz,Korth,Sudarshan,2005FundamentalsofDatabaseSyst
ems(4thed.)byElmasri&Navathe,2019Lecturestime:Tue.Am8:00-9:40,15:55-17:30,location:CA-502,CB-402time:Fir.Am8:00-9:40,10:00-11:40location:CB-4
02Gradingfinal(70%),others(30%),6(1per2~3weeks)homework1programminghwatmost!