Sistem manajemen basis data 8

U
Universitas Putera BatamUniversitas Putera Batam
PART IV
 Advanced Database
     Concepts
Transaction Management and
    Concurrency Control
Database transactions reflect real-world transactions
that are triggered by events such as :




         Buying a product   Registering for a   Making a deposit
                                 course          in a checking
                                                    account


Transactions are     likely to contain many parts. For
example, a sales     transaction might require updating
the customer’s        account, adjusting the product
inventory, and        updating the seller’s accounts
receivable.
All parts of a transaction must be successfully completed
to prevent data integrity problems. Therefore, executing
and managing transactions are important database
system activities

The main database transaction properties are
atomicity, consistency, isolation, and durability. In
addition, serialize ability is a characteristic of the
schedule of operations for the execution of concurrent
transactions. After defining those transaction
properties, the chapter shows how SQL can be used to
represent transactions and how transaction logs can
ensure the DBMS’s ability to recover transactions.
When many transactions take place at the same time, they
are Called Concurrent Transactions. Managing the
execution of such transactions is called Concurrency
Control. As you can imagine, concurrency control is
especially important in a multiuser database environment.
(Just imagine the number of transactions routinely
handled by companies that conduct sales and provide
services via the Web!)

What is lost updates, uncommitted data, and inconsistent
summaries ?
To illustrate what transactions are and how they
work, let’s use the Ch10_SaleCo database. The relational
diagram for that database is shown in Figure 10.1.
As you examine the relational diagram in Figure 10.1, note
the following features :
1. The CUST_BALANCE attribute is increased when the
    customer makes a purchase on credit, and it is de-
    creased when the customer makes a payment.
    Including the current customer account balance in the
    CUSTOMER table makes it very easy to write a query
    to determine the current balance for any customer
    and to generate important summaries such as
    total, average, minimum, and maximum balances.
2. The ACCT_TRANSACTION table records all customer
    purchases and payments to track the details of
    customer account activity.
To understand the concept of a transaction, suppose that
you sell a product to a customer. Furthermore, suppose
that the customer may charge the purchase to his or her
account. Given that scenario, your sales transaction
consists of at least the following parts:
1. You must write a new customer invoice.
2. You must reduce the quantity on hand in the product’s
   inventory.
3. You must update the account transactions.
4. You must update the customer balance.
The preceding sales transaction must be reflected in the
database. In database terms, a transaction is any action
that reads from and/or writes to a database. A
transaction may consist of :
1. a simple SELECT statement to generate a list of table
    contents;
2. a series of related UPDATE statements to change the
    values of attributes in various tables; it may consist of
    a series of INSERT statements to add rows to one or
    more tables, or it may consist of a combination of
    SELECT, UPDATE, and INSERT statements. The sales
    transaction example includes a combination of INSERT
    and UPDATE statements.
A Transaction is a logical unit of work that must be
entirely completed or entirely aborted; no intermediate
states are acceptable.
In other words, a multi component transaction, such as
the previously mentioned sale, must not be partially
completed. Updating only the inventory or only the
accounts receivable is not acceptable. All of the SQL
statements in the transaction must be completed
successfully. If any of the SQL statements fail, the entire
transaction is rolled back to the original database state
that existed before the transaction started. A successful
transaction changes the database from one consistent
state to another. A consistent database state is one in
which all data integrity constraints are satisfied.
To ensure consistency of the database, every
transaction must begin with the database in a known
consistent state. If the database is not in a consistent
state, the transaction will yield an inconsistent database
that violates its integrity and business rules.
Most database transactions are formed by two or more
database requests. A Database Request is the
equivalent of a single SQL statement in an application
program or transaction. For example, if a transaction is
composed of two UPDATE statements and one INSERT
statement, the transaction uses three database
requests. In turn, each database request generates
several input/output (I/O) operations that read from or
write to physical storage media.
Improper or incomplete transactions can have a
devastating effect on database integrity. Some DBMSs—
especially the relational variety—provide means by which
the user can define enforceable constraints based on
business rules. Other integrity rules, such as those
governing referential and entity integrity, are enforced
automatically by the DBMS when the table structures are
properly defined, thereby letting the DBMS validate some
transactions.
For example, if a transaction inserts a new customer
number into a customer table and the customer number
being inserted already exists, the DBMS will end the
transaction with an error code to indicate a violation of
the primary key integrity rule.
TRANSACTION PROPERTIES
Each individual transaction must display atomicity,
consistency, isolation, and durability. These properties are
sometimes referred to as the ACID test. In addition, when
executing multiple transactions, the DBMS must schedule
the concurrent execution of the transaction’s operations.
The schedule of such transaction’s operations must
exhibit the property of serializeability. Let’s look briefly at
each of the properties.
• Atomicity 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.
• Isolation means that the data used during the
  execution of a transaction cannot be used by a second
  transaction until the first one is completed.
