0
David M. Kroenke Database Processing Chapter 9 Managing Multi-User Databases
Multi-User Databases <ul><li>Serving the needs of multiple users and multiple applications adds complexity in… </li></ul><...
Multi-User Database Issues <ul><li>Interdependency </li></ul><ul><ul><li>Changes required by one user may impact others </...
Multi-User Database Issues <ul><li>Record Retention </li></ul><ul><ul><li>When information should be discarded </li></ul><...
Role of the Database Administrator <ul><li>Organizations typically hire a  database administrator (DBA)  to handle the iss...
Data Administrator versus Database Administrator <ul><li>Data Administrator </li></ul><ul><ul><li>Handle the database func...
The Characteristics of a DBA <ul><li>Technical </li></ul><ul><ul><li>The DBA is responsible for the performance and mainte...
Technical Skills of the DBA <ul><li>Managing the database structure </li></ul><ul><li>Controlling concurrent processing </...
Managing the Database Structure <ul><li>Managing the database structure includes  configuration control  and  documentatio...
Configuration Control <ul><li>Post-implementation changes </li></ul><ul><li>Procedures & Policies </li></ul><ul><li>Addres...
The Need for Documentation <ul><li>Crucial when trying to understand problems </li></ul><ul><li>Backups and Restores </li>...
Documentation <ul><li>All structural changes must be carefully documented with the following: </li></ul><ul><ul><li>Reason...
Controlling Concurrency Processing <ul><li>Concurrency control  ensures that one user’s actions do not adversely impact an...
Aspects of Concurrency Control <ul><li>Rollback/Commit :  Ensuring all actions are successful before posting to the databa...
Rollback/Commit <ul><li>Involve  logical units of work (LUW) . </li></ul><ul><li>Commit  when entire LUW successful. </li>...
Lost Update Problem <ul><li>When two or more users are attempting to update the same piece of data at the same time. </li>...
Resource Locking <ul><li>A  resource lock  prevents a user from reading and/or writing to a piece of data </li></ul><ul><l...
Types of Resource Locks <ul><li>Implicit versus Explicit </li></ul><ul><li>Exclusive versus Shared </li></ul>
Two-Phased Resource Locking <ul><li>Two-phased locking , whereby locks are obtained as they are needed </li></ul><ul><ul><...
Deadlocks <ul><li>When two transactions are waiting on one another to release resources.  </li></ul>
Avoiding Deadlocks <ul><li>Strategy 1: </li></ul><ul><ul><li>Wait until all resources are available, then lock them all be...
Resource Locking Strategies <ul><li>Optimistic Locking   </li></ul><ul><ul><li>Read data </li></ul></ul><ul><ul><li>Proces...
Providing Database Recovery <ul><li>Common causes of database failures… </li></ul><ul><ul><li>Hardware failures </li></ul>...
Database Recovery Characteristics <ul><li>Continuing business operations (Fall-back procedures/Continuity planning) </li><...
Fall-back Procedures/ Continuity Planning <ul><li>The business will continue to operate even when the database is inaccess...
Restoring from Backup <ul><li>In the event that the system must be rebuilt or reloaded, the database is restored from the ...
Recovery via Reprocessing <ul><li>This is a brute-force technique. </li></ul><ul><li>Simply re-type all activities since t...
Recovery via Rollback/Rollforward <ul><li>Most database management systems provide a mechanism to record activities into a...
Rollforward <ul><li>Activities recorded in the log files may be replayed.  In doing so, all activities are re-applied to t...
Rollback <ul><li>Since log files save activities in sequence order, can undo activities in reverse order than when they we...
Database Security <ul><li>Database security  strives to ensure… </li></ul><ul><ul><li>Only authorized users perform author...
Managing Processing Rights and Responsibilities <ul><li>Processing rights  define who is permitted to do what, when </li><...
Granting of Processing Rights <ul><li>Database users are known as an individual and as a member of one or more role </li><...
Granting Privileges
Managing the Database Management System (DBMS) <ul><li>In addition to controlling and maintaining the users and the data, ...
Maintaining the Data Repository <ul><li>The  data repository  contains metadata.  Metadata is data about data.  </li></ul>...
Types of Data Repositories <ul><li>Active data repository </li></ul><ul><ul><li>The development and management tools autom...
Consistent Transactions <ul><li>Consistent transactions  are often referred to by the acronym  ACID   </li></ul><ul><ul><u...
ACID: Atomic <ul><li>A transaction consists of a series of steps.  Each step must be successful for the transaction to be ...
ACID: Consistent <ul><li>No other transactions are permitted on the records until the current statement finishes </li></ul...
ACID: Isolation <ul><li>Within multi-user environments, different transactions may be operating on the same data.  As such...
Summary of Isolation Levels
ACID: Durable <ul><li>Once committed, durable transactions are saved to the data permanently </li></ul>
Set-at-a-Time Versus  Row-at-a-Time <ul><li>SQL statements act as filters for the entire data set. </li></ul><ul><li>A  cu...
Types of Cursors
Upcoming SlideShare
Loading in...5
×

