《ANSISPARC体系结构》由会员分享,可在线阅读,更多相关《ANSISPARC体系结构(40页珍藏版)》请在金锄头文库上搜索。
1、School of Information Management & EngineeringDatabase SystemsWhat you will learn from this lecture:1. The Three Levels of the Architecture2. The Database Administrator3. DBMS4. Client/Server Architecture5. Distributed ProcessingLecture Two: Database System Architecture1School of Information Managem
2、ent & EngineeringDatabase SystemsThe Three Levels of the ArchitectureANSI/SPARC体系结构体系结构ninternal level :the way the data is physically storednexternal level: the way the data is seen by individual users (application programmer or end user)nconceptual level :a level of indirection between the other t
3、wo2School of Information Management & EngineeringDatabase SystemsAn example of the three levelsFig. 2.2 An example of the three levels3School of Information Management & EngineeringDatabase SystemsConceptual levelnThe conceptual view is a representation of the entire information content of the datab
4、ase. nThe conceptual view is defined by means of the conceptual schema.nThe conceptual schema is really little more than a simple union of all of the individual external schemas, plus certain security and integrity constraints.4School of Information Management & EngineeringDatabase SystemsE.g. conce
5、ptual schema of Database: “Order”Table:Customer(Cno,Company,City,Tel)Order(Ono,Odate,Freight)Order_item(Ono,Pno,Quantity)Product(Pno,Pname,Price)integrity constraintssecurity constraints nThe conceptual schema is written using the conceptual DDL.5School of Information Management & EngineeringDatabas
6、e SystemsThe External LevelnExternal view is the individual user view.e.g. ,Shanghai_Customer nExternal view is defined by means of an external schema. It is written using the external DDL.nUser and language application programmer:programming language ,e.g., PL/I, C+, Javaend user:query language app
7、lication program all such languages include a data sublanguage,it include DDL and DML.6School of Information Management & EngineeringDatabase SystemsnData Definition Language (DDL):supports the definition or declaration of database objects.nData Manipulation Language (DML): supports the manipulation
8、 or processing of database objects. nData sublanguage is embedded within the corresponding host language. Data sublanguage is responsible for database operations, host language for nondatabase facilities(e.g. user interface,data input and output, computational operations).Data sublanguage (DSL)7Scho
9、ol of Information Management & EngineeringDatabase SystemsThe Internal LevelnThe internal view is a low-level representation of the entire database.nThe internal view is described by means of the internal schema.nThe internal schema is written using the internal DDL.8School of Information Management
10、 & EngineeringDatabase SystemsHow the three levels of the architecture are typically realized in a relational system?nThe conceptual level in such a system will definitely be relational: relational tables relational operatorsresult:tablenA given external view will typically be relational:Table or Vi
11、ewnthe internal level will not be relational:stored records, pointers, indexes, hashes, etc.9School of Information Management & EngineeringDatabase SystemsDetailed system architectureFig. 2.3 Detailed system architecture10School of Information Management & EngineeringDatabase SystemsMappingsnconcept
12、ual/internal mapping:Defines the correspondence between the conceptual view and the stored database;It specifies how conceptual records and fields are represented at the internal level. It is the key to physical data independence :If the structure of the stored database is ,the conceptual/internal m
13、apping must be changed accordingly, so that the conceptual schema can remain invariant. 11School of Information Management & EngineeringDatabase SystemsMappingsnexternal/conceptual mappingDefines the correspondence between a particular external view and the conceptual view. Fields can have different
14、 data types; field and record names can be changed; several conceptual fields can be combined into a single (virtual) external field; Any number of external views can exist at the same time;Any number of users can share a given external view;Different external views can overlap;It is the key to logi
15、cal data independence.12School of Information Management & EngineeringDatabase SystemsMapping and Data Independencendata independence: the ability to modify a schema definition in one level without affecting a schema definition in the next higher level nLogical data independence: the capacity to cha
16、nge the conceptual schema without having to change external schemas or application programs.n Physical data independence: the capacity to change the internal schema without having to change the conceptual (or external) schemas.nThe mapping of three-schema architecture can make it easier to have true
17、 data independence.13School of Information Management & EngineeringDatabase SystemsMapping and Data Independence(Cont.)nPhysical Data IndependenceChange the data physical representation and access technique without affecting the application.Data physical representation:how the data is physically rep
18、resented in storage Eg1. EMPLOYEE file: indexed on its employee name field Eg2. SALARY field of EMPLOYEE file:decimal or binarynData access technique: how the data is physically accessed 14School of Information Management & EngineeringDatabase SystemsMapping and Data Independence(Cont.)nStructure of
19、 stored files :A given stored file can be physically implemented in storage in a wide variety of ways. a single disk several different deviceone or more indexes ,one or more embedded pointer chains (or both)some hashing schemeFDBA choose the stored representation of data.15School of Information Mana
20、gement & EngineeringDatabase Systems2. The Database AdministratornDA(data administrator) is the person who makes the strategic and policy decisions regarding the data of the enterprise.nDBA is the person who provides the necessary technical support for implementing those decisions. 16School of Infor
21、mation Management & EngineeringDatabase SystemsTasks of DBAnDefining the conceptual schema(using conceptual DDL)DA :decide the content of the database at an abstract level (Logical DB design)DBA create the corresponding conceptual schemaSQL: create table17School of Information Management & Engineeri
22、ngDatabase SystemsnDefining the internal schema (using internal DDL)The DBA must also decide how the data is to be represented in the stored database(physical database design).nDefining the external schemas (using external DDL)Liaising with users, ensure that the data they need is available.write th
23、e necessary external schemas and the corresponding external/conceptual mappings.SQL: create viewTasks of DBA18School of Information Management & EngineeringDatabase SystemsnDefining security and integrity constraints nDefining dump(数据转储) and reload policies nMonitoring performance and responding to
24、changing requirements Tasks of DBA19School of Information Management & EngineeringDatabase Systems数据转储数据转储(备份备份) ) n增量:DB2 备份自上次完全数据库备份以来所更改的所有数据。 ndelta:DB2 将只备份自上一次成功的完全、增量或差异备份以来所更改的数据。 n如果星期五进行增量备份之后发生崩溃,那么可以先恢复第一个星期日的完全备份,然后恢复星期五进行的增量备份。 n如果星期五进行 delta 备份之后发生崩溃,那么可以先恢复第一个星期日的完全备份,然后恢复从星期一到星期五(包
25、括星期五)所进行的每次 delta 备份。 20School of Information Management & EngineeringDatabase Systems3. DBMSnDatabase management system (DBMS) is the software that handles all access to the database. A user issues an access request, using some particular data sublanguage (typically SQL). The DBMS intercepts that r
26、equest and analyzes it. The DBMS inspects the external schema for that user, the corresponding external /conceptual mapping, the conceptual schema, the conceptual/internal mapping, and the storage structure definition. The DBMS executes the necessary operations on the stored database. 21School of In
27、formation Management & EngineeringDatabase SystemsHow DB2 Handles an SQL “Change” Request22School of Information Management & EngineeringDatabase SystemsFinish the change request23School of Information Management & EngineeringDatabase SystemsFunctions of DBMSnData definitions:Definition external sch
28、emas,the conceptual schema,the internal schema and all associated mappings.Convert source form schema to the appropriate object form. Include DDL processor or DDL compiler24School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)nData manipulation:retrieve, update,
29、delete ,insert data to the databaseInclude DML processor or DML compilerDML requests:planned requestunplanned request: issued interactively via some query language processor. 25School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)n Optimization and execution :opt
30、imizer, run-time managern Data security and integrity n Data recovery and concurrency:transaction manager or transaction processing monitor n Data dictionaryn Performance: efficiently 26School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)Optimization and executi
31、on27School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)Access Plan28School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)Concurrency29School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)
32、Integrity30School of Information Management & EngineeringDatabase SystemsFunctions of DBMS(Continued)Security31School of Information Management & EngineeringDatabase SystemsFig. 2.4 Major DBMS functions and componentsData definitionData definitionData manipulationData manipulationOptimization and Op
33、timization and executionexecutionData security and Data security and integrityintegrityData recovery and Data recovery and concurrencyconcurrencyData dictionaryData dictionary32School of Information Management & EngineeringDatabase Systems4. Client/Server ArchitectureFig. 2.5 Client/server architect
34、ureServer: Server: supports all of the basic DBMS functions.supports all of the basic DBMS functions.Client: Client: clients clients are are the the various various applications applications that that run run on on top top of of the the DBMSboth DBMSboth user-written user-written applications applic
35、ations and and built-in built-in applications, applications, i.e., i.e., applications applications provided provided by by the the DBMS DBMS vendor vendor or or by some third party.by some third party.33School of Information Management & EngineeringDatabase SystemsnUser-written applications:regular
36、application programswritten in C ,COBOL ,Java,nVendor-provided applications(tools):assist in the creation and execution of other applicationsE.g. report writer:allow user to obtain formatted reports through report writer language.4. Client/Server Architecture(Cont.)34School of Information Management
37、 & EngineeringDatabase SystemsVendor-provided toolsQuery language processors; Report writers; Business graphics subsystems; Spreadsheets; Natural language processors; Statistical packages; Copy management or data extract tools; Application generators (including 4GL processors); Other application dev
38、elopment tools, including computer-aided software engineering (CASE) products; 35School of Information Management & EngineeringDatabase Systems5. Distributed ProcessingFig. 2.6 Client (s) and server running on different machines Means a single data-processing task can be spread across several machin
39、es in the network. 36School of Information Management & EngineeringDatabase SystemsnServer (database) and client (application) processing are being done in parallel. Response time and throughput should thus be improved. nThe server machine might be a custom-built machine that is tailored to the DBMS
40、 function (a database machine) and might thus provide better DBMS performance. nThe client machine might be a personal workstation, tailored to the needs of the end user and thus able to provide better interfaces, faster responses, and overall improved ease of use to the user. nSeveral different cli
41、ent machines might be able (in fact, typically will be able) to access the same server machine. Thus, a single database might be shared across several distinct client systemsBenefit:37School of Information Management & EngineeringDatabase SystemsFig. 2.7 one server machine, many client machinesOne s
42、erver machine, many client machines38School of Information Management & EngineeringDatabase SystemsnA given client might be able to access any number of servers, but only one at a time (i.e., each individual database request must be directed to just one server). In such a system it is not possible,
43、within a single request, to combine data from two or more different servers. Furthermore, the user in such a system has to know which particular machine holds which pieces of data. nThe client might be able to access many servers simultaneously (i.e., a single database request might be able to combi
44、ne data from several servers). In this case, the servers look to the clientfrom a logical point of viewas if they were really a single server, and the user does not have to know which machines hold which pieces of data. - distributed database system.Each machine runs both client (s) and server39School of Information Management & EngineeringDatabase SystemsFig. 2.8 Each machine runs both client (s) and serverEach machine runs both client (s) and server40