• Durability, ensures that once transaction changes are
  done (committed), they cannot be undone or
  lost, even in the event of a system failure.
• Serializability, ensures that the schedule for the
  concurrent execution of the transactions yields
  consistent results. This property is important in
  multiuser and distributed databases, where
  multiple transactions are likely to be executed
  concurrently. Naturally, if only a single transaction is
  executed.
The Transaction Log
A DBMS uses a transaction log to keep track of all
transactions that update the database. The information
stored in this log is used by the DBMS for a recovery
requirement triggered by a ROLLBACK statement, a
program’s abnormal termination, or a system failure such
as a network discrepancy or a disk crash. Some RDBMSs
use the transaction log to recover a database forward to a
currently consistent state. After a server failure, for
example, Oracle automatically rolls back uncommitted
transactions and rolls forward transactions that were
committed but not yet written to the physical database.
This behavior is required for transactional correctness and
is typical of any transactional DBMS.
While the DBMS executes transactions that modify the
database, it also automatically updates the transaction
log. The transaction log stores:
• A record for the beginning of the transaction.
• For each transaction component (SQL statement):
  -The type of operation being performed
    (update, delete, insert).
  -The names of the objects affected by the transaction
    (the name of the table).
  - The “before” and “after” values for the fields being
  updated.
  - Pointers to the previous and next transaction log
  entries for the same transaction.
• The ending (COMMIT) of the transaction.
1 de 16

Recomendados

Chapter 9 introduction to transaction processing por
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processingJafar Nesargi
6.3K vistas32 diapositivas
Ch17 introduction to transaction processing concepts and theory por
Ch17 introduction to transaction processing concepts and theoryCh17 introduction to transaction processing concepts and theory
Ch17 introduction to transaction processing concepts and theorymeenatchi selvaraj
4.3K vistas56 diapositivas
Tybsc cs dbms2 notes por
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notesNiraj Bharambe
1.1K vistas125 diapositivas
Acid Properties In Database Management System por
Acid Properties In Database Management SystemAcid Properties In Database Management System
Acid Properties In Database Management SystemAshish Kumar
126 vistas6 diapositivas
Chapter 5 Database Transaction Management por
Chapter 5 Database Transaction ManagementChapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementEddyzulham Mahluzydde
9.3K vistas20 diapositivas
15. Transactions in DBMS por
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
80.4K vistas42 diapositivas

Más contenido relacionado

Similar a Sistem manajemen basis data 8

DBMS-chap 2-Concurrency Control por
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency ControlMukesh Tekwani
28.4K vistas11 diapositivas
Introduction to transaction management por
Introduction to transaction managementIntroduction to transaction management
Introduction to transaction managementDr. C.V. Suresh Babu
434 vistas18 diapositivas
chp13.pdf por
chp13.pdfchp13.pdf
chp13.pdfcscmsai54
3 vistas49 diapositivas
Autonomous transaction por
Autonomous transactionAutonomous transaction
Autonomous transactionRajeev Rastogi (KRR)
1.7K vistas25 diapositivas
Dbms sixth chapter_part-1_2011 por
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011sumit_study
5.3K vistas127 diapositivas
DBMS UNIT IV.pptx por
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptxJanagi Raman S
106 vistas170 diapositivas

