SlideShare a Scribd company logo
Justin Andrews
ACSG 552
Chapter 10 Questions

2. The three most common concurrent transaction execution problems are lost updates,
uncommitted data, and inconsistent retrievals.

Concurrency control can help avoid these problems through its ability to coordinate
simultaneous executions of transactions in a multiprocessing database system. This is
accomplished with various methods, including the use of a scheduler and locks.

3. The DBMS component responsible for concurrency control is a scheduler, which is a
process that establishes the order in which the many operations during each transaction
are executed.

5. Database recovery takes place through the use of data in a given transaction log to
recover a database from an inconsistent to a consistent state. A write-ahead-log protocol
ensures that transaction logs are always written before any database data are actually
updated, ensuring that the database can later be recovered to a consistent state. Redundant
transaction logs ensure a physical disk failure will not impair the DBMS’s ability to
recover data. Database buffers are used to store copies of data from physical disks, which
are themselves updated when a transaction updates data, to help speed up operations. The
updated copies of data in the buffers are eventually used to update the data on the
physical disks. Checkpoints are the process in which a DBMS writes updated buffers
onto a disk, with no other requests being executed during it.

Deferred-write techniques delay the update of a physical database, only allowing the
transaction log to update. The database itself will only update after a given transaction
reaches a commit point, which uses information from the transaction log. If the
transaction aborts, no changes will be made, preventing a need to undo the changes.

Write-through techniques differ from deferred-write techniques as they proceed to have
the database updated immediately. When a transaction aborts in this instance, the changes
need to be undone through a ROLLBACK operation.

6. a.   BEGIN TRANSACTION

        UPDATE CUSTOMER
        SET CUS_BALANCE = CUS_BALANCE + ((110 * 0.08) + 110)
         WHERE CUS_CODE = ‘10010’

        UPDATE CUSTOMER
        SET CUS_DATELSTPUR = ‘05/11/10’
         WHERE CUS_CODE = ‘10010’

        UPDATE INVOICE
SET INV_NUMBER = ‘10983’
        WHERE CUS_CODE = ‘10010’

        UPDATE INVOICE
        SET INV_TERMS = ‘30’
         WHERE CUS_CODE = ‘10010’

        UPDATE INVOICE
        SET INV_DATE = ‘05/11/10’
         WHERE CUS_CODE = ‘10010’

        UPDATE INVOICE
        SET INV_TOTAL = (110 * 0.08) + 110
         WHERE CUS_CODE = ‘10010’

        UPDATE INVOICE
        SET INV_STATUS = ‘OPEN’
         WHERE CUS_CODE = ‘10010’

        COMMIT;

6. b.   BEGIN TRANSACTION

        UPDATE CUSTOMER
        SET CUS_BALANCE = CUS_BALANCE – 100
         WHERE CUS_CODE = ‘10983’

        UPDATE CUSTOMER
        SET CUS_DATELSTPMT = ‘06/03/10’
         WHERE CUS_CODE = ‘10983’

        UPDATE PAYMENT
        SET PMT_ID = ‘3428’
         WHERE CUS_CODE = ‘10983’

        UPDATE PAYMENT
        SET PMT_DATE = ‘06/03/10’
         WHERE CUS_CODE = ‘10983’

        UPDATE PAYMENT
        SET PMT_AMT = 100
         WHERE CUS_CODE = ‘10983’

        UPDATE PAYMENT
        SET PMT_TYPE = ‘CASH’
         WHERE CUS_CODE = ‘10983’
COMMIT;

7.
TRANSACTION          TRANSACTION           WAIT/DIE               WOUND/WAIT
REQUESTING           OWNING LOCK           SCHEME                 SCHEME
LOCK
T1 (11194185)        T2 (13582019)         T1 waits until T2 is   T1 rolls back T2.
                                           completed and          T2 is rescheduled
                                           releases its locks.    while using the
                                                                  same time stamp.
T2 (13582019)        T1 (11194185)         T2 rolls back.         T2 waits until T1 is
                                           T2 is rescheduled      completed and
                                           using the same time    releases its locks.
                                           stamp.

