1 / 14

Chapter 10 - A

Chapter 10 - A. Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel. In this chapter, you will learn:. What a database transaction is and what its properties are Transaction management and transaction log. What is a Transaction?.

hallam
Download Presentation

Chapter 10 - A

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 10 - A Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel

  2. In this chapter, you will learn: • What a database transaction is • and what its properties are • Transaction management and transaction log Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  3. What is a Transaction? Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  4. What is a Transaction? (continued) • Any action that reads from and/or writes to a database may consist of: • Simple SELECT statement to generate list of table contents • Series of related UPDATE statements to change values of attributes in various tables • Series of INSERT statements to add rows to one or more tables • Combination of SELECT, UPDATE, and INSERT statements (example: sale of 10 units of product) Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  5. What is a Transaction? (continued) • Transaction is logical unit of work that must be either entirely completed or aborted • Successful transaction changes database from one consistent state to another • One in which all data integrity constraints are satisfied • Most real-world database transactions are formed by two or more database requests • Equivalent of a single SQL statement in an application program or transaction Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  6. Evaluating Transaction Results • Not all transactions update database • SQL code represents a transaction because database was accessed • Improper or incomplete transactions can have devastating effect on database integrity • Some DBMSs provide means by which user can define enforceable constraints (check constraints) • Other integrity rules are enforced automatically by the DBMS (record already exists) Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  7. Evaluating Transaction Results (continued) Figure 9.2 Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  8. Transaction Properties • Atomicity - undividable • Requires that all operations (SQL requests) of a transaction be completed. if not, the transaction is aborted. • Consistency • indicates the permanence of the database’s consistent state. A transaction takes a database from one consistent state to another consistent state. When a transaction is completed, the database must be in a consistent state; if any of the transaction parts violates an integrity constraint, the entire transaction is aborted Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  9. Transaction Properties (continued) • Isolation • Data used during execution of a transaction cannot be used by second transaction until first one is completed (useful in multi-user environment) • Durability • ensures that once transaction changes are done (committed), they cannot be undone or lost, even in the event of a system failure. Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  10. Transaction Properties (continued) • Serializability– serial order (concurrency) • Ensures that concurrent execution of several transactions yields consistent results Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  11. Transaction Management with SQL • ANSI has defined standards that govern SQL database transactions • Transaction support is provided by two SQL statements: COMMIT and ROLLBACK Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  12. Transaction Management with SQL (continued) • ANSI standards require that, when a transaction sequence is initiated by a user or an application program, it must continue through all succeeding SQL statements until one of four events occurs • COMMIT statement is reached • ROLLBACK statement is reached • End of program is reached • Program is abnormally terminated Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  13. The Transaction Log • Transaction log stores: • A record for the beginning of transaction • For each transaction component (SQL statement): • Type of operation being performed (update, delete, insert) • Names of objects affected by transaction • “Before” and “after” values for updated fields • Pointers to previous and next transaction log entries for the same transaction • Ending (COMMIT) of the transaction • Used for recovery from rollback, abnormal termination, system failure (disk crash). Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

  14. The Transaction Log (continued) Database Systems: Design, Implementation, & Management, 8th Edition, Rob & Coronel

More Related