Similar a Sistem manajemen basis data 8(20)

DBMS-chap 2-Concurrency Control por Mukesh Tekwani
DBMS-chap 2-Concurrency ControlDBMS-chap 2-Concurrency Control
DBMS-chap 2-Concurrency Control
Mukesh Tekwani28.4K vistas
Dbms sixth chapter_part-1_2011 por sumit_study
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
sumit_study5.3K vistas
Restoration and-concurrency-database por raima sen
Restoration and-concurrency-databaseRestoration and-concurrency-database
Restoration and-concurrency-database
raima sen98 vistas
transactionprocessingsystem-161006153930.pdf por DipakRathod48
transactionprocessingsystem-161006153930.pdftransactionprocessingsystem-161006153930.pdf
transactionprocessingsystem-161006153930.pdf
DipakRathod4811 vistas
Transaction processing system por anjana1994
Transaction processing systemTransaction processing system
Transaction processing system
anjana199432.4K vistas
Transaction Processing Concept por Nishant Munjal
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
Nishant Munjal5.4K vistas
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx por Koteswari Kasireddy
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Introduction to transaction processing por Jafar Nesargi
Introduction to transaction processingIntroduction to transaction processing
Introduction to transaction processing
Jafar Nesargi483 vistas
Chapter 9 introduction to transaction processing por Jafar Nesargi
Chapter 9 introduction to transaction processingChapter 9 introduction to transaction processing
Chapter 9 introduction to transaction processing
Jafar Nesargi453 vistas
Spring Transaction por patinijava
Spring TransactionSpring Transaction
Spring Transaction
patinijava2.8K vistas
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx por randyburney60861
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
randyburney608615 vistas

Más de Universitas Putera Batam

Bab 5 komputer sederhana sap-1 por
Bab 5   komputer sederhana sap-1Bab 5   komputer sederhana sap-1
Bab 5 komputer sederhana sap-1Universitas Putera Batam
29.4K vistas19 diapositivas
Bab 4 register por
Bab 4   registerBab 4   register
Bab 4 registerUniversitas Putera Batam
12.2K vistas7 diapositivas
Bab 3 flip flop por
Bab 3   flip flopBab 3   flip flop
Bab 3 flip flopUniversitas Putera Batam
18.5K vistas7 diapositivas
Bab 1 sejarah komputer por
Bab 1   sejarah komputerBab 1   sejarah komputer
Bab 1 sejarah komputerUniversitas Putera Batam
6.8K vistas12 diapositivas
Multiplexer por
MultiplexerMultiplexer
MultiplexerUniversitas Putera Batam
548 vistas1 diapositiva
Seminar - Software Design por
Seminar - Software DesignSeminar - Software Design
Seminar - Software DesignUniversitas Putera Batam
1.1K vistas13 diapositivas

Más de Universitas Putera Batam(20)

ANALISA DESAIN SISTEM INFORMASI UNTUK KEAMANAN SISTEM INFORMASI PADA TRANSAKS... por Universitas Putera Batam
ANALISA DESAIN SISTEM INFORMASI UNTUK KEAMANAN SISTEM INFORMASI PADA TRANSAKS...ANALISA DESAIN SISTEM INFORMASI UNTUK KEAMANAN SISTEM INFORMASI PADA TRANSAKS...
ANALISA DESAIN SISTEM INFORMASI UNTUK KEAMANAN SISTEM INFORMASI PADA TRANSAKS...
Penerapan Sistem Manajemen Mutu ISO 9001 dan API Spec Q1 di PT. Pipa Mas Puti... por Universitas Putera Batam
Penerapan Sistem Manajemen Mutu ISO 9001 dan API Spec Q1 di PT. Pipa Mas Puti...Penerapan Sistem Manajemen Mutu ISO 9001 dan API Spec Q1 di PT. Pipa Mas Puti...
Penerapan Sistem Manajemen Mutu ISO 9001 dan API Spec Q1 di PT. Pipa Mas Puti...

