EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials DBMS Tutorial States of Transaction in DBMS
Secondary Sidebar
DBMS Tutorial
  • DBMS
    • What is DBMS?
    • Introduction To DBMS
    • DBMS ER Diagram
    • DBMS_RANDOM
    • DBMS_XPLAN
    • DBMS join
    • DBMS Functions
    • Data Administrator in DBMS
    • Checkpoint in DBMS
    • DBMS Table
    • Mapping Constraints in DBMS
    • DBMS Canonical Cover
    • DBMS Log-Based Recovery
    • DBMS Multivalued Dependency
    • View Serializability in DBMS
    • DBMS Concepts
    • DBMS Constraints
    • DBMS_Scheduler
    • B+ Tree in DBMS
    • DBMS_LOB
    • dbms entity
    • DBMS Foreign Key
    • DBMS Users
    • DBMS_Metadata.get_ddl
    • Relational Algebra in DBMS
    • DBMS Components
    • DBMS Features
    • DBMS Models
    • DBMS Relational Model
    • Hashing in DBMS
    • DBMS network model
    • Relationship in DBMS
    • ER Model in DBMS
    • Data Models in DBMS
    • Static Hashing in DBMS
    • Advantages of DBMS
    • dbms_output.put_line
    • DBMS Data Dictionary
    • dbms_xplan.display_cursor
    • Normal Forms in DBMS
    • DBMS helps achieve
    • DBMS 3 tier Architecture
    • Relational Calculus in DBMS
    • Serializability in DBMS
    • File Organization in DBMS
    • DBMS Transaction Processing
    • States of Transaction in DBMS
    • Functional Dependency in DBMS
    • Generalization in DBMS
    • Data Independence in DBMS
    • Lock Based Protocols in DBMS
    • Deadlock in DBMS
    • Integrity Constraints in DBMS
    • Concurrency Control in DBMS
    • Validation Based Protocol in DBMS
    • DBMS Locks
    • Normalization in DBMS
    • Transaction Property in DBMS
    • Specialization in DBMS
    • Aggregation in DBMS
    • Types of DBMS

States of Transaction in DBMS

By Payal UdhaniPayal Udhani

States of Transaction in DBMS

Introduction to States of Transaction in DBMS

States of the transaction are the situation and condition in which a transaction in DBMS is currently present. There are many states of transaction like active, failed, committed, aborted and partially committed. A particular transaction can only be in one state at a given time. This state of the transaction helps us to know about the present situation in which the transaction is working and also guides us through how the transaction will proceed further in future. The state of the transaction also tells us about the rules and the way in which the transaction will proceed which will ultimately lead to either commitment or abortion of the transaction.

In this article, we will learn about different states of the transaction in DBMS and also see what rules are followed by each of the state and how each state defines the behavior of the transaction at that particular moment.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Different States of the Transaction in DBMS

Let us discuss different states of the transaction in DBMS.

1. States of Transaction

What happens on the DBMS transaction is that number of small read and write operations are performed on the database and together small tasks of read and write tasks performing similar work are collectively called as transaction. A transaction consisting of group of small tasks can either commit or fail. In between the initialization and completion of the transaction, there are different states involved in the process. The different states of the transaction are described below in detail –

States of Transaction in DBMS

2. Active State

Whenever any database operation is performed on the database like updation, deletion, or insertion which involves the change in the database or even the select operation which involves the retrieval of the data from the database the transaction is started and the beginning state of every transaction is the active state in which whatever instructions are involved in the transaction are and if all the operations are executed successfully then the transaction goes into the partially committed state. In case if any problem occurs while executing any of the instruction in the transaction then the transaction goes into the failed state.

3. Partially Completed State

After all the operations are performed in the transaction the transaction comes into a partially committed state where all the changes are made to the main memory or the local buffer which are temporary in nature. If the changes are made properly then the transaction moves to a committed state where the changes are reflected permanently in the database or in case of any failure in performing the temporary changes the transaction goes into the failed state.

The main purpose for having this state is that whenever we perform database operations the transactions may involve huge amount of changes to be made to the database and in case of power failure or any other technical issue if the system fails then the transaction will lead to inconsistent changes made to the database. To avoid this, we firstly make all the changes to the local repository or reader buffer or main memory for temporary basis so that in case of failure the changes can be reverted and transaction can be rollbacked. This will lead to the implementation of consistency property of the ACID properties of transaction which is the expected behavior for any transaction.

4. Failed State

In case if any of the instruction fails to perform correctly or the changes are being saved to the memory properly then the transaction comes into the failed state.

5. Aborted State

In case if any failure occurs while executing instructions or while making the changes to the memory the state of the transaction changes to aborted after failed where all the changes made to the local memory and the buffer reader are reversed that is deleted or rollbacked.

6. Committed State

Whenever all the instructions inside the transaction are executed successfully and the changes are made to the local memory or the reader buffers successfully then the transaction comes into the committed state where all the changes of the transaction are made permanently to the database. Once the transaction is committed the changes cannot be rollbacked and the transaction then goes into the terminated state where the system is ready to restart the transaction or begin a new one.

7. Terminated State

If there is any problem while executing the transaction, instruction of change reflection and the transaction is in the failed state then the transaction the changes are rollbacked and the transaction comes into terminated state after aborted state. Also, in case if all the operations are performed properly and changes are reflected the database appropriately then the transaction comes into the terminated state after committed state. In the terminated state the transaction is finally completed and the system is ready and consistent for the upcoming transaction to be taken and the old transaction to be stopped.

In case if the transaction fails and goes to aborted state then the database recovery system of DBMS has two options. The first one being the uncompleted, inconsistently or partial the system can restart the same transaction from beginning or the system will kill the ongoing transaction and will make itself free for any further tasks or transaction that the user will begin.

Example

Consider a small example where the businessman wants to save the total sale of whole day in the database. In this case, the transaction will involve the retrieval of all the bill records for the day and then the transaction will enter into the active state where the calculation of the total sale amount of the day will be made. After that if calculation is done successfully then the transaction will move to partially committed state else will go to the failed state. In partially committed state the system will save the total calculated amount to the local main memory and if this is done successfully then the transaction will move on to commit state or will go to a failed state. In committed state the total amount will be saved permanently to the database and the transaction will move onto the terminated state. In case of the failed state transaction the changes are rollbacked and transaction goes to the aborted state where system becomes free.

Conclusion

A transaction in DBMS involves multiple states which define the condition and situation of the transaction at a particular moment. A single transaction can be only in a single state at a given time.

Recommended Articles

This is a guide to States of Transaction in DBMS. Here we discuss the introduction, Different States of the Transaction in DBMS respectively. You may also have a look at the following articles to learn more –

  1. Transaction Property in DBMS
  2. DBMS_Scheduler
  3. DBMS Multivalued Dependency
  4. DBMS Log-Based Recovery
Popular Course in this category
SQL Training Program (10 Courses, 8+ Projects)
  10 Online Courses |  8 Hands-on Projects |  80+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more