* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download - Courses - University of California, Berkeley
Survey
Document related concepts
Microsoft SQL Server wikipedia , lookup
Microsoft Access wikipedia , lookup
Serializability wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Oracle Database wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Ingres (database) wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Functional Database Model wikipedia , lookup
Concurrency control wikipedia , lookup
Relational model wikipedia , lookup
Clusterpoint wikipedia , lookup
Transcript
Data Administration and Database Administration University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management IS 257 - Fall 2002 2002.11.05- SLIDE 1 Lecture Outline • Final Project Requirements • Review – Fourth Generation Languages – Object-Relational Extensions to SQL • Database Administration IS 257 - Fall 2002 2002.11.05- SLIDE 2 Final Project Requirements • See WWW site: – http://sims.berkeley.edu/courses/is257/f02/index.html • Report on personal/group database including: – – – – – – – – Database description and purpose Data Dictionary Relationships Diagram Sample queries and results (Web or Access tools) Sample forms (Web or Access tools) Sample reports (Web or Access tools) Application Screens or pages (Web or Access tools) In-class report on database IS 257 - Fall 2002 2002.11.05- SLIDE 3 Fourth Generation Languages • • • • 1st Generation -- Machine Language 2nd Generation -- Assembly Languages 3rd Generation -- High-Level Languages 4th Generation -- Non-Procedural Languages • 5th Generation -- ?? Knowledge-based ?? Natural Language ?? • Where do Object-Oriented Languages fit?? IS 257 - Fall 2002 2002.11.05- SLIDE 4 Components of a 4GL Application Parameters Interpreter IS 257 - Fall 2002 for building routine applications… Data Specification Report Specification Screen Specification Rules Specification Procedural facility Feedback Testing tools/debugger Optimizing compiler 2002.11.05- SLIDE 5 Natural Language • Advantages of using NL – It encourages untrained users to start – It encourages upper-management use of computers – It reduces the time taken learning complex syntax – It lessens the frustration, bewilderment and anger caused by BAD COMMAND responses – It is likely to extend greatly the usage of computers James Martin, Fourth Generation Languages, 1985 IS 257 - Fall 2002 2002.11.05- SLIDE 6 Natural Language Disadvantages of using NL • It lacks precision • It is not good for expressing precise and complex logic • It is not good for expressing neat structures • It encourages semantic overshoot Appropriate response to the disadvantage • It should be combined with other dialogue contructs that aid in the representation of precise logic and structures James Martin, Fourth Generation Languages, 1985 IS 257 - Fall 2002 2002.11.05- SLIDE 7 Natural Language Disadvantages of using NL • It takes substantial time to key in sentences • Ambiguities are possible • Substantial processing is needed Appropriate response to the disadvantage • Sentences and words can be abbreviated • Speech input as well as typed input will be used • The computer should detect and resolve ambiguities • The processing should be on PC workstations. Processing is dropping rapidly in cost. James Martin, Fourth Generation Languages, 1985 IS 257 - Fall 2002 2002.11.05- SLIDE 8 Assumptions and Issues • Why 4GLs? – Are they still appropriate? – Are they still useful? • Is Cold Fusion a 4GL? • What about PHP? • Who needs them? IS 257 - Fall 2002 2002.11.05- SLIDE 9 Object Relational Data Model • Class, instance, attribute, method, and integrity constraints • OID per instance • Encapsulation • Multiple inheritance hierarchy of classes • Class references via OID object references • Set-Valued attributes • Abstract Data Types IS 257 - Fall 2002 2002.11.05- SLIDE 10 Object-Relational SQL in ORACLE • CREATE (OR REPLACE) TYPE typename AS OBJECT (attr_name, attr_type, …); • CREATE TABLE OF typename; IS 257 - Fall 2002 2002.11.05- SLIDE 11 Example • CREATE TYPE ANIMAL_TY AS OBJECT (Breed VARCHAR2(25), Name VARCHAR2(25), Birthdate DATE); • Creates a new type • CREATE TABLE Animal of Animal_ty; • Creates “Object Table” IS 257 - Fall 2002 2002.11.05- SLIDE 12 Constructor Functions • INSERT INTO Animal values (ANIMAL_TY(‘Mule’, ‘Frances’, TO_DATE(‘01-APR-1997’, ‘DD-MMYYYY’))); • Insert a new ANIMAL_TY object into the table IS 257 - Fall 2002 2002.11.05- SLIDE 13 Selecting from an Object Table • Just use the columns in the object… • SELECT Name from Animal; IS 257 - Fall 2002 2002.11.05- SLIDE 14 More Complex Objects • CREATE TYPE Address_TY as object (Street VARCHAR2(50), City VARCHAR2(25), State CHAR(2), zip NUMBER); • CREATE TYPE Person_TY as object (Name VARCHAR2(25), Address ADDRESS_TY); • CREATE TABLE CUSTOMER (Customer_ID NUMBER, Person PERSON_TY); IS 257 - Fall 2002 2002.11.05- SLIDE 15 What Does the Table Look like? • • • • • DESCRIBE CUSTOMER; NAME TYPE ----------------------------------------------------CUSTOMER_ID NUMBER PERSON NAMED TYPE IS 257 - Fall 2002 2002.11.05- SLIDE 16 Inserting • INSERT INTO CUSTOMER VALUES (1, PERSON_TY(‘John Smith’, ADDRESS_TY(‘57 Mt Pleasant St.’, ‘Finn’, ‘NH’, 111111))); IS 257 - Fall 2002 2002.11.05- SLIDE 17 Selecting from Abstract Datatypes • SELECT Customer_ID from CUSTOMER; • SELECT * from CUSTOMER; CUSTOMER_ID PERSON(NAME, ADDRESS(STREET, CITY, STATE ZIP)) --------------------------------------------------------------------------------------------------1 PERSON_TY(‘JOHN SMITH’, ADDRESS_TY(‘57... IS 257 - Fall 2002 2002.11.05- SLIDE 18 Selecting from Abstract Datatypes • SELECT Customer_id, person.name from Customer; • SELECT Customer_id, person.address.street from Customer; IS 257 - Fall 2002 2002.11.05- SLIDE 19 Updating • UPDATE Customer SET person.address.city = ‘HART’ where person.address.city = ‘Briant’; IS 257 - Fall 2002 2002.11.05- SLIDE 20 Functions • CREATE [OR REPLACE] FUNCTION funcname (argname [IN | OUT | IN OUT] datatype …) RETURN datatype (IS | AS) {block | external body} IS 257 - Fall 2002 2002.11.05- SLIDE 21 TRIGGERS • Create TRIGGER UPDATE_LODGING INSTEAD OF UPDATE on WORKER_LODGING for each row BEGIN • if :old.name <> :new.name then update worker set name = :new.name where name = :old.name; • end if; • if :old.lodging <> … etc... IS 257 - Fall 2002 2002.11.05- SLIDE 22 Today • Traditional and Current Data Administration • Traditional and Current Database Administration IS 257 - Fall 2002 2002.11.05- SLIDE 23 Changes in Traditional Roles • This is being driven by rapid changes in – Technology – Platforms (e.g., Micro vs. Mainframe vs. Server) – Organizational Structure • We will focus on the core functions and tasks of these roles (traditional or current) IS 257 - Fall 2002 2002.11.05- SLIDE 24 Terms and Concepts (trad) • Data Administration – Responsibility for the overall management of data resources within an organization • Database Administration – Responsibility for physical database design and technical issues in database management • These roles are often combined or overlapping in some organizations IS 257 - Fall 2002 2002.11.05- SLIDE 25 Terms and Concepts (trad) • DA – Data adminstrator - person responsible for the Data Administration function in an organization – Sometimes may be the CIO -- Chief Information Officer • DBA – Database Administrator - person responsible for the Database Administration Function IS 257 - Fall 2002 2002.11.05- SLIDE 26 Database System Life Cycle Database Planning Database Analysis Growth & Change Operation & Maintenance Database Design Database Implementation Note: this is a different version of this life cycle than discussed previously IS 257 - Fall 2002 2002.11.05- SLIDE 27 Database Planning • Development of a strategic plan for database development that supports the overall organization’s business plan • DA supports top management in development of this plan • The result of this stage is an enterprise data model IS 257 - Fall 2002 2002.11.05- SLIDE 28 Database Planning: DA & DBA functions • • • • • Develop corporate database strategy (DA) Develop enterprise model (DA) Develop cost/benefit models (DA) Design database environment (DA) Develop data administration plan (DA) IS 257 - Fall 2002 2002.11.05- SLIDE 29 Database Analysis • This is the process (discussed previously) of identifying data entities currently used by the organization, precisely defining those entities and their relationships, and documenting the results in a form that can support the follow-on design phase • Must also identify new data elements or changes to data elements that will be required in the future • The result of this phase is the Conceptual Data Model -- usually represented as an ER diagram IS 257 - Fall 2002 2002.11.05- SLIDE 30 Database Analysis: DA & DBA functions • • • • Define and model data requirements (DA) Define and model business rules (DA) Define operational requirements (DA) Maintain corporate Data Dictionary (DA) IS 257 - Fall 2002 2002.11.05- SLIDE 31 Database Design • Purpose of the design phase is the development of the logical database design that will serve the needs of the organization and the physical design implementing the logical design • In relational systems the outcome is normalized relations, and the data definition for a particular database systems (including indexes, etc.) IS 257 - Fall 2002 2002.11.05- SLIDE 32 Design 2: Physical Creation • Development of the Physical Model of the Database – data formats and types – determination of indexes, etc. • Load a prototype database and test • Determine and implement security, privacy and access controls • Determine and implement integrity constraints IS 257 - Fall 2002 2002.11.05- SLIDE 33 Database Design: DA &DBA functions • Perform logical database design (DA) • Design external models (subschemas) (DBA) • Design internal model (Physical design) (DBA) • Design integrity controls (DBA) IS 257 - Fall 2002 2002.11.05- SLIDE 34 Database Implementation • Database design gives you an empty database • Load data into the database structure • Convert existing data sets and applications to use the new database – May need programs, conversion utilities to convert old data to new formats. • Outcome is the actual database with its data IS 257 - Fall 2002 2002.11.05- SLIDE 35 Database Implementation DA & DBA functions • • • • • Specify database access policies (DA & DBA) Establish Security controls (DBA) Supervise Database loading (DBA) Specify test procedures (DBA) Develop application programming standards (DBA) • Establish procedures for backup and recovery (DBA) • Conduct User training (DA & DBA) IS 257 - Fall 2002 2002.11.05- SLIDE 36 Operation and Maintenance 1: Operations • Users are responsible for updating the database, DA and DBA are responsible for developing procedures that ensure the integrity and security of the database during the update process. • Specific responsibility for data collection, editing and verification must be assigned • Quality assurance must be practiced to protect and audit the database quality. IS 257 - Fall 2002 2002.11.05- SLIDE 37 Operation and Maintenance 2: Maintenance • The ongoing process of updating the database to keep it current – – – – adding new records deleting obsolete records changing data values in particular records modifying relation structures (e.g. adding new fields) • Privacy, security, access control must be in place. • Recovery and Backup procedures must be established and used IS 257 - Fall 2002 2002.11.05- SLIDE 38 Operation and Maintenance: DA & DBA functions • • • • Monitor database performance (DBA) Tune and reorganize databases (DBA) Enforce standards and procedures (DBA) Support users (DA & DBA) IS 257 - Fall 2002 2002.11.05- SLIDE 39 Growth & Change • Change is a way of life – Applications, data requirements, reports, etc. will all change as new needs and requirements are found – The Database and applications and will need to be modified to meet the needs of changes to the organization and the environment – Database performance should be monitored to maintain a high level of system performance IS 257 - Fall 2002 2002.11.05- SLIDE 40 Growth & Change: DA & DBA functions • Implement change control procedures (DA & DBA) • Plan for growth and change (DA & DBA) • Evaluate new technology (DA & DBA) IS 257 - Fall 2002 2002.11.05- SLIDE 41 Functions in Database Administration • Planning and Design (we have already looked at theses processes in detail) • Data Integrity • Backup and Recovery • Security Management IS 257 - Fall 2002 2002.11.05- SLIDE 42 Data Integrity • Intrarecord integrity (enforcing constraints on contents of fields, etc.) • Referential Integrity (enforcing the validity of references between records in the database) • Concurrency control (ensuring the validity of database updates in a shared multiuser environment) IS 257 - Fall 2002 2002.11.05- SLIDE 43 No Concurrency Control: Lost updates John • Read account balance (balance = $1000) • Withdraw $200 (balance = $800) • Write account balance (balance = $800) IS 257 - Fall 2002 Marsha • Read account balance (balance = $1000) • Withdraw $300 (balance = $700) • Write account balance (balance = $700) ERROR! 2002.11.05- SLIDE 44 Concurrency Control: Locking • Locking levels – Database – Table – Block or page – Record – Field • Types – Shared (S locks) – Exclusive (X locks) IS 257 - Fall 2002 2002.11.05- SLIDE 45 Concurrency Control: Updates with X locking John • Lock account balance • Read account balance (balance = $1000) • Withdraw $200 (balance = $800) • Write account balance (balance = $800) • Unlock account balance IS 257 - Fall 2002 Marsha • Read account balance (DENIED) • Lock account balance • Read account balance (balance = $800) • etc... 2002.11.05- SLIDE 46 Concurrency Control: Deadlocks John • Place S lock • Read account balance (balance = $1000) • Request X lock (denied) • wait ... Marsha • Place S lock • Read account balance (balance = $1000) • Request X lock (denied) • wait... IS 257 - Fall 2002 Deadlock! 2002.11.05- SLIDE 47 Concurrency Control • Avoiding deadlocks by maintaining tables of potential deadlocks and “backing out” one side of a conflicting transaction IS 257 - Fall 2002 2002.11.05- SLIDE 48 Database Security • Views or restricted subschemas • Authorization rules to identify users and the actions they can perform • User-defined procedures (and rule systems) to define additional constraints or limitations in using the database • Encryption to encode sensitive data • Authentication schemes to positively identify a person attempting to gain access to the database IS 257 - Fall 2002 2002.11.05- SLIDE 49 Views • A subset of the database presented to some set of users – SQL: CREATE VIEW viewname AS SELECT field1, field2, field3,…, FROM table1, table2 WHERE <where clause>; – Note: “queries” in Access function as views IS 257 - Fall 2002 2002.11.05- SLIDE 50 Authorization Rules • Most current DBMS permit the DBA to define “access permissions” on a table by table basis (at least) using the GRANT and REVOKE SQL commands • Some systems permit finer grained authorization (most use GRANT and REVOKE on variant views IS 257 - Fall 2002 2002.11.05- SLIDE 51 Database Backup and Recovery • • • • Backup Journaling (audit trail) Checkpoint facility Recovery manager IS 257 - Fall 2002 2002.11.05- SLIDE 52 Disaster Recovery Planning Risk Analysis Recovery Strategies Plan Maintenance Testing and Training Budget & Implement Procedures Development From Toigo “Disaster Recovery Planning” IS 257 - Fall 2002 2002.11.05- SLIDE 53 Threats to Assets and Functions • • • • • Water Fire Power Failure Mechanical breakdown or software failure Accidental or deliberate destruction of hardware or software – By hackers, disgruntled employees, industrial saboteurs, terrorists, or others IS 257 - Fall 2002 2002.11.05- SLIDE 54 Threats • Between 1967 and 1978 fire and water damage accounted for 62% of all data processing disasters in the U.S. • The water damage was sometimes caused by fighting fires • More recently improvements in fire suppression (e.g., Halon) for DP centers has meant that water is the primary danger to DP centers IS 257 - Fall 2002 2002.11.05- SLIDE 55 Kinds of Records • Class I: VITAL – Essential, irreplaceable or necessary to recovery • Class II: IMPORTANT – Essential or important, but reproducible with difficulty or at extra expense • Class III: USEFUL – Records whose loss would be inconvenient, but which are replaceable • Class IV: NONESSENTIAL – Records which upon examination are found to be no longer necessary IS 257 - Fall 2002 2002.11.05- SLIDE 56 Offsite Storage of Data • Early offsite storage facilities were often intended to survive atomic explosions • PRISM International directory • Mirror sites (Hot sites) IS 257 - Fall 2002 2002.11.05- SLIDE 57