Último

Data-centric AI and the convergence of data and model engineering: opportunit... por
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
39 vistas40 diapositivas
Five Things You SHOULD Know About Postman por
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
30 vistas43 diapositivas
Attacking IoT Devices from a Web Perspective - Linux Day por
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Simone Onofri
15 vistas68 diapositivas
1st parposal presentation.pptx por
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptxi238212
9 vistas3 diapositivas
AMAZON PRODUCT RESEARCH.pdf por
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdfJerikkLaureta
19 vistas13 diapositivas
The details of description: Techniques, tips, and tangents on alternative tex... por
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
126 vistas24 diapositivas

Último(20)

Data-centric AI and the convergence of data and model engineering: opportunit... por Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier39 vistas
Five Things You SHOULD Know About Postman por Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman30 vistas
Attacking IoT Devices from a Web Perspective - Linux Day por Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 vistas
1st parposal presentation.pptx por i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 vistas
AMAZON PRODUCT RESEARCH.pdf por JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta19 vistas
The details of description: Techniques, tips, and tangents on alternative tex... por BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada126 vistas
Special_edition_innovator_2023.pdf por WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 vistas
Voice Logger - Telephony Integration Solution at Aegis por Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma31 vistas
HTTP headers that make your website go faster - devs.gent November 2023 por Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn21 vistas
Case Study Copenhagen Energy and Business Central.pdf por Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 vistas
STPI OctaNE CoE Brochure.pdf por madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb13 vistas
Business Analyst Series 2023 - Week 3 Session 5 por DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10237 vistas
Lilypad @ Labweek, Istanbul, 2023.pdf por Ally339821
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally3398219 vistas