8.    1. Table-level lock – Necessary as both the CUSTOMER and INVOICE tables
      are accessed.
      2. Data manipulation – Regarding two instances of editing in the CUSTOMER
      table.
      3. Data manipulation – Regarding five instances of editing in the INVOICE table.
      4. Table-level unlock – For when the data manipulation is finished.

9.    1. Row-level lock – Necessary for modifying information of a single customer in
      the CUSTOMER table.
      2. Row-level lock – Necessary for modifying information of a single invoice in
      the INVOICE table.
      3. Data manipulation – Regarding two instances of editing in the CUSTOMER
      table.
      4. Data manipulation – Regarding five instances of editing in the INVOICE table.
      5. Row-level unlock – For when one is finished modifying the information in the
      CUSTOMER table.
      6. Row-level unlock – For when one is finished modifying the information in the
      INVOICE table.

10.   1. Table-level lock – Necessary as both the CUSTOMER and PAYMENT tables
      are accessed.
      2. Data manipulation – Regarding two instances of editing in the CUSTOMER
      table.
      3. Data manipulation – Regarding four instances of editing in the PAYMENT
      table.
      4. Table-level unlock – For when the data manipulation is finished.

11.   1. Row-level lock – Necessary for modifying information of a single customer in
      the CUSTOMER table.
2. Row-level lock – Necessary for modifying information of a single invoice in
the PAYMENT table.
3. Data manipulation – Regarding two instances of editing in the CUSTOMER
table.
4. Data manipulation – Regarding four instances of editing in the PAYMENT
table.
5. Row-level unlock – For when one is finished modifying the information in the
CUSTOMER table.
6. Row-level unlock – For when one is finished modifying the information in the
PAYMENT table.

More Related Content

Similar to Database chapter 10 questions (20)

PDF
SQL Transactions - What they are good for and how they work
Markus Winand
 
PPTX
DBMS: Week 13 - Transactions and Concurrency Control
RashidFaridChishti
 
PPTX
database1.pptx
OmarKamil1
 
PDF
9
lubna19
 
PPTX
Unit 5 Transcationrelationaldatabases.pptx
artipunia12
 
PPT
database management system Chapter 5
Mohamad Syazwan
 
PPTX
Unit 5
Abha Damani
 
PPT
These slides are about How to do The transaction.ppt
mforytb1
 
PDF
Database concurrency and transactions - Tal Olier
sqlserver.co.il
 
PPT
Svetlin Nakov - Database Transactions
Svetlin Nakov
 
PPT
CH09.ppt
ssuser5c874e
 
PPT
Function
rey501
 
PDF
Database transaction isolation and locking in Java
Constantine Slisenka
 
PPTX
Chapter 1&2 query processing and optimization - Copy.pptx
ahmed518927
 
PPTX
Chapter 123 - Transaction Processing and Mgt.pptx
ahmed518927
 
PPTX
Chapter 1 - Transaction Processing and Mgt.pptx
ahmed518927
 
PPTX
sdggjhgdagsjfegsfgrthtADBMS Lecture 1.pptx
ahmed518927
 
PPT
Transactionsmanagement
Sanjeev Gupta
 
PDF
Transaction & Concurrency Control
Ravimuthurajan
 
PPT
Less09 locking
Amit Bhalla
 
SQL Transactions - What they are good for and how they work
Markus Winand
 
DBMS: Week 13 - Transactions and Concurrency Control
RashidFaridChishti
 
database1.pptx
OmarKamil1
 
Unit 5 Transcationrelationaldatabases.pptx
artipunia12
 
database management system Chapter 5
Mohamad Syazwan
 
Unit 5
Abha Damani
 
These slides are about How to do The transaction.ppt
mforytb1
 
Database concurrency and transactions - Tal Olier
sqlserver.co.il
 
Svetlin Nakov - Database Transactions
Svetlin Nakov
 
CH09.ppt
ssuser5c874e
 
Function
rey501
 
Database transaction isolation and locking in Java
Constantine Slisenka
 
Chapter 1&2 query processing and optimization - Copy.pptx
ahmed518927
 
