Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Data Administration and Database Administration University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management
  2. 2. Mid-Term Assignment #5 <ul><li>See WWW site: </li></ul><ul><ul><li>http://sims.berkeley.edu/courses/is257/f00/index.html </li></ul></ul><ul><li>Report on personal database including: </li></ul><ul><ul><li>Database description </li></ul></ul><ul><ul><li>Data Dictionary </li></ul></ul><ul><ul><li>Relationships Diagram </li></ul></ul><ul><ul><li>Sample queries and results </li></ul></ul><ul><ul><li>Sample forms </li></ul></ul><ul><ul><li>Sample reports </li></ul></ul>
  3. 3. Review <ul><li>Web enabled database systems </li></ul>
  4. 4. Why Use a Database System? <ul><li>Database systems have concentrated on providing solutions for many issues in scaling up Web applications </li></ul><ul><ul><li>Performance </li></ul></ul><ul><ul><li>Scalability </li></ul></ul><ul><ul><li>Maintenance </li></ul></ul><ul><ul><li>Data Integrity </li></ul></ul><ul><ul><li>Transaction support </li></ul></ul><ul><li>While systems differ in their support, most offer some support for all of these. </li></ul>
  5. 5. Dynamic Web Applications 2 Server database CGI DBMS Web Server Internet Files Clients database database
  6. 6. Server Interfaces Database Web Server Web Application Server Adapted from John P Ashenfelter, Choosing a Database for Your Web Site Web DB App HTML JavaScript DHTML CGI Web Server API’s ColdFusion PhP Perl Java ASP SQL ODBC Native DB interfaces JDBC Native DB Interfaces
  7. 7. What Database systems are available? <ul><li>Choices depend on: </li></ul><ul><ul><li>Size (current and projected) of the application </li></ul></ul><ul><ul><li>Hardware and OS Platforms to be used in the application </li></ul></ul><ul><ul><li>Features required </li></ul></ul><ul><ul><ul><li>E.g.: SQL? Upgrade path? Full-text indexing? Attribute size limitations? Locking protocols? Direct Web Server access? Security? </li></ul></ul></ul><ul><ul><li>Staff support for DBA, etc. </li></ul></ul><ul><ul><li>Programming support (or lack thereof) </li></ul></ul><ul><ul><li>Cost/complexity of administration </li></ul></ul><ul><ul><li>Budget </li></ul></ul>
  8. 8. Desktop Database Systems <ul><li>Individuals or very small enterprises can create DBMS-enabled Web applications relatively inexpensively </li></ul><ul><li>Some systems will require an application server (such as ColdFusion) to provide the access path between the Web server and the DBMS </li></ul>
  9. 9. Enterprise Database Systems <ul><li>Enterprise servers are powerful and available in many different configurations </li></ul><ul><li>They also tend to be VERY expensive </li></ul><ul><li>Pricing is usually based on users, or CPU’s </li></ul>
  10. 10. Free Database Servers <ul><li>System is free, but there is also no help line. </li></ul><ul><li>Include many of the features of Enterprise systems, but tend to be lighter weight </li></ul><ul><li>Versions may vary in support for different systems </li></ul><ul><li>Open Source -- So programmers can add features </li></ul>
  11. 11. Embedded Database Servers <ul><li>May require programming experience to install </li></ul><ul><li>Tend to be fast and economical in space requirements </li></ul>
  12. 12. Database Security <ul><li>Different systems vary in security support: </li></ul><ul><ul><li>Views or restricted subschemas </li></ul></ul><ul><ul><li>Authorization rules to identify users and the actions they can perform </li></ul></ul><ul><ul><li>User-defined procedures (and rule systems) to define additional constraints or limitations in using the database </li></ul></ul><ul><ul><li>Encryption to encode sensitive data </li></ul></ul><ul><ul><li>Authentication schemes to positively identify a person attempting to gain access to the database </li></ul></ul>
  13. 13. Web Application Server Software <ul><li>ColdFusion </li></ul><ul><li>PHP </li></ul><ul><li>ASP </li></ul><ul><li>All of the are server-side scripting languages that embed code in HTML pages </li></ul>
  14. 14. ColdFusion <ul><li>Started as CGI </li></ul><ul><ul><li>Drawback, as noted above, is that the entire system is run for each cgi invocation </li></ul></ul><ul><li>Split into cooperating components </li></ul><ul><ul><li>NT service -- runs constantly </li></ul></ul><ul><ul><li>Server modules for 4 main Web Server API (glue that binds web server to ColdFusion service) {Apache, ISAPI, NSAPI, WSAPI} </li></ul></ul><ul><ul><li>Special CGI scripts for other servers </li></ul></ul>
  15. 15. What ColdFusion is Good for <ul><li>Putting up databases onto the Web </li></ul><ul><li>Handling dynamic databases (Frequent updates, etc) </li></ul><ul><li>Making databases searchable and updateable by users. </li></ul>
  16. 16. Requirements <ul><li>Unix or NT systems </li></ul><ul><li>Install as SuperUser </li></ul><ul><li>Databases must be defined via “data source names (DSNs) by administrator </li></ul>
  17. 17. Requirements and Set Up <ul><li>Field names should be devoid of spaces. Use the underscore character, like new_items instead of &quot;new items.&quot; </li></ul><ul><li>Use key fields. Greatly reduces search time. </li></ul><ul><li>Check permissions on the individual tables in your database and make sure that they have read-access for the username your Web server uses to log in. </li></ul><ul><li>If your fields include large blocks of text, you'll want to include basic HTML coding within the text itself, including boldface, italics, and paragraph markers. </li></ul>
  18. 18. Templates cont. <ul><li><HEAD> </li></ul><ul><li><TITLE>Contents of My Shopping Cart</TITLE> </li></ul><ul><li></HEAD> </li></ul><ul><li><BODY> </li></ul><ul><li><H1>Contents of My Shopping Cart</H1> </li></ul><ul><li><CFOUTPUT QUERY= ”cart&quot;> </li></ul><ul><li><B>#Item#</B> <BR> </li></ul><ul><li>#Date_of_item# <BR> </li></ul><ul><li>$#Price# <P> </li></ul><ul><li></CFOUTPUT> </li></ul><ul><li></BODY> </li></ul><ul><li></HTML> </li></ul>
  19. 19. CFML ColdFusion Markup Language <ul><li>Read data from and update data to databases and tables </li></ul><ul><li>Create dynamic data-driven pages </li></ul><ul><li>Perform conditional processing </li></ul><ul><li>Populate forms with live data </li></ul><ul><li>Process form submissions </li></ul><ul><li>Generate and retrieve email messages </li></ul><ul><li>Perform HTTP and FTP function </li></ul><ul><li>Perform credit card verification and authorization </li></ul><ul><li>Read and write client-side cookies </li></ul>
  20. 20. PHP <ul><li>PHP is an Open Source Software project with many programmers working on the code. </li></ul><ul><ul><li>Commonly paired with MySQL, another OSS project </li></ul></ul><ul><ul><li>Free </li></ul></ul><ul><ul><li>Both Windows and Unix support </li></ul></ul><ul><li>Estimated that more than 250,000 web sites use PHP as an Apache Module. </li></ul>
  21. 21. PHP Syntax <ul><li>Similar to ASP </li></ul><ul><li>Includes most programming structures (Loops, functions, Arrays, etc.) </li></ul><ul><li>Loads HTML form variables so that they are addressable by name </li></ul><ul><ul><li><HTML><BODY> </li></ul></ul><ul><ul><li><?php </li></ul></ul><ul><ul><li>$myvar = “Hello World”; </li></ul></ul><ul><ul><li>echo $myvar ; </li></ul></ul><ul><ul><li>?> </li></ul></ul><ul><ul><li></BODY></HTML> </li></ul></ul>
  22. 22. Combined with MySQL <ul><li>DBMS interface appears as a set of functions: </li></ul><HTML><BODY> <?php $db = mysql_connect(“localhost”, “root”); mysql_select_db(“mydb”,$db); $result = mysql_query(“SELECT * FROM employees”, $db); Printf(“First Name: %s <br> ”, mysql_result($result, 0 “first”); Printf(“Last Name: %s <br> ”, mysql_result($result, 0 “last”); ?></BODY></HTML>
  23. 23. ASP – Active Server Pages <ul><li>Another server-side scripting language </li></ul><ul><li>From Microsoft using Visual Basic as the Language model (VBScript), though Javascript (actually MS Jscript) is also supported </li></ul><ul><li>Works with Microsoft IIS and gives access to ODBC databases </li></ul>
  24. 24. ASP Syntax <% SQL=&quot;SELECT last, first FROM employees ORDER BY last&quot; set conn = server.createobject(&quot;ADODB.Connection&quot;) conn.open “employee&quot; set people=conn.execute(SQL) %> <% do while not people.eof set resultline=people(0) & “, “ & people(1) & “<BR>” Response.Write(resultline) people.movenext loop%> <% people.close %>
  25. 25. Conclusions <ul><li>Database technology is a required component for large-scale dynamic Web sites, especially E-Commerce sites </li></ul><ul><li>Web databases cover most of the needs of dynamic sites (except for text search) </li></ul><ul><li>Many solutions and systems are available for web-enabled databases </li></ul>
  26. 26. Today <ul><li>Data Administration </li></ul><ul><li>Database Administration </li></ul>
  27. 27. Terms and Concepts <ul><li>Data Administration </li></ul><ul><ul><li>Responsibility for the overall management of data resources within an organization </li></ul></ul><ul><li>Database Administration </li></ul><ul><ul><li>Responsibility for physical database design and technical issues in database management </li></ul></ul><ul><li>Data Steward </li></ul><ul><ul><li>Responsibility for some subset of the organization’s data, and all of the interactions (applications, user access, etc.) for that data </li></ul></ul>
  28. 28. Terms and Concepts <ul><li>DA </li></ul><ul><ul><li>Data adminstrator - person responsible for the Data Administration function in an organization </li></ul></ul><ul><ul><li>Sometimes may be the CIO -- Chief Information Officer </li></ul></ul><ul><li>DBA </li></ul><ul><ul><li>Database Administrator - person responsible for the Database Administration Function </li></ul></ul>
  29. 29. Database System Life Cycle Note: this is a different version of this life cycle than discussed previously Operation & Maintenance Database Implementation Database Design Growth & Change Database Analysis Database Planning
  30. 30. Database Planning <ul><li>Development of a strategic plan for database development that supports the overall organization’s business plan. </li></ul><ul><li>DA supports top management in development of this plan. </li></ul><ul><li>The result of this stage is an enterprise data model. </li></ul>
  31. 31. Database Planning: DA & DBA functions <ul><li>Develop corporate database strategy (DA) </li></ul><ul><li>Develop enterprise model (DA) </li></ul><ul><li>Develop cost/benefit models (DA) </li></ul><ul><li>Design database environment (DA) </li></ul><ul><li>Develop data administration plan (DA) </li></ul>
  32. 32. Database Analysis <ul><li>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. </li></ul><ul><li>Must also identify new data elements or changes to data elements that will be required in the future. </li></ul><ul><li>The result of this phase is the Conceptual Data Model -- usually represented as an ER diagram. </li></ul>
  33. 33. Database Analysis: DA & DBA functions <ul><li>Define and model data requirements (DA) </li></ul><ul><li>Define and model business rules (DA) </li></ul><ul><li>Define operational requirements (DA) </li></ul><ul><li>Maintain corporate Data Dictionary (DA) </li></ul>
  34. 34. Database Design <ul><li>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. </li></ul><ul><li>In relational systems the outcome is normalized relations, and the data definition for a particular database systems (including indexes, etc.) </li></ul>
  35. 35. Design 2: Physical Creation <ul><li>Development of the Physical Model of the Database </li></ul><ul><ul><li>data formats and types </li></ul></ul><ul><ul><li>determination of indexes, etc. </li></ul></ul><ul><li>Load a prototype database and test </li></ul><ul><li>Determine and implement security, privacy and access controls </li></ul><ul><li>Determine and implement integrity constraints </li></ul>
  36. 36. Database Design: DA &DBA functions <ul><li>Perform logical database design (DA) </li></ul><ul><li>Design external models (subschemas) (DBA) </li></ul><ul><li>Design internal model (Physical design) (DBA) </li></ul><ul><li>Design integrity controls (DBA) </li></ul>
  37. 37. Database Implementation <ul><li>Database design gives you an empty database </li></ul><ul><li>Load data into the database structure </li></ul><ul><li>Convert existing data sets and applications to use the new database </li></ul><ul><ul><li>May need programs, conversion utilities to convert old data to new formats. </li></ul></ul><ul><li>Outcome is the actual database with its data </li></ul>
  38. 38. Database Implementation DA & DBA functions <ul><li>Specify database access policies (DA & DBA) </li></ul><ul><li>Establish Security controls (DBA) </li></ul><ul><li>Supervise Database loading (DBA) </li></ul><ul><li>Specify test procedures (DBA) </li></ul><ul><li>Develop application programming standards (DBA) </li></ul><ul><li>Establish procedures for backup and recovery (DBA) </li></ul><ul><li>Conduct User training (DA & DBA) </li></ul>
  39. 39. Operation and Maintenance 1: Operations <ul><li>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. </li></ul><ul><li>Specific responsibility for data collection, editing and verification must be assigned </li></ul><ul><li>Quality assurance must be practiced to protect and audit the database quality. </li></ul>
  40. 40. Operation and Maintenance 2: Maintenance <ul><li>The ongoing process of updating the database to keep it current </li></ul><ul><ul><li>adding new records </li></ul></ul><ul><ul><li>deleting obsolete records </li></ul></ul><ul><ul><li>changing data values in particular records </li></ul></ul><ul><ul><li>modifying relation structures (e.g. adding new fields) </li></ul></ul><ul><li>Privacy, security, access control must be in place. </li></ul><ul><li>Recovery and Backup procedures must be established and used </li></ul>
  41. 41. Operation and Maintenance: DA & DBA functions <ul><li>Monitor database performance (DBA) </li></ul><ul><li>Tune and reorganize databases (DBA) </li></ul><ul><li>Enforce standards and procedures (DBA) </li></ul><ul><li>Support users (DA & DBA) </li></ul>
  42. 42. Growth & Change <ul><li>Change is a way of life </li></ul><ul><ul><li>Applications, data requirements, reports, etc. will all change as new needs and requirements are found </li></ul></ul><ul><ul><li>The Database and applications and will need to be modified to meet the needs of changes to the organization and the environment. </li></ul></ul><ul><ul><li>Database performance should be monitored to maintain a high level of system performance. </li></ul></ul>
  43. 43. Growth & Change: DA & DBA functions <ul><li>Implement change control procedures (DA & DBA) </li></ul><ul><li>Plan for growth and change (DA & DBA) </li></ul><ul><li>Evaluate new technology (DA & DBA) </li></ul>
  44. 44. Issues/functions in Database Administration <ul><li>Planning and Design (we have already looked at theses processes in detail) </li></ul><ul><li>Data Integrity </li></ul><ul><li>Backup and Recovery </li></ul><ul><li>Security Management </li></ul>
  45. 45. Data Integrity <ul><li>Intrarecord integrity (enforcing constraints on contents of fields, etc.) </li></ul><ul><li>Referential Integrity (enforcing the validity of references between records in the database) </li></ul><ul><li>Concurrency control (ensuring the validity of database updates in a shared multiuser environment). </li></ul>
  46. 46. No Concurrency Control: Lost updates <ul><li>Read account balance (balance = $1000) </li></ul><ul><li>Withdraw $200 (balance = $800) </li></ul><ul><li>Write account balance (balance = $800) </li></ul><ul><li>Read account balance (balance = $1000) </li></ul><ul><li>Withdraw $300 (balance = $700) </li></ul><ul><li>Write account balance (balance = $700) </li></ul>John Marsha ERROR!
  47. 47. Concurrency Control: Locking <ul><li>Locking levels </li></ul><ul><ul><li>Database </li></ul></ul><ul><ul><li>Table </li></ul></ul><ul><ul><li>Block or page </li></ul></ul><ul><ul><li>Record </li></ul></ul><ul><ul><li>Field </li></ul></ul><ul><li>Types </li></ul><ul><ul><li>Shared (S locks) </li></ul></ul><ul><ul><li>Exclusive (X locks) </li></ul></ul>
  48. 48. Concurrency Control: Updates with X locking <ul><li>Lock account balance </li></ul><ul><li>Read account balance (balance = $1000) </li></ul><ul><li>Withdraw $200 (balance = $800) </li></ul><ul><li>Write account balance (balance = $800) </li></ul><ul><li>Unlock account balance </li></ul><ul><li>Read account balance (DENIED) </li></ul><ul><li>Lock account balance </li></ul><ul><li>Read account balance (balance = $800) </li></ul><ul><li>etc... </li></ul>John Marsha
  49. 49. Concurrency Control: Deadlocks <ul><li>Place S lock </li></ul><ul><li>Read account balance (balance = $1000) </li></ul><ul><li>Request X lock (denied) </li></ul><ul><li>wait ... </li></ul><ul><li>Place S lock </li></ul><ul><li>Read account balance (balance = $1000) </li></ul><ul><li>Request X lock (denied) </li></ul><ul><li>wait... </li></ul>John Marsha Deadlock!
  50. 50. Concurrency Control <ul><li>Avoiding deadlocks by maintaining tables of potential deadlocks and “backing out” one side of a conflicting transaction. </li></ul>
  51. 51. Database Security <ul><li>Views or restricted subschemas </li></ul><ul><li>Authorization rules to identify users and the actions they can perform </li></ul><ul><li>User-defined procedures (and rule systems) to define additional constraints or limitations in using the database </li></ul><ul><li>Encryption to encode sensitive data </li></ul><ul><li>Authentication schemes to positively identify a person attempting to gain access to the database </li></ul>
  52. 52. Views <ul><li>A subset of the database presented to some set of users. </li></ul><ul><ul><li>SQL: CREATE VIEW viewname AS SELECT field1, field2, field3,…, FROM table1, table2 WHERE <where clause>; </li></ul></ul><ul><ul><li>Note: “queries” in Access function as views. </li></ul></ul>
  53. 53. Authorization Rules <ul><li>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. </li></ul><ul><li>Some systems permit finer grained authorization (most use GRANT and REVOKE on variant views. </li></ul>
  54. 54. Database Backup and Recovery <ul><li>Backup </li></ul><ul><li>Journaling (audit trail) </li></ul><ul><li>Checkpoint facility </li></ul><ul><li>Recovery manager </li></ul>