Sistem manajemen basis data 8

  • 1. PART IV Advanced Database Concepts Transaction Management and Concurrency Control
  • 2. Database transactions reflect real-world transactions that are triggered by events such as : Buying a product Registering for a Making a deposit course in a checking account Transactions are likely to contain many parts. For example, a sales transaction might require updating the customer’s account, adjusting the product inventory, and updating the seller’s accounts receivable.
  • 3. All parts of a transaction must be successfully completed to prevent data integrity problems. Therefore, executing and managing transactions are important database system activities The main database transaction properties are atomicity, consistency, isolation, and durability. In addition, serialize ability is a characteristic of the schedule of operations for the execution of concurrent transactions. After defining those transaction properties, the chapter shows how SQL can be used to represent transactions and how transaction logs can ensure the DBMS’s ability to recover transactions.
  • 4. When many transactions take place at the same time, they are Called Concurrent Transactions. Managing the execution of such transactions is called Concurrency Control. As you can imagine, concurrency control is especially important in a multiuser database environment. (Just imagine the number of transactions routinely handled by companies that conduct sales and provide services via the Web!) What is lost updates, uncommitted data, and inconsistent summaries ?
  • 5. To illustrate what transactions are and how they work, let’s use the Ch10_SaleCo database. The relational diagram for that database is shown in Figure 10.1.
  • 6. As you examine the relational diagram in Figure 10.1, note the following features : 1. The CUST_BALANCE attribute is increased when the customer makes a purchase on credit, and it is de- creased when the customer makes a payment. Including the current customer account balance in the CUSTOMER table makes it very easy to write a query to determine the current balance for any customer and to generate important summaries such as total, average, minimum, and maximum balances. 2. The ACCT_TRANSACTION table records all customer purchases and payments to track the details of customer account activity.
  • 7. To understand the concept of a transaction, suppose that you sell a product to a customer. Furthermore, suppose that the customer may charge the purchase to his or her account. Given that scenario, your sales transaction consists of at least the following parts: 1. You must write a new customer invoice. 2. You must reduce the quantity on hand in the product’s inventory. 3. You must update the account transactions. 4. You must update the customer balance.
  • 8. The preceding sales transaction must be reflected in the database. In database terms, a transaction is any action that reads from and/or writes to a database. A transaction may consist of : 1. a simple SELECT statement to generate a list of table contents; 2. a series of related UPDATE statements to change the values of attributes in various tables; it may consist of a series of INSERT statements to add rows to one or more tables, or it may consist of a combination of SELECT, UPDATE, and INSERT statements. The sales transaction example includes a combination of INSERT and UPDATE statements.
  • 9. A Transaction is a logical unit of work that must be entirely completed or entirely aborted; no intermediate states are acceptable. In other words, a multi component transaction, such as the previously mentioned sale, must not be partially completed. Updating only the inventory or only the accounts receivable is not acceptable. All of the SQL statements in the transaction must be completed successfully. If any of the SQL statements fail, the entire transaction is rolled back to the original database state that existed before the transaction started. A successful transaction changes the database from one consistent state to another. A consistent database state is one in which all data integrity constraints are satisfied.
  • 10. To ensure consistency of the database, every transaction must begin with the database in a known consistent state. If the database is not in a consistent state, the transaction will yield an inconsistent database that violates its integrity and business rules. Most database transactions are formed by two or more database requests. A Database Request is the equivalent of a single SQL statement in an application program or transaction. For example, if a transaction is composed of two UPDATE statements and one INSERT statement, the transaction uses three database requests. In turn, each database request generates several input/output (I/O) operations that read from or write to physical storage media.
  • 11. Improper or incomplete transactions can have a devastating effect on database integrity. Some DBMSs— especially the relational variety—provide means by which the user can define enforceable constraints based on business rules. Other integrity rules, such as those governing referential and entity integrity, are enforced automatically by the DBMS when the table structures are properly defined, thereby letting the DBMS validate some transactions. For example, if a transaction inserts a new customer number into a customer table and the customer number being inserted already exists, the DBMS will end the transaction with an error code to indicate a violation of the primary key integrity rule.
  • 12. TRANSACTION PROPERTIES Each individual transaction must display atomicity, consistency, isolation, and durability. These properties are sometimes referred to as the ACID test. In addition, when executing multiple transactions, the DBMS must schedule the concurrent execution of the transaction’s operations. The schedule of such transaction’s operations must exhibit the property of serializeability. Let’s look briefly at each of the properties. • Atomicity requires that all operations (SQL requests) of a transaction be completed; if not, the transaction is aborted
  • 13. • 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. • Isolation means that the data used during the execution of a transaction cannot be used by a second transaction until the first one is completed. • Durability, ensures that once transaction changes are done (committed), they cannot be undone or lost, even in the event of a system failure.
  • 14. • Serializability, ensures that the schedule for the concurrent execution of the transactions yields consistent results. This property is important in multiuser and distributed databases, where multiple transactions are likely to be executed concurrently. Naturally, if only a single transaction is executed.
  • 15. The Transaction Log A DBMS uses a transaction log to keep track of all transactions that update the database. The information stored in this log is used by the DBMS for a recovery requirement triggered by a ROLLBACK statement, a program’s abnormal termination, or a system failure such as a network discrepancy or a disk crash. Some RDBMSs use the transaction log to recover a database forward to a currently consistent state. After a server failure, for example, Oracle automatically rolls back uncommitted transactions and rolls forward transactions that were committed but not yet written to the physical database. This behavior is required for transactional correctness and is typical of any transactional DBMS.
  • 16. While the DBMS executes transactions that modify the database, it also automatically updates the transaction log. The transaction log stores: • A record for the beginning of the transaction. • For each transaction component (SQL statement): -The type of operation being performed (update, delete, insert). -The names of the objects affected by the transaction (the name of the table). - The “before” and “after” values for the fields being updated. - Pointers to the previous and next transaction log entries for the same transaction. • The ending (COMMIT) of the transaction.

Notas del editor

  1. ates