Chapter 123 - Transaction Processing and Mgt.pptx
ahmed518927
 
Chapter 1 - Transaction Processing and Mgt.pptx
ahmed518927
 
sdggjhgdagsjfegsfgrthtADBMS Lecture 1.pptx
ahmed518927
 
Transactionsmanagement
Sanjeev Gupta
 
Transaction & Concurrency Control
Ravimuthurajan
 
Less09 locking
Amit Bhalla
 

More from jandrewsxu (20)

DOCX
Resume
jandrewsxu
 
DOCX
Resume
jandrewsxu
 
DOCX
Chapter #11 lab
jandrewsxu
 
DOCX
Chapter #8 lab
jandrewsxu
 
DOCX
Chapter #4 lab
jandrewsxu
 
DOCX
Modulation schemes 8
jandrewsxu
 
DOCX
Modulation techniques 7
jandrewsxu
 
DOCX
Bluetooth wi fi wi max 2, 3
jandrewsxu
 
DOCX
Acsg 520 assignment #6 ---
jandrewsxu
 
DOCX
Acsg 520 assignment #4 --
jandrewsxu
 
DOCX
First hw assignment #1 --
jandrewsxu
 
DOC
Journal
jandrewsxu
 
DOC
Assumptions, applicable measures, er diagram
jandrewsxu
 
XLSX
Data dictionary
jandrewsxu
 
DOC
Assumptions, and applicable measures
jandrewsxu
 
PPTX
Final presentation(v5)
jandrewsxu
 
DOC
Database chapter 11 homework
jandrewsxu
 
DOC
Essay #2 ethical considerations
jandrewsxu
 
DOC
Midterm paper medical records
jandrewsxu
 
DOC
Essay #2 ethical considerations
jandrewsxu
 
Resume
jandrewsxu
 
Resume
jandrewsxu
 
Chapter #11 lab
jandrewsxu
 
Chapter #8 lab
jandrewsxu
 
Chapter #4 lab
jandrewsxu
 
Modulation schemes 8
jandrewsxu
 
Modulation techniques 7
jandrewsxu
 
Bluetooth wi fi wi max 2, 3
jandrewsxu
 
Acsg 520 assignment #6 ---
jandrewsxu
 
Acsg 520 assignment #4 --
jandrewsxu
 
First hw assignment #1 --
jandrewsxu
 
Journal
jandrewsxu
 
Assumptions, applicable measures, er diagram
jandrewsxu
 
Data dictionary
jandrewsxu
 
Assumptions, and applicable measures
jandrewsxu
 
Final presentation(v5)
jandrewsxu
 
Database chapter 11 homework
jandrewsxu
 
Essay #2 ethical considerations
jandrewsxu
 
Midterm paper medical records
jandrewsxu
 
Essay #2 ethical considerations
jandrewsxu
 
Ad