Chapter 9

266

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
266
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Chapter 9"

  1. 1. David M. Kroenke Database Processing Chapter 9 Managing Multi-User Databases
  2. 2. Multi-User Databases <ul><li>Serving the needs of multiple users and multiple applications adds complexity in… </li></ul><ul><ul><li>design, </li></ul></ul><ul><ul><li>development, and </li></ul></ul><ul><ul><li>migration (future updates) </li></ul></ul>
  3. 3. Multi-User Database Issues <ul><li>Interdependency </li></ul><ul><ul><li>Changes required by one user may impact others </li></ul></ul><ul><li>Concurrency </li></ul><ul><ul><li>People or applications may try to update the same information at the same time </li></ul></ul>
  4. 4. Multi-User Database Issues <ul><li>Record Retention </li></ul><ul><ul><li>When information should be discarded </li></ul></ul><ul><li>Backup/Recovery </li></ul><ul><ul><li>How to protect yourself from losing critical information </li></ul></ul>
  5. 5. Role of the Database Administrator <ul><li>Organizations typically hire a database administrator (DBA) to handle the issues and complexities associated with multi-user databases. </li></ul><ul><li>A DBA facilitates the development and use of one or more databases. </li></ul>
  6. 6. Data Administrator versus Database Administrator <ul><li>Data Administrator </li></ul><ul><ul><li>Handle the database functions and responsibilities for the entire organization. </li></ul></ul><ul><li>Database Administrator (DBA) </li></ul><ul><ul><li>Handle the functions associated with a specific database, including those applications served by the database. </li></ul></ul>
  7. 7. The Characteristics of a DBA <ul><li>Technical </li></ul><ul><ul><li>The DBA is responsible for the performance and maintenance of one or more databases. </li></ul></ul><ul><li>Diplomatic </li></ul><ul><ul><li>The DBA must coordinate the efforts, requirements, and sometimes conflicting goals of various user groups to develop community-wide solutions. </li></ul></ul>
  8. 8. Technical Skills of the DBA <ul><li>Managing the database structure </li></ul><ul><li>Controlling concurrent processing </li></ul><ul><li>Managing processing rights and responsibilities </li></ul><ul><li>Developing database security </li></ul><ul><li>Providing database recovery </li></ul><ul><li>Managing the database management system (DBMS) </li></ul><ul><li>Maintaining the data repository </li></ul>
  9. 9. Managing the Database Structure <ul><li>Managing the database structure includes configuration control and documentation regarding: </li></ul><ul><ul><li>The allocation of space </li></ul></ul><ul><ul><li>Table creation </li></ul></ul><ul><ul><li>Indices creation </li></ul></ul><ul><ul><li>Storage procedures </li></ul></ul><ul><ul><li>Trigger creation </li></ul></ul>
  10. 10. Configuration Control <ul><li>Post-implementation changes </li></ul><ul><li>Procedures & Policies </li></ul><ul><li>Address unanticipated problems </li></ul>
  11. 11. The Need for Documentation <ul><li>Crucial when trying to understand problems </li></ul><ul><li>Backups and Restores </li></ul><ul><li>Documentation provides the “paper” trail for changes </li></ul>
  12. 12. Documentation <ul><li>All structural changes must be carefully documented with the following: </li></ul><ul><ul><li>Reason for change </li></ul></ul><ul><ul><li>Who made the changes </li></ul></ul><ul><ul><li>Specifically what was changed </li></ul></ul><ul><ul><li>How and when the changes were implemented </li></ul></ul><ul><ul><li>How were the changes tested and what were the results </li></ul></ul>
  13. 13. Controlling Concurrency Processing <ul><li>Concurrency control ensures that one user’s actions do not adversely impact another user’s actions </li></ul><ul><li>At the core of concurrency is accessibility. </li></ul>
  14. 14. Aspects of Concurrency Control <ul><li>Rollback/Commit : Ensuring all actions are successful before posting to the database </li></ul><ul><li>Multitasking : Simultaneously serving multiple users </li></ul><ul><li>Lost Updates : When one user’s action overwrites another user’s request </li></ul>
  15. 15. Rollback/Commit <ul><li>Involve logical units of work (LUW) . </li></ul><ul><li>Commit when entire LUW successful. </li></ul><ul><li>Rollback if any part of LUW is unsuccessful </li></ul>
  16. 16. Lost Update Problem <ul><li>When two or more users are attempting to update the same piece of data at the same time. </li></ul><ul><li>Resource locking scenarios are designed to address this problem </li></ul>
  17. 17. Resource Locking <ul><li>A resource lock prevents a user from reading and/or writing to a piece of data </li></ul><ul><li>The size of the piece of data (e.g., database, table, row) is termed the lock granularity </li></ul>
  18. 18. Types of Resource Locks <ul><li>Implicit versus Explicit </li></ul><ul><li>Exclusive versus Shared </li></ul>
  19. 19. Two-Phased Resource Locking <ul><li>Two-phased locking , whereby locks are obtained as they are needed </li></ul><ul><ul><li>A growing phase , whereby the transaction continues to request additional locks </li></ul></ul><ul><ul><li>A shrinking phase , whereby the transaction begins to release the locks </li></ul></ul>
  20. 20. Deadlocks <ul><li>When two transactions are waiting on one another to release resources. </li></ul>
  21. 21. Avoiding Deadlocks <ul><li>Strategy 1: </li></ul><ul><ul><li>Wait until all resources are available, then lock them all before beginning </li></ul></ul><ul><li>Strategy 2: </li></ul><ul><ul><li>Establish and use clear locking orders/sequences </li></ul></ul><ul><li>Strategy 3: </li></ul><ul><ul><li>Once detected, the DBMS will rollback one transaction </li></ul></ul>
  22. 22. Resource Locking Strategies <ul><li>Optimistic Locking </li></ul><ul><ul><li>Read data </li></ul></ul><ul><ul><li>Process transaction </li></ul></ul><ul><ul><li>Issue update </li></ul></ul><ul><ul><li>Look for conflict </li></ul></ul><ul><ul><li>If conflict occurred, rollback and repeat or else commit </li></ul></ul><ul><li>Pessimistic Locking </li></ul><ul><ul><li>Lock required resources </li></ul></ul><ul><ul><li>Read data </li></ul></ul><ul><ul><li>Process transaction </li></ul></ul><ul><ul><li>Issue update </li></ul></ul><ul><ul><li>Release locks </li></ul></ul>
  23. 23. Providing Database Recovery <ul><li>Common causes of database failures… </li></ul><ul><ul><li>Hardware failures </li></ul></ul><ul><ul><li>Programming bugs </li></ul></ul><ul><ul><li>Human errors/mistakes </li></ul></ul><ul><ul><li>Malicious actions </li></ul></ul><ul><li>Since these issues are impossible to completely avoid, recovery procedures are essential </li></ul>
  24. 24. Database Recovery Characteristics <ul><li>Continuing business operations (Fall-back procedures/Continuity planning) </li></ul><ul><li>Restore from backup </li></ul><ul><li>Replay database activities since backup was originally made </li></ul>
  25. 25. Fall-back Procedures/ Continuity Planning <ul><li>The business will continue to operate even when the database is inaccessible </li></ul><ul><li>The fall-back procedure defines how the organization will continue operations </li></ul><ul><li>Careful attention must be paid to… </li></ul><ul><ul><li>saving essential data </li></ul></ul><ul><ul><li>continuing to provide quality service </li></ul></ul>
  26. 26. Restoring from Backup <ul><li>In the event that the system must be rebuilt or reloaded, the database is restored from the last full backup. </li></ul><ul><li>Since it is inevitable that activities occurred since the last full backup was made, subsequent activities must be replayed/restored. </li></ul>
  27. 27. Recovery via Reprocessing <ul><li>This is a brute-force technique. </li></ul><ul><li>Simply re-type all activities since the backup was performed. </li></ul><ul><ul><li>Costly (extra time) </li></ul></ul><ul><ul><li>Risky (human error) </li></ul></ul>
  28. 28. Recovery via Rollback/Rollforward <ul><li>Most database management systems provide a mechanism to record activities into a log file. </li></ul>
  29. 29. Rollforward <ul><li>Activities recorded in the log files may be replayed. In doing so, all activities are re-applied to the database. </li></ul><ul><li>Use to resynchronize restored database data. </li></ul>
  30. 30. Rollback <ul><li>Since log files save activities in sequence order, can undo activities in reverse order than when they were originally executed. </li></ul><ul><li>Used to correct/undo erroneous or malicious transaction(s). </li></ul>
  31. 31. Database Security <ul><li>Database security strives to ensure… </li></ul><ul><ul><li>Only authorized users perform authorized activities at authorized times </li></ul></ul>
  32. 32. Managing Processing Rights and Responsibilities <ul><li>Processing rights define who is permitted to do what, when </li></ul><ul><li>The individuals performing these activities have full responsibility for the implications of their actions </li></ul><ul><li>Individuals are identified by a username and a password </li></ul>
  33. 33. Granting of Processing Rights <ul><li>Database users are known as an individual and as a member of one or more role </li></ul><ul><li>Access and processing rights/privileges may be granted to an individual and/or a role </li></ul><ul><li>Users possess the compilation of rights granted to the individual and all the roles for which they are members </li></ul>
  34. 34. Granting Privileges
  35. 35. Managing the Database Management System (DBMS) <ul><li>In addition to controlling and maintaining the users and the data, the DBA must also maintain and monitor the DBMS itself. </li></ul><ul><ul><li>Performance statistics (performance tuning / optimizing) </li></ul></ul><ul><ul><li>System and data integrity </li></ul></ul><ul><ul><li>Establishing, configuring, and maintaining database features and utilities </li></ul></ul>
  36. 36. Maintaining the Data Repository <ul><li>The data repository contains metadata. Metadata is data about data. </li></ul><ul><li>The data repository specifies the name, type, size, format, structure, definitions, and relationships among the data. They also contain the details about applications, users, add-on products, etc. </li></ul>
  37. 37. Types of Data Repositories <ul><li>Active data repository </li></ul><ul><ul><li>The development and management tools automatically maintain and upkeep the metadata. </li></ul></ul><ul><li>Passive data repository </li></ul><ul><ul><li>People manually maintain and upkeep the metadata </li></ul></ul>
  38. 38. Consistent Transactions <ul><li>Consistent transactions are often referred to by the acronym ACID </li></ul><ul><ul><ul><ul><li>Atomic </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Consistent </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Isolated </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Durable </li></ul></ul></ul></ul>
  39. 39. ACID: Atomic <ul><li>A transaction consists of a series of steps. Each step must be successful for the transaction to be saved. </li></ul><ul><li>This ensures that the transaction completes everything it intended to do before saving the changes. </li></ul>
  40. 40. ACID: Consistent <ul><li>No other transactions are permitted on the records until the current statement finishes </li></ul><ul><li>This ensures that the transaction integrity has statement level consistence among all records </li></ul>
  41. 41. ACID: Isolation <ul><li>Within multi-user environments, different transactions may be operating on the same data. As such, the sequencing of uncommitted updates, rollbacks, and commits continuously change the data content. </li></ul><ul><li>The 1992 ANSI SQL standards define four isolation levels and specify respective issues. </li></ul>
  42. 42. Summary of Isolation Levels
  43. 43. ACID: Durable <ul><li>Once committed, durable transactions are saved to the data permanently </li></ul>
  44. 44. Set-at-a-Time Versus Row-at-a-Time <ul><li>SQL statements act as filters for the entire data set. </li></ul><ul><li>A cursor may be defined within a SQL statement to point to a particular record. </li></ul><ul><li>Several types of cursors have been defined. The cursor type defines how the cursor behaves. </li></ul>
  45. 45. Types of Cursors
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×