Database chapter 10 questions

  • 1. Justin Andrews ACSG 552 Chapter 10 Questions 2. The three most common concurrent transaction execution problems are lost updates, uncommitted data, and inconsistent retrievals. Concurrency control can help avoid these problems through its ability to coordinate simultaneous executions of transactions in a multiprocessing database system. This is accomplished with various methods, including the use of a scheduler and locks. 3. The DBMS component responsible for concurrency control is a scheduler, which is a process that establishes the order in which the many operations during each transaction are executed. 5. Database recovery takes place through the use of data in a given transaction log to recover a database from an inconsistent to a consistent state. A write-ahead-log protocol ensures that transaction logs are always written before any database data are actually updated, ensuring that the database can later be recovered to a consistent state. Redundant transaction logs ensure a physical disk failure will not impair the DBMS’s ability to recover data. Database buffers are used to store copies of data from physical disks, which are themselves updated when a transaction updates data, to help speed up operations. The updated copies of data in the buffers are eventually used to update the data on the physical disks. Checkpoints are the process in which a DBMS writes updated buffers onto a disk, with no other requests being executed during it. Deferred-write techniques delay the update of a physical database, only allowing the transaction log to update. The database itself will only update after a given transaction reaches a commit point, which uses information from the transaction log. If the transaction aborts, no changes will be made, preventing a need to undo the changes. Write-through techniques differ from deferred-write techniques as they proceed to have the database updated immediately. When a transaction aborts in this instance, the changes need to be undone through a ROLLBACK operation. 6. a. BEGIN TRANSACTION UPDATE CUSTOMER SET CUS_BALANCE = CUS_BALANCE + ((110 * 0.08) + 110) WHERE CUS_CODE = ‘10010’ UPDATE CUSTOMER SET CUS_DATELSTPUR = ‘05/11/10’ WHERE CUS_CODE = ‘10010’ UPDATE INVOICE
  • 2. SET INV_NUMBER = ‘10983’ WHERE CUS_CODE = ‘10010’ UPDATE INVOICE SET INV_TERMS = ‘30’ WHERE CUS_CODE = ‘10010’ UPDATE INVOICE SET INV_DATE = ‘05/11/10’ WHERE CUS_CODE = ‘10010’ UPDATE INVOICE SET INV_TOTAL = (110 * 0.08) + 110 WHERE CUS_CODE = ‘10010’ UPDATE INVOICE SET INV_STATUS = ‘OPEN’ WHERE CUS_CODE = ‘10010’ COMMIT; 6. b. BEGIN TRANSACTION UPDATE CUSTOMER SET CUS_BALANCE = CUS_BALANCE – 100 WHERE CUS_CODE = ‘10983’ UPDATE CUSTOMER SET CUS_DATELSTPMT = ‘06/03/10’ WHERE CUS_CODE = ‘10983’ UPDATE PAYMENT SET PMT_ID = ‘3428’ WHERE CUS_CODE = ‘10983’ UPDATE PAYMENT SET PMT_DATE = ‘06/03/10’ WHERE CUS_CODE = ‘10983’ UPDATE PAYMENT SET PMT_AMT = 100 WHERE CUS_CODE = ‘10983’ UPDATE PAYMENT SET PMT_TYPE = ‘CASH’ WHERE CUS_CODE = ‘10983’
  • 3. COMMIT; 7. TRANSACTION TRANSACTION WAIT/DIE WOUND/WAIT REQUESTING OWNING LOCK SCHEME SCHEME LOCK T1 (11194185) T2 (13582019) T1 waits until T2 is T1 rolls back T2. completed and T2 is rescheduled releases its locks. while using the same time stamp. T2 (13582019) T1 (11194185) T2 rolls back. T2 waits until T1 is T2 is rescheduled completed and using the same time releases its locks. stamp. 8. 1. Table-level lock – Necessary as both the CUSTOMER and INVOICE tables are accessed. 2. Data manipulation – Regarding two instances of editing in the CUSTOMER table. 3. Data manipulation – Regarding five instances of editing in the INVOICE table. 4. Table-level unlock – For when the data manipulation is finished. 9. 1. Row-level lock – Necessary for modifying information of a single customer in the CUSTOMER table. 2. Row-level lock – Necessary for modifying information of a single invoice in the INVOICE table. 3. Data manipulation – Regarding two instances of editing in the CUSTOMER table. 4. Data manipulation – Regarding five instances of editing in the INVOICE table. 5. Row-level unlock – For when one is finished modifying the information in the CUSTOMER table. 6. Row-level unlock – For when one is finished modifying the information in the INVOICE table. 10. 1. Table-level lock – Necessary as both the CUSTOMER and PAYMENT tables are accessed. 2. Data manipulation – Regarding two instances of editing in the CUSTOMER table. 3. Data manipulation – Regarding four instances of editing in the PAYMENT table. 4. Table-level unlock – For when the data manipulation is finished. 11. 1. Row-level lock – Necessary for modifying information of a single customer in the CUSTOMER table.
  • 4. 2. Row-level lock – Necessary for modifying information of a single invoice in the PAYMENT table. 3. Data manipulation – Regarding two instances of editing in the CUSTOMER table. 4. Data manipulation – Regarding four instances of editing in the PAYMENT table. 5. Row-level unlock – For when one is finished modifying the information in the CUSTOMER table. 6. Row-level unlock – For when one is finished modifying the information in the PAYMENT table.